+ template<>
+ template<>
+ void testobject::test<4>()
+ {
+ set_test_name("Check bfstream very long string processing");
+
+ Decryptor decryptor("pr7Hhen");
+ STG::ENCRYPT_STREAM estream("pr7Hhen", EncryptCallback, &decryptor);
+ //char buffer[source.length() + 9];
+ //memset(buffer, 0, sizeof(buffer));
+
+ estream.Put(longString.c_str(), longString.length() + 1, true);
+ //ensure("Encryption long string LastSize()", tracker.LastSize() >= source.length() + 1);
+ //ensure("Encryption long string LastBlock() != NULL", tracker.LastBlock() != NULL);
+ //memcpy(buffer, tracker.LastBlock(), std::min(tracker.LastSize(), sizeof(buffer)));
+
+ //dstream.Put(buffer, sizeof(buffer), true);
+ //ensure("Decryption long string LastSize() decryption", tracker.LastSize() >= sizeof(buffer));
+ //ensure("Decryption long string LastBlock() != NULL", tracker.LastBlock() != NULL);
+ //memcpy(buffer, tracker.LastBlock(), std::min(tracker.LastSize(), sizeof(buffer)));
+
+ ensure_equals("Decrypt(Encrypt(source)) == source", decryptor.Result(), longString);
+ }
+
+ template<>
+ template<>
+ void testobject::test<5>()
+ {
+ set_test_name("Check bfstream mechanics");
+
+ TRACKER tracker;
+ STG::ENCRYPT_STREAM stream("pr7Hhen", Callback, &tracker);
+ ensure_equals("CallCount() == 0 after construction", tracker.CallCount(), 0);
+
+ uint32_t block[2] = {0x12345678, 0x87654321};
+ stream.Put(&block[0], sizeof(block[0]));
+ ensure_equals("CallCount() == 0 after first put", tracker.CallCount(), 0);
+ stream.Put(&block[1], sizeof(block[1]));
+ ensure_equals("CallCount() == 1 after second put", tracker.CallCount(), 1);
+ stream.Put(&block[0], 0, true); // Check last callback
+ ensure_equals("CallCount() == 2 after third (null) put", tracker.CallCount(), 2);
+ }
+