Commits

Shlomi Fish committed 1f64019

Implement _inc_changed.

Comments (0)

Files changed (2)

abc-path/js/abc-path-test.js

         // TEST
         ok (!mybase._x_in_range(5), '5 is not in range.');
     });
+
+    module("Solver.Board");
+
+    test("Solver.Board iter_changed", function() {
+        expect(3);
+
+        var myboard = new ABC_Path.Solver.Board({});
+
+        // TEST
+        equals(myboard.getIter_changed(), 0, 'iter_changed is initialised to 0.');
+
+        myboard._inc_changed();
+        // TEST
+        equals(myboard.getIter_changed(), 1, 'iter_changed is now 1.');
+
+        myboard._inc_changed();
+        // TEST
+        equals(myboard.getIter_changed(), 2, 'iter_changed is now 2.');
+    });
 }

abc-path/js/abc-path.js

     has: {
         letters_map: {
             is: 'ro',
-            init: (function(){ 
+            init: function(){ 
                 var ret = {};
                 var l = this.letters();
                 for (var i in l) {
                     ret[l[i]] = i;
                 }
                 return ret;
-            })(),
+            },
+        },
+        _iter_changed: {
+            is: 'rw',
+            init: 0,
+        },
+        _moves: {
+            is: 'rw',
+            init: function() { return [];},
+        },
+        _error: {
+            is: 'rw',
+            init: undefined,
         },
     },
     methods: {
                 return;
             }
         },
+        _inc_changed: function() {
+            
+            this.setIter_changed(this.getIter_changed() + 1);
+
+            return;
+        },
     },
 });