tracks/ocaml/exercises/atbash-cipher/test.ml in trackler-2.0.6.30 vs tracks/ocaml/exercises/atbash-cipher/test.ml in trackler-2.0.6.31
- old
+ new
@@ -2,36 +2,45 @@
open OUnit2
open Atbash_cipher
let ae exp got _test_ctxt = assert_equal ~printer:String.to_string exp got
-let tests =
- ["encode yes">::
- ae "bvh" (encode "yes");
- "encode no">::
- ae "ml" (encode "no");
- "encode OMG">::
- ae "lnt" (encode "OMG");
- "encode spaces">::
- ae "lnt" (encode "O M G");
- "encode mindblowingly">::
- ae "nrmwy oldrm tob" (encode "mindblowingly");
- "encode numbers">::
- ae "gvhgr mt123 gvhgr mt" (encode "Testing,1 2 3, testing.");
- "encode deep thought">::
- ae "gifgs rhurx grlm" (encode "Truth is fiction.");
- "encode all the letters">::
- ae "gsvjf rxpyi ldmul cqfnk hlevi gsvoz abwlt" (encode "The quick brown fox jumps over the lazy dog.");
- "encode ignores non ascii">::
- ae "mlmzh xrrrt mlivw" (encode "non ascii éignored");
- "encode mindblowingly with a different block size">::
- ae "n r m w y o l d r m t o b" (encode ~block_size:1 "mindblowingly");
- "decode exercism">::
- ae "exercism" (decode "vcvix rhn");
- "decode a sentence">::
- ae "anobstacleisoftenasteppingstone" (decode "zmlyh gzxov rhlug vmzhg vkkrm thglm v");
- "decode all the letters">::
- ae "thequickbrownfoxjumpsoverthelazydog" (decode "gsvjf rxpyi ldmul cqfnk hlevi gsvoz abwlt");
- ]
+let encode_tests = [
+ "encode yes" >::
+ ae "bvh" (encode "yes");
+ "encode no" >::
+ ae "ml" (encode "no");
+ "encode OMG" >::
+ ae "lnt" (encode "OMG");
+ "encode spaces" >::
+ ae "lnt" (encode "O M G");
+ "encode mindblowingly" >::
+ ae "nrmwy oldrm tob" (encode "mindblowingly");
+ "encode numbers" >::
+ ae "gvhgr mt123 gvhgr mt" (encode "Testing,1 2 3, testing.");
+ "encode deep thought" >::
+ ae "gifgs rhurx grlm" (encode "Truth is fiction.");
+ "encode all the letters" >::
+ ae "gsvjf rxpyi ldmul cqfnk hlevi gsvoz abwlt" (encode "The quick brown fox jumps over the lazy dog.");
+]
+let decode_tests = [
+ "decode exercism" >::
+ ae "exercism" (decode "vcvix rhn");
+ "decode a sentence" >::
+ ae "anobstacleisoftenasteppingstone" (decode "zmlyh gzxov rhlug vmzhg vkkrm thglm v");
+ "decode numbers" >::
+ ae "testing123testing" (decode "gvhgr mt123 gvhgr mt");
+ "decode all the letters" >::
+ ae "thequickbrownfoxjumpsoverthelazydog" (decode "gsvjf rxpyi ldmul cqfnk hlevi gsvoz abwlt");
+]
+
+let different_block_size_test = [
+ "encode mindblowingly with a different block size">::
+ ae "n r m w y o l d r m t o b" (encode ~block_size:1 "mindblowingly");
+]
+
let () =
- run_test_tt_main ("atbash cipher" >::: tests)
+ run_test_tt_main (
+ "atbash-cipher tests" >:::
+ List.concat [encode_tests; decode_tests; different_block_size_test]
+ )
\ No newline at end of file