Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
something turned warnings on, probably the test suite…
- Loading branch information
Showing
3 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ use strict; | |
use AutoLoader; | ||
use Carp; | ||
use Storable; | ||
no warnings; | ||
|
||
our $VERSION = '1.5000'; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
|
||
use strict; | ||
use Test; | ||
|
||
my ($x, $y) = (25, 25); | ||
|
||
plan tests => ($x * $y); | ||
|
||
use Games::RolePlay::MapGen; | ||
use Storable qw(freeze thaw); | ||
|
||
my $map = new Games::RolePlay::MapGen({bounding_box => join("x", $x, $y) }); | ||
|
||
$map->generate; | ||
my $saved_string = freeze($map); | ||
|
||
my %checksums = (); | ||
for my $i (0..$x-1) { | ||
for my $j (0..$y-1) { | ||
$checksums{$i}{$j} = &a_kind_of_checksum( $i, $j, $map ); | ||
} | ||
} | ||
|
||
delete $map->{_the_map}; | ||
delete $map->{_the_groups}; | ||
|
||
$map = thaw($saved_string); | ||
|
||
for my $i (0..$x-1) { | ||
for my $j (0..$y-1) { | ||
ok( &a_kind_of_checksum($i, $j, $map), $checksums{$i}{$j} ); | ||
} | ||
} | ||
|
||
sub a_kind_of_checksum { | ||
my ($x, $y, $map) = @_; | ||
|
||
my $tile = $map->{_the_map}[$y][$x]; | ||
|
||
return "nothin' there" if not exists $tile->{type}; | ||
return sprintf('%d-%d-%s-%d%d%d%d', $x, $y, $tile->{type}, map($tile->{od}{$_}, qw(n e s w))); | ||
} |