summaryrefslogtreecommitdiff
path: root/t/rotors.t
diff options
context:
space:
mode:
Diffstat (limited to 't/rotors.t')
-rw-r--r--t/rotors.t26
1 files changed, 26 insertions, 0 deletions
diff --git a/t/rotors.t b/t/rotors.t
index 509d88d..fb53fe4 100644
--- a/t/rotors.t
+++ b/t/rotors.t
@@ -3,6 +3,7 @@ use DAKKAR::p 'test';
use List::Util 'shuffle';
use Enigmatic::Rotor;
+use Enigmatic::RotorBox;
sub test_the_rotor {
my ($r,$out,$name) = @_;
@@ -56,4 +57,29 @@ subtest 'constraints' => sub {
}
};
+subtest 'rotor box' => sub {
+ my %rotors = (
+ I => 'EKMFLGDQVZNTOWYHXUSPAIBRCJ',
+ II => 'AJDKSIRUXBLHWTMCQGZNPYFVOE',
+ III => 'BDFHJLCPRTXVZNYEIWGAKMUSQO',
+ IV => 'ESOVPZJAYQUIRHXLNFTGKDCMWB',
+ V => 'VZBRGITYUPSDNHLXAWMJQOFECK',
+ VI => 'JPGVOUMFYQBENHZRDKASXLICTW',
+ VII => 'NZJHGRCXMYSWBOUFAIVLPEKQDT',
+ VIII => 'FKQHTLXOCBJSPDZRAMEWNIUYGV',
+ Beta => 'LEYJVCNIXWPBQMDRTAKZGFUHOS',
+ Gamma => 'FSOKANUERHMBTIYCWLQPZXVGJD',
+ );
+
+ my $box = Enigmatic::RotorBox->new();
+
+ %rotors->each(sub {
+ my ($rotor,$wiring) = @_;
+ my $r = $box->get($rotor);
+ my $out = $wiring->split(qr//);
+ test_the_rotor($r,$out,
+ "rotor $rotor from box");
+ });
+};
+
done_testing();