X-Git-Url: https://ruin.nu/git/?p=ndwebbie.git;a=blobdiff_plain;f=t%2Fstats.t;fp=t%2Fstats.t;h=952daca74a6f81b87a61e732d24b64ecaa1cce0b;hp=0000000000000000000000000000000000000000;hb=7ec7b824749bb077086f6eeeabe3be6ffad39c66;hpb=3dc80cedd5deba53a4082992de317fbc3acf805c diff --git a/t/stats.t b/t/stats.t new file mode 100644 index 0000000..952daca --- /dev/null +++ b/t/stats.t @@ -0,0 +1,66 @@ +use strict; +use warnings; +use Test2::V0; + +use Data::Dumper; +use FindBin; + +use NDWeb::Stats; + +my $xml = do { + open my $in, '<', "$FindBin::Bin/stats.xml" or die "Can't read file: $!"; + local $/; + <$in> +}; +my @ships = parseStats($xml); + +#print Dumper(\@ships), "\n"; + +is ($ships[0]->{ship}, 'Harpy'); +is ($ships[0]->{race}, 'Terran'); +is ($ships[0]->{class}, 'Fi'); +is ($ships[0]->{type}, 'Normal'); +is ($ships[0]->{baseeta}, 12); +is ($ships[0]->{init}, 11); +is ($ships[0]->{damage}, 14); +is ($ships[8]->{class}, 'Fr'); +is ($ships[8]->{type}, 'Pod'); +is ($ships[8]->{t1}, 'Ro'); +is ($ships[8]->{cloaked}, 0); +is ($ships[11]->{class}, 'De'); +is ($ships[11]->{type}, 'Structure'); +is ($ships[11]->{t1}, 'St'); +is ($ships[16]->{ship}, 'Black Widow'); +is ($ships[16]->{race}, 'Cathaar'); +is ($ships[16]->{class}, 'De'); +is ($ships[16]->{type}, 'EMP'); +is ($ships[16]->{t1}, 'Cr'); +is ($ships[16]->{t2}, '-'); +is ($ships[16]->{baseeta}, 13); +is ($ships[16]->{init}, 2); +is ($ships[16]->{cloaked}, 0); +is ($ships[16]->{damage}, 0); +is ($ships[15]->{t2}, 'Bs'); +is ($ships[22]->{class}, 'Cr'); +is ($ships[22]->{type}, 'Pod'); +is ($ships[22]->{t1}, 'Ro'); +is ($ships[55]->{ship}, 'Gas giant'); +is ($ships[55]->{race}, 'Kinthia'); +is ($ships[55]->{class}, 'Bs'); +is ($ships[55]->{type}, 'EMP'); +is ($ships[55]->{t1}, 'Cr'); +is ($ships[55]->{t2}, '-'); +is ($ships[55]->{baseeta}, 14); +is ($ships[55]->{init}, 1); +is ($ships[55]->{cloaked}, 1); +is ($ships[55]->{damage}, 0); +is ($ships[69]->{ship}, 'Ram'); +is ($ships[69]->{race}, 'Slythonian'); +is ($ships[69]->{class}, 'Co'); +is ($ships[69]->{type}, 'Resources'); +is ($ships[69]->{t1}, 'Re'); +is ($ships[69]->{t2}, '-'); +is ($ships[69]->{baseeta}, 12); +is ($ships[69]->{init}, 40); + +done_testing();