z3 0.0.20181229 → 0.0.20220320

Sign up to get free protection for your applications and to get access to all the features.
Files changed (210) hide show
  1. checksums.yaml +4 -4
  2. data/.rspec +0 -0
  3. data/README.md +0 -2
  4. data/Rakefile +8 -1
  5. data/examples/abc_path +187 -0
  6. data/examples/abc_path-1.txt +7 -0
  7. data/examples/algebra_problems +12 -12
  8. data/examples/aquarium +133 -0
  9. data/examples/aquarium-1.txt +11 -0
  10. data/examples/bridges +2 -2
  11. data/examples/bridges-1.txt +0 -0
  12. data/examples/cats_organized_neatly +133 -0
  13. data/examples/cats_organized_neatly-10.txt +15 -0
  14. data/examples/cats_organized_neatly-3.txt +8 -0
  15. data/examples/cats_organized_neatly-48.txt +32 -0
  16. data/examples/circuit_problems +4 -4
  17. data/examples/clogic_puzzle +2 -2
  18. data/examples/color_nonogram +150 -0
  19. data/examples/color_nonogram-1.txt +23 -0
  20. data/examples/crossflip +2 -4
  21. data/examples/dominion +153 -0
  22. data/examples/dominion-1.txt +8 -0
  23. data/examples/dominosa +133 -0
  24. data/examples/dominosa-1.txt +8 -0
  25. data/examples/eulero +99 -0
  26. data/examples/eulero-1.txt +5 -0
  27. data/examples/four_hackers_puzzle +2 -2
  28. data/examples/futoshiki +128 -0
  29. data/examples/futoshiki-1.txt +17 -0
  30. data/examples/kakurasu +73 -0
  31. data/examples/kakurasu-1.txt +2 -0
  32. data/examples/kakuro +2 -2
  33. data/examples/kakuro-1.txt +0 -0
  34. data/examples/killer_sudoku +88 -0
  35. data/examples/killer_sudoku-1.txt +17 -0
  36. data/examples/killer_sudoku-2.txt +53 -0
  37. data/examples/kinematics_problems +20 -20
  38. data/examples/knights_puzzle +2 -2
  39. data/examples/kropki +100 -0
  40. data/examples/kropki-1.txt +13 -0
  41. data/examples/letter_connections +2 -2
  42. data/examples/letter_connections-1.txt +0 -0
  43. data/examples/light_up +2 -2
  44. data/examples/light_up-1.txt +0 -0
  45. data/examples/minisudoku +2 -2
  46. data/examples/minisudoku-1.txt +0 -0
  47. data/examples/miracle_sudoku +135 -0
  48. data/examples/miracle_sudoku-1.txt +9 -0
  49. data/examples/mortal_coil_puzzle +2 -2
  50. data/examples/mortal_coil_puzzle-9.txt +0 -0
  51. data/examples/nanro +245 -0
  52. data/examples/nanro-1.txt +8 -0
  53. data/examples/nine_clocks +106 -0
  54. data/examples/nonogram +2 -2
  55. data/examples/pyramid_nonogram +2 -2
  56. data/examples/regexp_crossword/beginner-1.txt +0 -0
  57. data/examples/regexp_crossword/beginner-2.txt +0 -0
  58. data/examples/regexp_crossword/beginner-3.txt +0 -0
  59. data/examples/regexp_crossword/beginner-4.txt +0 -0
  60. data/examples/regexp_crossword/beginner-5.txt +0 -0
  61. data/examples/regexp_crossword/experienced-1.txt +0 -0
  62. data/examples/regexp_crossword/experienced-2.txt +0 -0
  63. data/examples/regexp_crossword/experienced-3.txt +0 -0
  64. data/examples/regexp_crossword/experienced-4.txt +0 -0
  65. data/examples/regexp_crossword/experienced-5.txt +0 -0
  66. data/examples/regexp_crossword/tutorial-1.txt +0 -0
  67. data/examples/regexp_crossword/tutorial-2.txt +0 -0
  68. data/examples/regexp_crossword/tutorial-3.txt +0 -0
  69. data/examples/regexp_crossword/tutorial-4.txt +0 -0
  70. data/examples/regexp_crossword/tutorial-5.txt +0 -0
  71. data/examples/regexp_crossword/tutorial-6.txt +0 -0
  72. data/examples/regexp_crossword/tutorial-7.txt +0 -0
  73. data/examples/regexp_crossword/tutorial-8.txt +0 -0
  74. data/examples/regexp_crossword/tutorial-9.txt +0 -0
  75. data/examples/regexp_crossword_solver +2 -2
  76. data/examples/regexp_solver +2 -2
  77. data/examples/regexp_string_matcher.rb +0 -0
  78. data/examples/renzoku +124 -0
  79. data/examples/renzoku-1.txt +17 -0
  80. data/examples/sandwich_sudoku +101 -0
  81. data/examples/sandwich_sudoku-1.txt +10 -0
  82. data/examples/selfref +2 -2
  83. data/examples/simple_regexp_parser.rb +0 -0
  84. data/examples/skyscrapers +118 -0
  85. data/examples/skyscrapers-1.txt +6 -0
  86. data/examples/skyscrapers-2.txt +11 -0
  87. data/examples/star_battle +134 -0
  88. data/examples/star_battle-1.txt +10 -0
  89. data/examples/stitches +180 -0
  90. data/examples/stitches-1.txt +11 -0
  91. data/examples/sudoku +2 -2
  92. data/examples/sudoku-1.txt +0 -0
  93. data/examples/suguru +199 -0
  94. data/examples/suguru-1.txt +17 -0
  95. data/examples/verbal_arithmetic +2 -2
  96. data/examples/yajilin +268 -0
  97. data/examples/yajilin-1.txt +10 -0
  98. data/lib/z3/ast.rb +0 -0
  99. data/lib/z3/context.rb +0 -0
  100. data/lib/z3/exception.rb +0 -0
  101. data/lib/z3/expr/arith_expr.rb +0 -0
  102. data/lib/z3/expr/array_expr.rb +0 -0
  103. data/lib/z3/expr/bitvec_expr.rb +47 -2
  104. data/lib/z3/expr/bool_expr.rb +0 -0
  105. data/lib/z3/expr/expr.rb +3 -3
  106. data/lib/z3/expr/float_expr.rb +0 -0
  107. data/lib/z3/expr/int_expr.rb +0 -0
  108. data/lib/z3/expr/real_expr.rb +0 -0
  109. data/lib/z3/expr/rounding_mode_expr.rb +0 -0
  110. data/lib/z3/expr/set_expr.rb +0 -0
  111. data/lib/z3/func_decl.rb +0 -0
  112. data/lib/z3/goal.rb +0 -0
  113. data/lib/z3/hacks.rb +0 -0
  114. data/lib/z3/interface.rb +0 -0
  115. data/lib/z3/low_level.rb +0 -0
  116. data/lib/z3/low_level_auto.rb +138 -10
  117. data/lib/z3/model.rb +0 -0
  118. data/lib/z3/optimize.rb +0 -0
  119. data/lib/z3/printer.rb +0 -0
  120. data/lib/z3/probe.rb +0 -0
  121. data/lib/z3/solver.rb +0 -0
  122. data/lib/z3/sort/array_sort.rb +0 -0
  123. data/lib/z3/sort/bitvec_sort.rb +0 -0
  124. data/lib/z3/sort/bool_sort.rb +0 -0
  125. data/lib/z3/sort/float_sort.rb +0 -0
  126. data/lib/z3/sort/int_sort.rb +0 -0
  127. data/lib/z3/sort/real_sort.rb +0 -0
  128. data/lib/z3/sort/rounding_mode_sort.rb +0 -0
  129. data/lib/z3/sort/set_sort.rb +0 -0
  130. data/lib/z3/sort/sort.rb +0 -0
  131. data/lib/z3/tactic.rb +0 -0
  132. data/lib/z3/very_low_level.rb +5 -1
  133. data/lib/z3/very_low_level_auto.rb +35 -3
  134. data/lib/z3.rb +0 -0
  135. data/spec/array_expr_spec.rb +0 -0
  136. data/spec/array_sort_spec.rb +0 -0
  137. data/spec/bitvec_expr_spec.rb +13 -0
  138. data/spec/bitvec_sort_spec.rb +0 -0
  139. data/spec/bool_expr_spec.rb +0 -0
  140. data/spec/bool_sort_spec.rb +0 -0
  141. data/spec/coverage_helper.rb +0 -0
  142. data/spec/expr_spec.rb +0 -0
  143. data/spec/float_expr_spec.rb +0 -0
  144. data/spec/float_sort_spec.rb +0 -0
  145. data/spec/goal_spec.rb +0 -0
  146. data/spec/int_expr_spec.rb +0 -0
  147. data/spec/int_sort_spec.rb +0 -0
  148. data/spec/integration/abc_path_spec.rb +21 -0
  149. data/spec/integration/algebra_problems_spec.rb +0 -0
  150. data/spec/integration/aquarium_spec.rb +27 -0
  151. data/spec/integration/basic_int_math_spec.rb +0 -0
  152. data/spec/integration/basic_logic_spec.rb +0 -0
  153. data/spec/integration/bit_tricks_spec.rb +0 -0
  154. data/spec/integration/bridges_spec.rb +0 -0
  155. data/spec/integration/cats_organized_neatly_spec.rb +14 -0
  156. data/spec/integration/cicruit_problem_spec.rb +0 -0
  157. data/spec/integration/color_nonogram_spec.rb +28 -0
  158. data/spec/integration/crossflip_spec.rb +0 -0
  159. data/spec/integration/dominion_spec.rb +14 -0
  160. data/spec/integration/dominosa_spec.rb +21 -0
  161. data/spec/integration/eulero_spec.rb +11 -0
  162. data/spec/integration/four_hackers_puzzle_spec.rb +0 -0
  163. data/spec/integration/futoshiki_spec.rb +23 -0
  164. data/spec/integration/geometry_problem_spec.rb +0 -0
  165. data/spec/integration/kakurasu_spec.rb +18 -0
  166. data/spec/integration/kakuro_spec.rb +0 -0
  167. data/spec/integration/killer_sudoku_spec.rb +10 -0
  168. data/spec/integration/kinematics_problems_spec.rb +0 -0
  169. data/spec/integration/knights_puzzle_spec.rb +11 -11
  170. data/spec/integration/kropki_spec.rb +19 -0
  171. data/spec/integration/letter_connections_spec.rb +0 -0
  172. data/spec/integration/light_up_spec.rb +0 -0
  173. data/spec/integration/minisudoku_spec.rb +0 -0
  174. data/spec/integration/miracle_sudoku_spec.rb +15 -0
  175. data/spec/integration/mortal_coil_puzzle_spec.rb +8 -6
  176. data/spec/integration/nanro_spec.rb +39 -0
  177. data/spec/integration/nine_clocks_spec.rb +30 -0
  178. data/spec/integration/nonogram_spec.rb +0 -0
  179. data/spec/integration/oneofus_spec.rb +0 -0
  180. data/spec/integration/pyramid_nonogram_spec.rb +0 -0
  181. data/spec/integration/regexp_crossword_solver_spec.rb +1 -1
  182. data/spec/integration/regexp_solver_spec.rb +0 -0
  183. data/spec/integration/renzoku_spec.rb +23 -0
  184. data/spec/integration/sandwich_sudoku_spec.rb +15 -0
  185. data/spec/integration/selfref_spec.rb +0 -0
  186. data/spec/integration/skyscraper_spec.rb +10 -0
  187. data/spec/integration/star_battle_spec.rb +27 -0
  188. data/spec/integration/stitches_spec.rb +25 -0
  189. data/spec/integration/sudoku_spec.rb +0 -0
  190. data/spec/integration/suguru_spec.rb +23 -0
  191. data/spec/integration/verbal_arithmetic_spec.rb +0 -0
  192. data/spec/integration/yajilin_spec.rb +25 -0
  193. data/spec/integration/zebra_puzzle_spec.rb +0 -0
  194. data/spec/interface_spec.rb +0 -0
  195. data/spec/model_spec.rb +0 -0
  196. data/spec/optimize_spec.rb +3 -1
  197. data/spec/printer_spec.rb +0 -0
  198. data/spec/probe_spec.rb +0 -0
  199. data/spec/real_expr_spec.rb +0 -0
  200. data/spec/real_sort_spec.rb +0 -0
  201. data/spec/rounding_mode_expr_spec.rb +0 -0
  202. data/spec/rounding_mode_sort_spec.rb +0 -0
  203. data/spec/set_expr_spec.rb +15 -9
  204. data/spec/set_sort_spec.rb +0 -0
  205. data/spec/solver_spec.rb +1 -2
  206. data/spec/sort_spec.rb +0 -0
  207. data/spec/spec_helper.rb +15 -0
  208. data/spec/tactic_spec.rb +0 -0
  209. data/spec/z3_spec.rb +0 -0
  210. metadata +85 -5
@@ -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
File without changes
File without changes
File without changes
File without changes
data/spec/expr_spec.rb CHANGED
File without changes
File without changes
File without changes
data/spec/goal_spec.rb CHANGED
File without changes
File without changes
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
@@ -0,0 +1,14 @@
1
+ describe "Cats Organized Neatly" do
2
+ it do
3
+ expect("cats_organized_neatly").to have_output <<EOF
4
+ .ffffbbb
5
+ .fdddbbb
6
+ aadddbbb
7
+ aadddbbe
8
+ aagggcee
9
+ aagggcce
10
+ aagggcc.
11
+ ..gggcc.
12
+ EOF
13
+ end
14
+ end
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,14 @@
1
+ describe "Dominion" do
2
+ it do
3
+ expect("dominion").to have_output <<EOF
4
+ **AAAA*B
5
+ FF*AAA*B
6
+ FF*A**BB
7
+ F*E*GG**
8
+ F*E*G*DD
9
+ *G*GG*DD
10
+ *G*G*C**
11
+ GGGG*CCC
12
+ EOF
13
+ end
14
+ end
@@ -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
@@ -0,0 +1,11 @@
1
+ describe "Eulero" do
2
+ it do
3
+ expect("eulero").to have_output <<EOF
4
+ C2 B4 D5 A1 E3
5
+ D1 A2 B3 E5 C4
6
+ E4 D3 C1 B2 A5
7
+ B5 E1 A4 C3 D2
8
+ A3 C5 E2 D4 B1
9
+ EOF
10
+ end
11
+ 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
@@ -0,0 +1,10 @@
1
+ describe "Killer Sudoku" do
2
+ it do
3
+ expect("killer_sudoku").to have_output <<EOF
4
+ 4 2 3 1
5
+ 3 1 2 4
6
+ 2 4 1 3
7
+ 1 3 4 2
8
+ EOF
9
+ end
10
+ end
File without changes
@@ -1,5 +1,5 @@
1
1
  # There are multiple solutions, so this test is nondeterministic
2
- # Changing it to one returned by z3 4.7.1, but perhaps it needs some serious fixing
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
- b: 0,0 -> 1,2
12
+ w: 2,2 -> 3,0
13
13
 
14
14
  State 1:
15
- .bb.
15
+ bbbw
16
16
  xbxw
17
- .bww
17
+ ...w
18
18
  x.xw
19
- w: 2,2 -> 3,0
19
+ b: 1,0 -> 2,2
20
20
 
21
21
  State 2:
22
- .bbw
22
+ b.bw
23
23
  xbxw
24
- .b.w
24
+ ..bw
25
25
  x.xw
26
- b: 1,0 -> 2,2
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
- w: 3,1 -> 1,0
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
- 22 21 20 ### 14 13
5
- 23 ### 19 ### 15 12
6
- 24 1 18 17 16 11
7
- 25 2 3 4 ### 10
8
- 26 ### 30 5 ### 9
9
- 27 28 29 6 7 8
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,10 @@
1
+ describe "Skysrapers" do
2
+ it do
3
+ expect("skyscrapers").to have_output <<EOF
4
+ 2 4 1 3
5
+ 4 2 3 1
6
+ 3 1 4 2
7
+ 1 3 2 4
8
+ EOF
9
+ end
10
+ end
@@ -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
File without changes
data/spec/model_spec.rb CHANGED
File without changes
@@ -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
- describe Optimize do
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
File without changes