Commits

shl...@6a489e09-e8c2-0310-a3fb-a128a961c0b2  committed 2d89aee

1. Fixed a bug in the Planks code that did not expand the state in
display_state().

2. Refactored regress.sh to make it more modular.

3. Invoked ./lm-solve with -I. to use the local modules.

  • Participants
  • Parent commits c3ae849

Comments (0)

Files changed (2)

File lib/Games/LMSolve/Plank/Base.pm

 sub display_state
 {
     my $self = shift;
-    my $state = shift;
+    my $packed_state = shift;
+
+    my $state = $self->unpack_state($packed_state);
 
     my $plank_data = $self->process_plank_data($state);
 

File t/regression/regress.sh

 #!/bin/bash
 
+run_lm_solve()
+{
+    local method="$1"
+    local path="$dir/$T"
+    (cd ../../ && perl -I. ./lm-solve -g $maze_type --rtd --method $method --output-states t/regression/layouts/$path) | md5sum > checksums/$path.$method.md5.new
+    if ! cmp checksums/$path.brfs.md5.new checksums/$path.brfs.md5 ; then
+        echo "$method solutions are not equal for $path"
+    fi
+}
+
 for TYPE in "alice alice" "minotaur minotaur" "plank plank" \
     "hex_plank plank/hex" "plank plank/sample" "numbers number_mazes" \
     "tilt_single tilt/single" "tilt_multi tilt/multi" "tilt_rb tilt/red_blue" \
     (cd ./layouts/$dir/; ls) | 
         (while read T ; do 
             if [ -f ./layouts/$dir/$T ] ; then
-                (cd ../../ && ./lm-solve -g $maze_type --rtd --method brfs t/regression/layouts/$dir/$T) | md5sum > checksums/$dir/$T.brfs.md5.new
-                (cd ../../ && ./lm-solve -g $maze_type --rtd --method dfs t/regression/layouts/$dir/$T) | md5sum > checksums/$dir/$T.dfs.md5.new
-                if ! cmp checksums/$dir/$T.brfs.md5.new checksums/$dir/$T.brfs.md5 ; then
-                    echo "Brfs solutions are not equal for $dir/$T"
-                fi
-
-                if ! cmp checksums/$dir/$T.dfs.md5.new checksums/$dir/$T.dfs.md5 ; then
-                    echo "DFS solutions are not equal for $dir/$T"
-                fi
+                run_lm_solve brfs
+                run_lm_solve dfs
             fi
         done
         )