@@ -217,21 +217,17 @@ namespace ciphers {
217
217
} // namespace ciphers
218
218
219
219
void test () {
220
- // Test 1
221
- std::string text1 = " HEYO" ;
222
- std::string encrypted1 = ciphers::playfair::encrypt (text1, " OLDTAVERN" );
223
- std::string decrypted1 = ciphers::playfair::decrypt (encrypted1, " OLDTAVERN" );
224
- std::cout << " Original text: " << text1;
225
- std::cout << " , Encrypted text (key = OLDTAVERN): " << encrypted1;
226
- std::cout << " , Decrypted text: " << decrypted1 << std::endl;
220
+ // Test 1
221
+ std::string text1 = " heyo" ;
222
+ std::string encrypted1 = ciphers::playfair::encrypt (text1, " oldtavern" );
223
+ std::string decrypted1 = ciphers::playfair::decrypt (encrypted1, " oldtavern" );
224
+ assert (text1 == decrypted1);
227
225
228
226
// Test 2
229
- std::string text2 = " HELLO" ;
230
- std::string encrypted2 = ciphers::playfair::encrypt (text2, " OLDTAVERN" );
231
- std::string decrypted2 = ciphers::playfair::decrypt (encrypted2, " OLDTAVERN" );
232
- std::cout << " Original text: " << text2;
233
- std::cout << " , Encrypted text (key = OLDTAVERN): " << encrypted2;
234
- std::cout << " , Decrypted text: " << decrypted2 << std::endl;
227
+ std::string text2 = " maid" ;
228
+ std::string encrypted2 = ciphers::playfair::encrypt (text2, " oldtavern" );
229
+ std::string decrypted2 = ciphers::playfair::decrypt (encrypted2, " oldtavern" );
230
+ assert (text2 == decrypted2);
235
231
}
236
232
237
233
/* * Driver Code */
0 commit comments