z3 0.0.20181229 → 0.0.20220320
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +0 -0
- data/README.md +0 -2
- data/Rakefile +8 -1
- data/examples/abc_path +187 -0
- data/examples/abc_path-1.txt +7 -0
- data/examples/algebra_problems +12 -12
- data/examples/aquarium +133 -0
- data/examples/aquarium-1.txt +11 -0
- data/examples/bridges +2 -2
- data/examples/bridges-1.txt +0 -0
- data/examples/cats_organized_neatly +133 -0
- data/examples/cats_organized_neatly-10.txt +15 -0
- data/examples/cats_organized_neatly-3.txt +8 -0
- data/examples/cats_organized_neatly-48.txt +32 -0
- data/examples/circuit_problems +4 -4
- data/examples/clogic_puzzle +2 -2
- data/examples/color_nonogram +150 -0
- data/examples/color_nonogram-1.txt +23 -0
- data/examples/crossflip +2 -4
- data/examples/dominion +153 -0
- data/examples/dominion-1.txt +8 -0
- data/examples/dominosa +133 -0
- data/examples/dominosa-1.txt +8 -0
- data/examples/eulero +99 -0
- data/examples/eulero-1.txt +5 -0
- data/examples/four_hackers_puzzle +2 -2
- data/examples/futoshiki +128 -0
- data/examples/futoshiki-1.txt +17 -0
- data/examples/kakurasu +73 -0
- data/examples/kakurasu-1.txt +2 -0
- data/examples/kakuro +2 -2
- data/examples/kakuro-1.txt +0 -0
- data/examples/killer_sudoku +88 -0
- data/examples/killer_sudoku-1.txt +17 -0
- data/examples/killer_sudoku-2.txt +53 -0
- data/examples/kinematics_problems +20 -20
- data/examples/knights_puzzle +2 -2
- data/examples/kropki +100 -0
- data/examples/kropki-1.txt +13 -0
- data/examples/letter_connections +2 -2
- data/examples/letter_connections-1.txt +0 -0
- data/examples/light_up +2 -2
- data/examples/light_up-1.txt +0 -0
- data/examples/minisudoku +2 -2
- data/examples/minisudoku-1.txt +0 -0
- data/examples/miracle_sudoku +135 -0
- data/examples/miracle_sudoku-1.txt +9 -0
- data/examples/mortal_coil_puzzle +2 -2
- data/examples/mortal_coil_puzzle-9.txt +0 -0
- data/examples/nanro +245 -0
- data/examples/nanro-1.txt +8 -0
- data/examples/nine_clocks +106 -0
- data/examples/nonogram +2 -2
- data/examples/pyramid_nonogram +2 -2
- data/examples/regexp_crossword/beginner-1.txt +0 -0
- data/examples/regexp_crossword/beginner-2.txt +0 -0
- data/examples/regexp_crossword/beginner-3.txt +0 -0
- data/examples/regexp_crossword/beginner-4.txt +0 -0
- data/examples/regexp_crossword/beginner-5.txt +0 -0
- data/examples/regexp_crossword/experienced-1.txt +0 -0
- data/examples/regexp_crossword/experienced-2.txt +0 -0
- data/examples/regexp_crossword/experienced-3.txt +0 -0
- data/examples/regexp_crossword/experienced-4.txt +0 -0
- data/examples/regexp_crossword/experienced-5.txt +0 -0
- data/examples/regexp_crossword/tutorial-1.txt +0 -0
- data/examples/regexp_crossword/tutorial-2.txt +0 -0
- data/examples/regexp_crossword/tutorial-3.txt +0 -0
- data/examples/regexp_crossword/tutorial-4.txt +0 -0
- data/examples/regexp_crossword/tutorial-5.txt +0 -0
- data/examples/regexp_crossword/tutorial-6.txt +0 -0
- data/examples/regexp_crossword/tutorial-7.txt +0 -0
- data/examples/regexp_crossword/tutorial-8.txt +0 -0
- data/examples/regexp_crossword/tutorial-9.txt +0 -0
- data/examples/regexp_crossword_solver +2 -2
- data/examples/regexp_solver +2 -2
- data/examples/regexp_string_matcher.rb +0 -0
- data/examples/renzoku +124 -0
- data/examples/renzoku-1.txt +17 -0
- data/examples/sandwich_sudoku +101 -0
- data/examples/sandwich_sudoku-1.txt +10 -0
- data/examples/selfref +2 -2
- data/examples/simple_regexp_parser.rb +0 -0
- data/examples/skyscrapers +118 -0
- data/examples/skyscrapers-1.txt +6 -0
- data/examples/skyscrapers-2.txt +11 -0
- data/examples/star_battle +134 -0
- data/examples/star_battle-1.txt +10 -0
- data/examples/stitches +180 -0
- data/examples/stitches-1.txt +11 -0
- data/examples/sudoku +2 -2
- data/examples/sudoku-1.txt +0 -0
- data/examples/suguru +199 -0
- data/examples/suguru-1.txt +17 -0
- data/examples/verbal_arithmetic +2 -2
- data/examples/yajilin +268 -0
- data/examples/yajilin-1.txt +10 -0
- data/lib/z3/ast.rb +0 -0
- data/lib/z3/context.rb +0 -0
- data/lib/z3/exception.rb +0 -0
- data/lib/z3/expr/arith_expr.rb +0 -0
- data/lib/z3/expr/array_expr.rb +0 -0
- data/lib/z3/expr/bitvec_expr.rb +47 -2
- data/lib/z3/expr/bool_expr.rb +0 -0
- data/lib/z3/expr/expr.rb +3 -3
- data/lib/z3/expr/float_expr.rb +0 -0
- data/lib/z3/expr/int_expr.rb +0 -0
- data/lib/z3/expr/real_expr.rb +0 -0
- data/lib/z3/expr/rounding_mode_expr.rb +0 -0
- data/lib/z3/expr/set_expr.rb +0 -0
- data/lib/z3/func_decl.rb +0 -0
- data/lib/z3/goal.rb +0 -0
- data/lib/z3/hacks.rb +0 -0
- data/lib/z3/interface.rb +0 -0
- data/lib/z3/low_level.rb +0 -0
- data/lib/z3/low_level_auto.rb +138 -10
- data/lib/z3/model.rb +0 -0
- data/lib/z3/optimize.rb +0 -0
- data/lib/z3/printer.rb +0 -0
- data/lib/z3/probe.rb +0 -0
- data/lib/z3/solver.rb +0 -0
- data/lib/z3/sort/array_sort.rb +0 -0
- data/lib/z3/sort/bitvec_sort.rb +0 -0
- data/lib/z3/sort/bool_sort.rb +0 -0
- data/lib/z3/sort/float_sort.rb +0 -0
- data/lib/z3/sort/int_sort.rb +0 -0
- data/lib/z3/sort/real_sort.rb +0 -0
- data/lib/z3/sort/rounding_mode_sort.rb +0 -0
- data/lib/z3/sort/set_sort.rb +0 -0
- data/lib/z3/sort/sort.rb +0 -0
- data/lib/z3/tactic.rb +0 -0
- data/lib/z3/very_low_level.rb +5 -1
- data/lib/z3/very_low_level_auto.rb +35 -3
- data/lib/z3.rb +0 -0
- data/spec/array_expr_spec.rb +0 -0
- data/spec/array_sort_spec.rb +0 -0
- data/spec/bitvec_expr_spec.rb +13 -0
- data/spec/bitvec_sort_spec.rb +0 -0
- data/spec/bool_expr_spec.rb +0 -0
- data/spec/bool_sort_spec.rb +0 -0
- data/spec/coverage_helper.rb +0 -0
- data/spec/expr_spec.rb +0 -0
- data/spec/float_expr_spec.rb +0 -0
- data/spec/float_sort_spec.rb +0 -0
- data/spec/goal_spec.rb +0 -0
- data/spec/int_expr_spec.rb +0 -0
- data/spec/int_sort_spec.rb +0 -0
- data/spec/integration/abc_path_spec.rb +21 -0
- data/spec/integration/algebra_problems_spec.rb +0 -0
- data/spec/integration/aquarium_spec.rb +27 -0
- data/spec/integration/basic_int_math_spec.rb +0 -0
- data/spec/integration/basic_logic_spec.rb +0 -0
- data/spec/integration/bit_tricks_spec.rb +0 -0
- data/spec/integration/bridges_spec.rb +0 -0
- data/spec/integration/cats_organized_neatly_spec.rb +14 -0
- data/spec/integration/cicruit_problem_spec.rb +0 -0
- data/spec/integration/color_nonogram_spec.rb +28 -0
- data/spec/integration/crossflip_spec.rb +0 -0
- data/spec/integration/dominion_spec.rb +14 -0
- data/spec/integration/dominosa_spec.rb +21 -0
- data/spec/integration/eulero_spec.rb +11 -0
- data/spec/integration/four_hackers_puzzle_spec.rb +0 -0
- data/spec/integration/futoshiki_spec.rb +23 -0
- data/spec/integration/geometry_problem_spec.rb +0 -0
- data/spec/integration/kakurasu_spec.rb +18 -0
- data/spec/integration/kakuro_spec.rb +0 -0
- data/spec/integration/killer_sudoku_spec.rb +10 -0
- data/spec/integration/kinematics_problems_spec.rb +0 -0
- data/spec/integration/knights_puzzle_spec.rb +11 -11
- data/spec/integration/kropki_spec.rb +19 -0
- data/spec/integration/letter_connections_spec.rb +0 -0
- data/spec/integration/light_up_spec.rb +0 -0
- data/spec/integration/minisudoku_spec.rb +0 -0
- data/spec/integration/miracle_sudoku_spec.rb +15 -0
- data/spec/integration/mortal_coil_puzzle_spec.rb +8 -6
- data/spec/integration/nanro_spec.rb +39 -0
- data/spec/integration/nine_clocks_spec.rb +30 -0
- data/spec/integration/nonogram_spec.rb +0 -0
- data/spec/integration/oneofus_spec.rb +0 -0
- data/spec/integration/pyramid_nonogram_spec.rb +0 -0
- data/spec/integration/regexp_crossword_solver_spec.rb +1 -1
- data/spec/integration/regexp_solver_spec.rb +0 -0
- data/spec/integration/renzoku_spec.rb +23 -0
- data/spec/integration/sandwich_sudoku_spec.rb +15 -0
- data/spec/integration/selfref_spec.rb +0 -0
- data/spec/integration/skyscraper_spec.rb +10 -0
- data/spec/integration/star_battle_spec.rb +27 -0
- data/spec/integration/stitches_spec.rb +25 -0
- data/spec/integration/sudoku_spec.rb +0 -0
- data/spec/integration/suguru_spec.rb +23 -0
- data/spec/integration/verbal_arithmetic_spec.rb +0 -0
- data/spec/integration/yajilin_spec.rb +25 -0
- data/spec/integration/zebra_puzzle_spec.rb +0 -0
- data/spec/interface_spec.rb +0 -0
- data/spec/model_spec.rb +0 -0
- data/spec/optimize_spec.rb +3 -1
- data/spec/printer_spec.rb +0 -0
- data/spec/probe_spec.rb +0 -0
- data/spec/real_expr_spec.rb +0 -0
- data/spec/real_sort_spec.rb +0 -0
- data/spec/rounding_mode_expr_spec.rb +0 -0
- data/spec/rounding_mode_sort_spec.rb +0 -0
- data/spec/set_expr_spec.rb +15 -9
- data/spec/set_sort_spec.rb +0 -0
- data/spec/solver_spec.rb +1 -2
- data/spec/sort_spec.rb +0 -0
- data/spec/spec_helper.rb +15 -0
- data/spec/tactic_spec.rb +0 -0
- data/spec/z3_spec.rb +0 -0
- metadata +85 -5
data/spec/bitvec_expr_spec.rb
CHANGED
@@ -36,6 +36,19 @@ module Z3
|
|
36
36
|
expect([a == 30, b == 42, c == (a * b)]).to have_solution(c => 236)
|
37
37
|
end
|
38
38
|
|
39
|
+
it "/" do
|
40
|
+
expect{ a / b }.to raise_error(Z3::Exception)
|
41
|
+
expect([a == 200, b == 20, c == a.unsigned_div(b)]).to have_solution(c => 10)
|
42
|
+
expect([a == 200, b == 20, c == a.signed_div(b)]).to have_solution(c => 254)
|
43
|
+
end
|
44
|
+
|
45
|
+
it "%" do
|
46
|
+
expect{ a % b }.to raise_error(Z3::Exception)
|
47
|
+
expect([a == 200, b == 20, c == a.signed_mod(b)]).to have_solution(c => 4)
|
48
|
+
expect([a == 200, b == 20, c == a.signed_rem(b)]).to have_solution(c => 240)
|
49
|
+
expect([a == 200, b == 20, c == a.unsigned_rem(b)]).to have_solution(c => 0)
|
50
|
+
end
|
51
|
+
|
39
52
|
it "&" do
|
40
53
|
expect([a == 50, b == 27, c == (a & b)]).to have_solution(c => 18)
|
41
54
|
end
|
data/spec/bitvec_sort_spec.rb
CHANGED
File without changes
|
data/spec/bool_expr_spec.rb
CHANGED
File without changes
|
data/spec/bool_sort_spec.rb
CHANGED
File without changes
|
data/spec/coverage_helper.rb
CHANGED
File without changes
|
data/spec/expr_spec.rb
CHANGED
File without changes
|
data/spec/float_expr_spec.rb
CHANGED
File without changes
|
data/spec/float_sort_spec.rb
CHANGED
File without changes
|
data/spec/goal_spec.rb
CHANGED
File without changes
|
data/spec/int_expr_spec.rb
CHANGED
File without changes
|
data/spec/int_sort_spec.rb
CHANGED
File without changes
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# There are multiple solutions, so this test is nondeterministic
|
2
|
+
# This is what Z3 4.8.13 returns
|
3
|
+
describe "ABC Path" do
|
4
|
+
it do
|
5
|
+
expect("abc_path").to have_output <<'EOF'
|
6
|
+
C O R D F B U
|
7
|
+
|
8
|
+
N o-n l-k-j L
|
9
|
+
| |/ |
|
10
|
+
G p m g-f i I
|
11
|
+
| x /
|
12
|
+
Q q-r e h a H
|
13
|
+
/ | |
|
14
|
+
V s v d-c-b S
|
15
|
+
x \
|
16
|
+
T u-t w-x-y X
|
17
|
+
|
18
|
+
J P M W K Y E
|
19
|
+
EOF
|
20
|
+
end
|
21
|
+
end
|
File without changes
|
@@ -0,0 +1,27 @@
|
|
1
|
+
describe "Aquarium" do
|
2
|
+
it do
|
3
|
+
expect("aquarium").to have_output <<EOF
|
4
|
+
+-+-+-+-+-+-+-+-+-+-+
|
5
|
+
|# #|# # # # #|# #| |
|
6
|
+
+ +-+-+-+-+-+ +-+ + +
|
7
|
+
|#|#| |# #|#|#|
|
8
|
+
+ + + +-+-+-+-+-+-+-+
|
9
|
+
|#|#| |# #|# #| |#|
|
10
|
+
+ + + +-+-+-+-+ + +
|
11
|
+
|#|#|#| | | |#|
|
12
|
+
+ +-+-+ + +-+-+-+
|
13
|
+
|#| | | |
|
14
|
+
+ + +-+ +-+ + +-+-+
|
15
|
+
|#| | | | |#|#|# #|
|
16
|
+
+ + + +-+-+ + +-+ +
|
17
|
+
|#| | | |#| |# #|
|
18
|
+
+ + +-+ + +-+ +-+ +
|
19
|
+
|#|# #| | |# # #|#|
|
20
|
+
+-+-+-+ + + +-+-+-+
|
21
|
+
| | |#|#|#| |
|
22
|
+
+ +-+-+ + +-+ + +
|
23
|
+
|# # #| |# #|#|# #|
|
24
|
+
+-+-+-+-+-+-+-+-+-+-+
|
25
|
+
EOF
|
26
|
+
end
|
27
|
+
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,28 @@
|
|
1
|
+
describe "Color Nonogram" do
|
2
|
+
let(:ascii_board) do <<EOF
|
3
|
+
3 3 3 3 3 3 3 3 3 3
|
4
|
+
3 0 2 2 0 0 0 0 0 3
|
5
|
+
3 0 0 0 0 0 0 0 0 3
|
6
|
+
3 2 1 0 0 0 2 1 0 3
|
7
|
+
3 3 3 0 0 0 1 1 0 0
|
8
|
+
3 0 0 0 0 0 0 0 0 0
|
9
|
+
0 2 2 1 2 2 2 2 0 3
|
10
|
+
0 0 2 2 2 2 2 0 0 3
|
11
|
+
3 0 0 0 0 0 0 0 0 3
|
12
|
+
3 0 0 3 3 3 3 0 0 3
|
13
|
+
EOF
|
14
|
+
end
|
15
|
+
|
16
|
+
it do
|
17
|
+
color_board = ascii_board.gsub(/\d/) do |i|
|
18
|
+
{
|
19
|
+
"0" => "\e[38;2;255;0;0m0\e[0m",
|
20
|
+
"1" => "\e[38;2;0;0;0m1\e[0m",
|
21
|
+
"2" => "\e[38;2;255;255;255m2\e[0m",
|
22
|
+
"3" => "\e[38;2;165;42;42m3\e[0m",
|
23
|
+
}[i]
|
24
|
+
end
|
25
|
+
|
26
|
+
expect("color_nonogram").to have_output color_board
|
27
|
+
end
|
28
|
+
end
|
File without changes
|
@@ -0,0 +1,21 @@
|
|
1
|
+
describe "Dominosa" do
|
2
|
+
it do
|
3
|
+
expect("dominosa").to have_output <<EOF
|
4
|
+
5*5 7 4*1 1 4 2 3
|
5
|
+
* * * * *
|
6
|
+
2*0 2 4*7 5 4 2 0
|
7
|
+
|
8
|
+
4*0 0 3 2 0 3 4*5
|
9
|
+
* * * * *
|
10
|
+
1*1 6 4 6 5 2 5 6
|
11
|
+
* *
|
12
|
+
6 1 1 7*7 5 6 3 6
|
13
|
+
* * * * *
|
14
|
+
7 3 0 2*4 2 1 6*3
|
15
|
+
|
16
|
+
6 5*6 0 1 3*3 0*0
|
17
|
+
* * *
|
18
|
+
4 5*7 7 7 2*1 7*3
|
19
|
+
EOF
|
20
|
+
end
|
21
|
+
end
|
File without changes
|
@@ -0,0 +1,23 @@
|
|
1
|
+
describe "Futoshiki" do
|
2
|
+
it do
|
3
|
+
expect("futoshiki").to have_output <<EOF
|
4
|
+
2 5 3 4 1 7 6<9 8
|
5
|
+
|
6
|
+
1 9 7 2 8 5 3<4<6
|
7
|
+
_
|
8
|
+
7<8 2 5>3>1 4<6 9
|
9
|
+
^
|
10
|
+
8 1<5<9 7 6 2 3 4
|
11
|
+
^
|
12
|
+
4 7>6>1 9 2 5 8 3
|
13
|
+
^ ^ ^
|
14
|
+
6 4 1 8 2 3 9 5 7
|
15
|
+
_ _ ^ _ _
|
16
|
+
9 3 4 6>5 8 7 1 2
|
17
|
+
_
|
18
|
+
5 2 9>3 6>4 8>7 1
|
19
|
+
_
|
20
|
+
3 6 8>7>4 9 1<2 5
|
21
|
+
EOF
|
22
|
+
end
|
23
|
+
end
|
File without changes
|
@@ -0,0 +1,18 @@
|
|
1
|
+
describe "Kakurasu" do
|
2
|
+
it do
|
3
|
+
expect("kakurasu").to have_output <<EOF
|
4
|
+
[ ][ ][X][ ][ ][ ][X][ ][ ][ ][ ][ ]
|
5
|
+
[ ][X][ ][X][ ][ ][ ][ ][ ][X][X][X]
|
6
|
+
[ ][X][X][X][ ][ ][X][ ][ ][ ][ ][ ]
|
7
|
+
[ ][X][X][ ][ ][X][X][X][X][ ][X][X]
|
8
|
+
[ ][X][ ][ ][ ][ ][ ][ ][ ][ ][ ][ ]
|
9
|
+
[ ][ ][X][ ][ ][ ][ ][X][ ][ ][X][ ]
|
10
|
+
[X][ ][ ][ ][ ][X][X][ ][ ][ ][X][X]
|
11
|
+
[ ][ ][ ][ ][ ][ ][X][ ][ ][ ][X][X]
|
12
|
+
[ ][ ][X][ ][ ][ ][ ][ ][ ][ ][X][ ]
|
13
|
+
[ ][ ][ ][ ][X][ ][X][ ][X][ ][X][ ]
|
14
|
+
[ ][ ][ ][ ][ ][X][X][ ][X][ ][X][ ]
|
15
|
+
[ ][ ][X][ ][X][ ][X][ ][X][ ][X][ ]
|
16
|
+
EOF
|
17
|
+
end
|
18
|
+
end
|
File without changes
|
File without changes
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# There are multiple solutions, so this test is nondeterministic
|
2
|
-
#
|
2
|
+
# This is what Z3 4.8.13 returns
|
3
3
|
describe "Knights Swap Puzzle" do
|
4
4
|
it do
|
5
5
|
expect("knights_puzzle").to have_output <<EOF
|
@@ -9,28 +9,28 @@ bbb.
|
|
9
9
|
xbxw
|
10
10
|
..ww
|
11
11
|
x.xw
|
12
|
-
|
12
|
+
w: 2,2 -> 3,0
|
13
13
|
|
14
14
|
State 1:
|
15
|
-
|
15
|
+
bbbw
|
16
16
|
xbxw
|
17
|
-
|
17
|
+
...w
|
18
18
|
x.xw
|
19
|
-
|
19
|
+
b: 1,0 -> 2,2
|
20
20
|
|
21
21
|
State 2:
|
22
|
-
.
|
22
|
+
b.bw
|
23
23
|
xbxw
|
24
|
-
|
24
|
+
..bw
|
25
25
|
x.xw
|
26
|
-
|
26
|
+
w: 3,1 -> 1,0
|
27
27
|
|
28
28
|
State 3:
|
29
|
+
bwbw
|
30
|
+
xbx.
|
29
31
|
..bw
|
30
|
-
xbxw
|
31
|
-
.bbw
|
32
32
|
x.xw
|
33
|
-
|
33
|
+
b: 0,0 -> 1,2
|
34
34
|
|
35
35
|
State 4:
|
36
36
|
.wbw
|
@@ -0,0 +1,19 @@
|
|
1
|
+
describe "Kropki" do
|
2
|
+
it do
|
3
|
+
expect("kropki").to have_output <<EOF
|
4
|
+
+-+-+-+-+-+-+
|
5
|
+
|5|1*2|6*3o4|
|
6
|
+
+-+-+-+*+o+*+
|
7
|
+
|1|6o5|3o4*2|
|
8
|
+
+-+-+o+o+-+-+
|
9
|
+
|3o4|6|2o1|5|
|
10
|
+
+*+o+-+-+o+-+
|
11
|
+
|6*3o4o5|2*1|
|
12
|
+
+-+-+-+o+-+-+
|
13
|
+
|2|5|1|4|6*3|
|
14
|
+
+*+-+-+-+o+*+
|
15
|
+
|4*2o3|1|5o6|
|
16
|
+
+-+-+-+-+-+-+
|
17
|
+
EOF
|
18
|
+
end
|
19
|
+
end
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,15 @@
|
|
1
|
+
describe "Miracle Sudoku" do
|
2
|
+
it do
|
3
|
+
expect("miracle_sudoku").to have_output <<EOF
|
4
|
+
4 8 3 7 2 6 1 5 9
|
5
|
+
7 2 6 1 5 9 4 8 3
|
6
|
+
1 5 9 4 8 3 7 2 6
|
7
|
+
8 3 7 2 6 1 5 9 4
|
8
|
+
2 6 1 5 9 4 8 3 7
|
9
|
+
5 9 4 8 3 7 2 6 1
|
10
|
+
3 7 2 6 1 5 9 4 8
|
11
|
+
6 1 5 9 4 8 3 7 2
|
12
|
+
9 4 8 3 7 2 6 1 5
|
13
|
+
EOF
|
14
|
+
end
|
15
|
+
end
|
@@ -1,12 +1,14 @@
|
|
1
|
+
# There are multiple solutions, so this test is nondeterministic
|
2
|
+
# This is what Z3 4.8.13 returns
|
1
3
|
describe "Mortal Coil Puzzle" do
|
2
4
|
it do
|
3
5
|
expect("mortal_coil_puzzle").to have_output <<EOF
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
4 3 2 ### 20 19
|
7
|
+
5 ### 1 ### 21 18
|
8
|
+
6 25 24 23 22 17
|
9
|
+
7 26 27 28 ### 16
|
10
|
+
8 ### 30 29 ### 15
|
11
|
+
9 10 11 12 13 14
|
10
12
|
EOF
|
11
13
|
end
|
12
14
|
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
describe "Nanro" do
|
2
|
+
it do
|
3
|
+
expect("nanro").to have_output <<~EOF
|
4
|
+
*---*---*---*---*---*---*---*---*
|
5
|
+
| | | |
|
6
|
+
| 6 6 6 6 | 1 | 3 3 |
|
7
|
+
| | | |
|
8
|
+
* *---* *---* * *
|
9
|
+
| | | | | | |
|
10
|
+
| 6 | 1 | 6 | 1 | | 3 |
|
11
|
+
| | | | | | |
|
12
|
+
*---* *---*---*---* *---* *
|
13
|
+
| | | | | | | |
|
14
|
+
| 1 | | 1 | 2 | | 3 | |
|
15
|
+
| | | | | | | |
|
16
|
+
*---*---*---*---* *---* * *
|
17
|
+
| | | | | | | | |
|
18
|
+
| | 2 | 1 | | 2 | 1 | 3 | |
|
19
|
+
| | | | | | | | |
|
20
|
+
* * *---* * *---* *---*
|
21
|
+
| | | | | | |
|
22
|
+
| 1 | 2 | 1 | | 3 | 4 |
|
23
|
+
| | | | | | |
|
24
|
+
* *---* *---*---*---*---* *
|
25
|
+
| | | | | | | |
|
26
|
+
| | 1 | | 2 | 1 | 3 | 4 |
|
27
|
+
| | | | | | | |
|
28
|
+
* *---*---* *---* * *
|
29
|
+
| | | | | | |
|
30
|
+
| | 2 | 1 | 2 | 3 3 | 4 |
|
31
|
+
| | | | | | |
|
32
|
+
*---* * *---*---*---*---* *
|
33
|
+
| | | | | | |
|
34
|
+
| 1 | 2 | | 1 | 2 2 | 4 |
|
35
|
+
| | | | | | |
|
36
|
+
*---*---*---*---*---*---*---*---*
|
37
|
+
EOF
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
describe "Nine Clocks" do
|
2
|
+
it do
|
3
|
+
expect("nine_clocks").to have_output <<EOF
|
4
|
+
IN:
|
5
|
+
1 0 1
|
6
|
+
0 2 3
|
7
|
+
1 3 2
|
8
|
+
OUT:
|
9
|
+
1 0 0
|
10
|
+
0 0 0
|
11
|
+
0 0 0
|
12
|
+
IN:
|
13
|
+
0 2 0
|
14
|
+
2 3 2
|
15
|
+
3 3 3
|
16
|
+
OUT:
|
17
|
+
0 1 0
|
18
|
+
0 0 0
|
19
|
+
0 0 0
|
20
|
+
IN:
|
21
|
+
2 3 2
|
22
|
+
3 1 3
|
23
|
+
2 3 2
|
24
|
+
OUT:
|
25
|
+
0 0 0
|
26
|
+
0 1 0
|
27
|
+
0 0 0
|
28
|
+
EOF
|
29
|
+
end
|
30
|
+
end
|
File without changes
|
File without changes
|
File without changes
|
@@ -15,7 +15,7 @@ describe "Regexp Crossword Solver" do
|
|
15
15
|
let(:rows) { example.last(row_number) }
|
16
16
|
|
17
17
|
it "matches output" do
|
18
|
-
output_rows = `#{binary} #{example_path}`.split("\n").map(&:chomp)
|
18
|
+
output_rows = `#{binary} #{example_path}`.split("\n").map(&:chomp).map{|x| x.gsub("\\r", "\r")}
|
19
19
|
output_cols = output_rows.map(&:chars).transpose.map(&:join)
|
20
20
|
expect(output_rows.size).to eq(rows.size)
|
21
21
|
expect(output_cols.size).to eq(cols.size)
|
File without changes
|
@@ -0,0 +1,23 @@
|
|
1
|
+
describe "Renzoku" do
|
2
|
+
it do
|
3
|
+
expect("renzoku").to have_output <<EOF
|
4
|
+
2 4 7 1 3 9.8 5.6
|
5
|
+
. . . .
|
6
|
+
6.5 8.9 4 1.2.3 7
|
7
|
+
. .
|
8
|
+
7 9 2 5.6 3.4 1 8
|
9
|
+
|
10
|
+
4 7.6 3.2 8 1 9 5
|
11
|
+
. . .
|
12
|
+
5 8 1 4 9 2 7.6 3
|
13
|
+
.
|
14
|
+
8 3.4 7 1 5.6 2 9
|
15
|
+
. .
|
16
|
+
1.2 9 6.5 7 3 8 4
|
17
|
+
. .
|
18
|
+
9 1 3 8.7.6.5.4 2
|
19
|
+
. .
|
20
|
+
3 6.5 2 8 4 9 7 1
|
21
|
+
EOF
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
describe "Sandwich Sudoku" do
|
2
|
+
it do
|
3
|
+
expect("sandwich_sudoku").to have_output <<EOF
|
4
|
+
4 8 5 6 7 9 3 2 1
|
5
|
+
3 2 9 5 8 1 6 4 7
|
6
|
+
7 1 6 2 3 4 5 9 8
|
7
|
+
1 7 2 9 5 3 8 6 4
|
8
|
+
6 9 4 8 1 2 7 3 5
|
9
|
+
8 5 3 7 4 6 9 1 2
|
10
|
+
5 3 1 4 9 7 2 8 6
|
11
|
+
9 6 8 1 2 5 4 7 3
|
12
|
+
2 4 7 3 6 8 1 5 9
|
13
|
+
EOF
|
14
|
+
end
|
15
|
+
end
|
File without changes
|
@@ -0,0 +1,27 @@
|
|
1
|
+
describe "Star Battle" do
|
2
|
+
it do
|
3
|
+
expect("star_battle").to have_output <<EOF
|
4
|
+
+-+-+-+-+-+-+-+-+-+-+
|
5
|
+
| * |*|
|
6
|
+
+ +-+ +-+ + +
|
7
|
+
|*| | |*| | |
|
8
|
+
+ + + + +-+-+-+-+-+ +
|
9
|
+
| | | | * |* |
|
10
|
+
+-+ +-+ +-+-+ +-+ +
|
11
|
+
| *| |* | | |
|
12
|
+
+ +-+-+ +-+ + +-+-+-+
|
13
|
+
|*| | | | |*| |
|
14
|
+
+-+ +-+-+ + + + +
|
15
|
+
| * | | | *|
|
16
|
+
+ +-+-+-+-+ +-+ +
|
17
|
+
| | * |* | |
|
18
|
+
+ +-+-+-+ + +-+ +
|
19
|
+
| |* *| | | |
|
20
|
+
+-+ +-+-+-+ + + +
|
21
|
+
| | | | |*| |* |
|
22
|
+
+ +-+-+ + +-+ +-+-+
|
23
|
+
| * *| |
|
24
|
+
+-+-+-+-+-+-+-+-+-+-+
|
25
|
+
EOF
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
describe "Stitches" do
|
2
|
+
it do
|
3
|
+
expect("stitches").to have_output_no_color <<EOF
|
4
|
+
* *-*
|
5
|
+
|
|
6
|
+
* * *-* *-*
|
7
|
+
|
|
8
|
+
* * * *
|
9
|
+
| | |
|
10
|
+
* * * * * *
|
11
|
+
| | |
|
12
|
+
* * * *-* * *-*
|
13
|
+
|
|
14
|
+
* * * *
|
15
|
+
| | |
|
16
|
+
* * * * * *
|
17
|
+
| | |
|
18
|
+
* * * * * *-* *
|
19
|
+
| | |
|
20
|
+
* * * * *
|
21
|
+
| |
|
22
|
+
* *
|
23
|
+
EOF
|
24
|
+
end
|
25
|
+
end
|
File without changes
|
@@ -0,0 +1,23 @@
|
|
1
|
+
describe "Suguru" do
|
2
|
+
it do
|
3
|
+
expect("suguru").to have_output <<EOF
|
4
|
+
+---+-----+
|
5
|
+
|1 3|1 4 3|
|
6
|
+
| | +---+
|
7
|
+
|2 6|5|6 2|
|
8
|
+
| | | |
|
9
|
+
|5 4|2|4 3|
|
10
|
+
+---+-+ |
|
11
|
+
|1 3 6|5 1|
|
12
|
+
| +-+---+
|
13
|
+
|2 4|1 2 7|
|
14
|
+
+-+ +-+ |
|
15
|
+
|1|5 7|6 4|
|
16
|
+
+-+---+ |
|
17
|
+
|2|3 4|5 3|
|
18
|
+
| | +---+
|
19
|
+
|1|5 1 2 6|
|
20
|
+
+-+-------+
|
21
|
+
EOF
|
22
|
+
end
|
23
|
+
end
|
File without changes
|
@@ -0,0 +1,25 @@
|
|
1
|
+
describe "Yajilin" do
|
2
|
+
it do
|
3
|
+
expect("yajilin").to have_output <<EOF
|
4
|
+
* -* # * -* -* -* # * -*
|
5
|
+
| | | | | |
|
6
|
+
* * -* -* 2↓ # * -* -* *
|
7
|
+
| |
|
8
|
+
* -* # * -* -* -* # * -*
|
9
|
+
| | | |
|
10
|
+
* -* 2↑ * -* -* * 2↑ * #
|
11
|
+
| | | |
|
12
|
+
* * -* 1↓ # * * -* * -*
|
13
|
+
| | | | | |
|
14
|
+
* * * -* -* -* 1→ * # *
|
15
|
+
| | | |
|
16
|
+
* -* * -* -* -* -* * 0→ *
|
17
|
+
| | | |
|
18
|
+
0↑ # * 1← # 1↓ * -* # *
|
19
|
+
| |
|
20
|
+
* -* -* # * -* -* # 2← *
|
21
|
+
| | | |
|
22
|
+
* -* -* -* -* # * -* -* -*
|
23
|
+
EOF
|
24
|
+
end
|
25
|
+
end
|
File without changes
|
data/spec/interface_spec.rb
CHANGED
File without changes
|
data/spec/model_spec.rb
CHANGED
File without changes
|
data/spec/optimize_spec.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
# Optimize and Model specs are codependent, so half of functionality of each is tested in other class's tests
|
2
|
+
|
3
|
+
# Disabled as it crashes on Z3 4.8.13
|
2
4
|
module Z3
|
3
|
-
|
5
|
+
xdescribe Optimize do
|
4
6
|
let(:optimize) { Optimize.new }
|
5
7
|
let(:a) { Z3.Int("a") }
|
6
8
|
let(:b) { Z3.Int("b") }
|
data/spec/printer_spec.rb
CHANGED
File without changes
|
data/spec/probe_spec.rb
CHANGED
File without changes
|
data/spec/real_expr_spec.rb
CHANGED
File without changes
|