blob: f50bce976c81995059e3779efc6017f81a3abc3a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
use DAKKAR::p 'test'; use Enigmatic::Rotor; use Enigmatic::Reflector; use Enigmatic::CryptTrain; subtest 'first position' => sub { my @in = 'A'..'Z'; my @rots = map { Enigmatic::Rotor->new(@in->join) } 1..3; my $refl = Enigmatic::Reflector->new(@in->join); my $train = Enigmatic::CryptTrain->new({ rotors => \@rots, reflector => $refl, positions => [0,0,0], }); my $pos=0; for my $c ('A' .. 'Z') { is($train->map($c), $c, "identity train on $c"); ++$pos;$pos%=26; is_deeply([$train->positions], [$pos,0,0], 'no notches, only 1st moved'); } }; done_testing();
|