Example #1
0
    def test_basic(self):
        def test(amb):
            x = amb()
            if not x:
                raise Fail
            return x

        ar = Runner(test)
        result = ar.run()
        self.assertEqual(result, True)
Example #2
0
    def test_args(self):
        def test(amb, k):
            x = amb()
            if not x:
                raise Fail
            return k

        ar = Runner(test)
        result = ar.run(123)
        self.assertEqual(result, 123)
Example #3
0
    def test_basic(self):
        def test(amb):
            x = amb()
            if not x:
                raise Fail
            return x

        ar = Runner(test)
        result = ar.run()
        self.assertEqual(result, True)
Example #4
0
    def test_args(self):
        def test(amb, k):
            x = amb()
            if not x:
                raise Fail
            return k

        ar = Runner(test)
        result = ar.run(123)
        self.assertEqual(result, 123)
Example #5
0
 def test_eight(self):
     ar = Runner(eight_queens)
     result = ar.run()
     self.assertEqual(result,
                      [[0, 0], [1, 4], [2, 7], [3, 5], [4, 2], [5, 6], [6, 1], [7, 3]])
Example #6
0
 def test_eight(self):
     ar = Runner(eight_queens)
     result = ar.run()
     self.assertEqual(
         result,
         [[0, 0], [1, 4], [2, 7], [3, 5], [4, 2], [5, 6], [6, 1], [7, 3]])