]> git.stg.codes - stg.git/blobdiff - tests/test_crypto.cpp
Merge branch 'stg-2.409' into stg-2.409-radius
[stg.git] / tests / test_crypto.cpp
index 47dbcbb4361daa0b1341882da7e39f7290433573..f95ecdb0d006f6f8cd61eeea880fb590ab5d79e9 100644 (file)
@@ -423,11 +423,12 @@ namespace tut
 
         BLOWFISH_CTX ctx;
         InitContext("pr7Hhen", 7, &ctx);
 
         BLOWFISH_CTX ctx;
         InitContext("pr7Hhen", 7, &ctx);
-        char longTest[] = "abcdefghijklmnopqrstuvwxyz 0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ";
-        EncryptString(longTest, longTest, sizeof(longTest), &ctx);
+        std::string source("abcdefghijklmnopqrstuvwxyz 0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ");
+        char longTest[source.length() + 8];
+        EncryptString(longTest, source.c_str(), source.length() + 1, &ctx);
         DecryptString(longTest, longTest, sizeof(longTest), &ctx);
 
         DecryptString(longTest, longTest, sizeof(longTest), &ctx);
 
-        ensure("DecryptString(EncryptString(longTest)) == longTest", equalString(longTest, "abcdefghijklmnopqrstuvwxyz 0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ", sizeof(longTest)));
+        ensure_equals("DecryptString(EncryptString(longTest)) == longTest", source, std::string(longTest));
     }
 
 }
     }
 
 }