summaryrefslogtreecommitdiff
path: root/t/full-enigma.t
diff options
context:
space:
mode:
Diffstat (limited to 't/full-enigma.t')
-rw-r--r--t/full-enigma.t29
1 files changed, 6 insertions, 23 deletions
diff --git a/t/full-enigma.t b/t/full-enigma.t
index 0015b46..872b199 100644
--- a/t/full-enigma.t
+++ b/t/full-enigma.t
@@ -1,6 +1,6 @@
#!perl
use DAKKAR::p 'test';
-
+use Test::Enigmatic;
use Enigmatic::Machine;
sub real_machine {
@@ -27,7 +27,6 @@ SSEN ACHX EKNS VIER MBFA
ELLT YNNN NNNO OOVI ERYS
ICHT EINS NULL
EOPLAIN
-$plaintext =~ s{\s+}{}g;
my $ciphertext = <<'EOCIPHER';
NCZW VUSX PNYM INHZ XMQX
@@ -43,27 +42,11 @@ ANJM OLBG FFLE OPRG TFLV
RHOW OPBE KVWM UQFM PWPA
RMFH AGKX IIBG
EOCIPHER
-$ciphertext =~ s{\s+}{}g;
-
-note "encrypt real";
-
-my $check = real_machine->map_string($plaintext);
-p $check;
-is($check,$ciphertext,
- 'ok crypt');
-
-note "round-trip check";
-
-$check = real_machine->map_string($check);
-p $check;
-is($check,$plaintext,
- 'round tripped');
-
-note "decrypt real";
-$check = real_machine->map_string($ciphertext);
-p $check;
-is($check,$plaintext,
- 'ok plain');
+Test::Enigmatic::test_full_machine(
+ \&real_machine,
+ $plaintext,
+ $ciphertext);
+done_testing();