From ebae593425aef965ca2504db727c56e70d308d87 Mon Sep 17 00:00:00 2001 From: dakkar Date: Mon, 29 Aug 2011 14:24:53 +0100 Subject: notches --- t/rotors.t | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 't/rotors.t') diff --git a/t/rotors.t b/t/rotors.t index 9e0b2f8..4676a55 100644 --- a/t/rotors.t +++ b/t/rotors.t @@ -67,6 +67,18 @@ subtest 'rotor box' => sub { Beta => 'LEYJVCNIXWPBQMDRTAKZGFUHOS', Gamma => 'FSOKANUERHMBTIYCWLQPZXVGJD', ); + my %notch_at = ( + I => ['Q'], + II => ['E'], + III => ['V'], + IV => ['J'], + V => ['Z'], + VI => ['Z','M'], + VII => ['Z','M'], + VIII => ['Z','M'], + Beta => [], + Gamma => [], + ); my $box = Enigmatic::RotorBox->new(); @@ -77,6 +89,21 @@ subtest 'rotor box' => sub { Test::Enigmatic::test_static_map( $r,$out, "rotor $rotor from box"); + + my @notches = $notch_at{$rotor}->flatten; + my @not_notches = do { + my %tmp;@tmp{'A'..'Z'}=(); + delete @tmp{@notches}; + keys %tmp; + }; + for my $l (@notches) { + ok($r->has_notch_at($l), + "rotor $rotor has notch at $l"); + } + for my $l (@not_notches) { + ok(! $r->has_notch_at($l), + "rotor $rotor has no notch at $l"); + } }); }; -- cgit v1.2.3