z3 0.0.20180629 → 0.0.20220203
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -4
- data/Rakefile +15 -8
- 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/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/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/light_up +2 -2
- data/examples/minisudoku +2 -2
- data/examples/miracle_sudoku +135 -0
- data/examples/miracle_sudoku-1.txt +9 -0
- data/examples/mortal_coil_puzzle +2 -2
- 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_solver +2 -2
- data/examples/regexp_solver +2 -2
- 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 +58 -56
- 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/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 +8 -0
- data/lib/z3/expr/expr.rb +16 -15
- data/lib/z3/low_level.rb +6 -2
- data/lib/z3/low_level_auto.rb +180 -36
- data/lib/z3/optimize.rb +4 -4
- data/lib/z3/very_low_level.rb +8 -5
- data/lib/z3/very_low_level_auto.rb +45 -9
- data/spec/expr_spec.rb +62 -0
- data/spec/integration/abc_path_spec.rb +21 -0
- data/spec/integration/aquarium_spec.rb +27 -0
- data/spec/integration/cats_organized_neatly_spec.rb +14 -0
- data/spec/integration/color_nonogram_spec.rb +28 -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/futoshiki_spec.rb +23 -0
- data/spec/integration/kakurasu_spec.rb +18 -0
- data/spec/integration/killer_sudoku_spec.rb +10 -0
- data/spec/integration/knights_puzzle_spec.rb +11 -11
- data/spec/integration/kropki_spec.rb +19 -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/oneofus_spec.rb +7 -15
- data/spec/integration/regexp_crossword_solver_spec.rb +1 -1
- data/spec/integration/renzoku_spec.rb +23 -0
- data/spec/integration/sandwich_sudoku_spec.rb +15 -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/suguru_spec.rb +23 -0
- data/spec/integration/yajilin_spec.rb +25 -0
- data/spec/optimize_spec.rb +6 -4
- data/spec/set_expr_spec.rb +14 -8
- data/spec/solver_spec.rb +4 -5
- data/spec/spec_helper.rb +15 -0
- metadata +105 -25
@@ -6,6 +6,8 @@ module Z3
|
|
6
6
|
attach_function :Z3_algebraic_div, [:ctx_pointer, :ast_pointer, :ast_pointer], :ast_pointer
|
7
7
|
attach_function :Z3_algebraic_eq, [:ctx_pointer, :ast_pointer, :ast_pointer], :bool
|
8
8
|
attach_function :Z3_algebraic_ge, [:ctx_pointer, :ast_pointer, :ast_pointer], :bool
|
9
|
+
attach_function :Z3_algebraic_get_i, [:ctx_pointer, :ast_pointer], :uint
|
10
|
+
attach_function :Z3_algebraic_get_poly, [:ctx_pointer, :ast_pointer], :ast_vector_pointer
|
9
11
|
attach_function :Z3_algebraic_gt, [:ctx_pointer, :ast_pointer, :ast_pointer], :bool
|
10
12
|
attach_function :Z3_algebraic_is_neg, [:ctx_pointer, :ast_pointer], :bool
|
11
13
|
attach_function :Z3_algebraic_is_pos, [:ctx_pointer, :ast_pointer], :bool
|
@@ -19,7 +21,6 @@ module Z3
|
|
19
21
|
attach_function :Z3_algebraic_root, [:ctx_pointer, :ast_pointer, :uint], :ast_pointer
|
20
22
|
attach_function :Z3_algebraic_sign, [:ctx_pointer, :ast_pointer], :int
|
21
23
|
attach_function :Z3_algebraic_sub, [:ctx_pointer, :ast_pointer, :ast_pointer], :ast_pointer
|
22
|
-
attach_function :Z3_apply_result_convert_model, [:ctx_pointer, :apply_result_pointer, :uint, :model_pointer], :model_pointer
|
23
24
|
attach_function :Z3_apply_result_dec_ref, [:ctx_pointer, :apply_result_pointer], :void
|
24
25
|
attach_function :Z3_apply_result_get_num_subgoals, [:ctx_pointer, :apply_result_pointer], :uint
|
25
26
|
attach_function :Z3_apply_result_get_subgoal, [:ctx_pointer, :apply_result_pointer, :uint], :goal_pointer
|
@@ -53,6 +54,7 @@ module Z3
|
|
53
54
|
attach_function :Z3_del_context, [:ctx_pointer], :void
|
54
55
|
attach_function :Z3_disable_trace, [:string], :void
|
55
56
|
attach_function :Z3_enable_trace, [:string], :void
|
57
|
+
attach_function :Z3_eval_smtlib2_string, [:ctx_pointer, :string], :string
|
56
58
|
attach_function :Z3_finalize_memory, [], :void
|
57
59
|
attach_function :Z3_fixedpoint_add_cover, [:ctx_pointer, :fixedpoint_pointer, :int, :func_decl_pointer, :ast_pointer], :void
|
58
60
|
attach_function :Z3_fixedpoint_add_invariant, [:ctx_pointer, :fixedpoint_pointer, :func_decl_pointer, :ast_pointer], :void
|
@@ -75,8 +77,6 @@ module Z3
|
|
75
77
|
attach_function :Z3_fixedpoint_get_rules_along_trace, [:ctx_pointer, :fixedpoint_pointer], :ast_vector_pointer
|
76
78
|
attach_function :Z3_fixedpoint_get_statistics, [:ctx_pointer, :fixedpoint_pointer], :stats_pointer
|
77
79
|
attach_function :Z3_fixedpoint_inc_ref, [:ctx_pointer, :fixedpoint_pointer], :void
|
78
|
-
attach_function :Z3_fixedpoint_pop, [:ctx_pointer, :fixedpoint_pointer], :void
|
79
|
-
attach_function :Z3_fixedpoint_push, [:ctx_pointer, :fixedpoint_pointer], :void
|
80
80
|
attach_function :Z3_fixedpoint_query, [:ctx_pointer, :fixedpoint_pointer, :ast_pointer], :int
|
81
81
|
attach_function :Z3_fixedpoint_query_from_lvl, [:ctx_pointer, :fixedpoint_pointer, :ast_pointer, :uint], :int
|
82
82
|
attach_function :Z3_fixedpoint_register_relation, [:ctx_pointer, :fixedpoint_pointer, :func_decl_pointer], :void
|
@@ -145,13 +145,13 @@ module Z3
|
|
145
145
|
attach_function :Z3_get_full_version, [], :string
|
146
146
|
attach_function :Z3_get_func_decl_id, [:ctx_pointer, :func_decl_pointer], :uint
|
147
147
|
attach_function :Z3_get_index_value, [:ctx_pointer, :ast_pointer], :uint
|
148
|
-
attach_function :Z3_get_interpolant, [:ctx_pointer, :ast_pointer, :ast_pointer, :params_pointer], :ast_vector_pointer
|
149
148
|
attach_function :Z3_get_num_probes, [:ctx_pointer], :uint
|
150
149
|
attach_function :Z3_get_num_tactics, [:ctx_pointer], :uint
|
150
|
+
attach_function :Z3_get_numeral_binary_string, [:ctx_pointer, :ast_pointer], :string
|
151
151
|
attach_function :Z3_get_numeral_decimal_string, [:ctx_pointer, :ast_pointer, :uint], :string
|
152
|
+
attach_function :Z3_get_numeral_double, [:ctx_pointer, :ast_pointer], :double
|
152
153
|
attach_function :Z3_get_numeral_string, [:ctx_pointer, :ast_pointer], :string
|
153
154
|
attach_function :Z3_get_numerator, [:ctx_pointer, :ast_pointer], :ast_pointer
|
154
|
-
attach_function :Z3_get_parser_error, [:ctx_pointer], :string
|
155
155
|
attach_function :Z3_get_pattern, [:ctx_pointer, :pattern_pointer, :uint], :ast_pointer
|
156
156
|
attach_function :Z3_get_pattern_num_terms, [:ctx_pointer, :pattern_pointer], :uint
|
157
157
|
attach_function :Z3_get_probe_name, [:ctx_pointer, :uint], :string
|
@@ -165,12 +165,15 @@ module Z3
|
|
165
165
|
attach_function :Z3_get_quantifier_pattern_ast, [:ctx_pointer, :ast_pointer, :uint], :pattern_pointer
|
166
166
|
attach_function :Z3_get_quantifier_weight, [:ctx_pointer, :ast_pointer], :uint
|
167
167
|
attach_function :Z3_get_range, [:ctx_pointer, :func_decl_pointer], :sort_pointer
|
168
|
+
attach_function :Z3_get_re_sort_basis, [:ctx_pointer, :sort_pointer], :sort_pointer
|
168
169
|
attach_function :Z3_get_relation_arity, [:ctx_pointer, :sort_pointer], :uint
|
169
170
|
attach_function :Z3_get_relation_column, [:ctx_pointer, :sort_pointer, :uint], :sort_pointer
|
171
|
+
attach_function :Z3_get_seq_sort_basis, [:ctx_pointer, :sort_pointer], :sort_pointer
|
170
172
|
attach_function :Z3_get_sort, [:ctx_pointer, :ast_pointer], :sort_pointer
|
171
173
|
attach_function :Z3_get_sort_id, [:ctx_pointer, :sort_pointer], :uint
|
172
174
|
attach_function :Z3_get_sort_kind, [:ctx_pointer, :sort_pointer], :uint
|
173
175
|
attach_function :Z3_get_sort_name, [:ctx_pointer, :sort_pointer], :symbol_pointer
|
176
|
+
attach_function :Z3_get_string_length, [:ctx_pointer, :ast_pointer], :uint
|
174
177
|
attach_function :Z3_get_symbol_int, [:ctx_pointer, :symbol_pointer], :int
|
175
178
|
attach_function :Z3_get_symbol_kind, [:ctx_pointer, :symbol_pointer], :uint
|
176
179
|
attach_function :Z3_get_symbol_string, [:ctx_pointer, :symbol_pointer], :string
|
@@ -181,6 +184,7 @@ module Z3
|
|
181
184
|
attach_function :Z3_global_param_reset_all, [], :void
|
182
185
|
attach_function :Z3_global_param_set, [:string, :string], :void
|
183
186
|
attach_function :Z3_goal_assert, [:ctx_pointer, :goal_pointer, :ast_pointer], :void
|
187
|
+
attach_function :Z3_goal_convert_model, [:ctx_pointer, :goal_pointer, :model_pointer], :model_pointer
|
184
188
|
attach_function :Z3_goal_dec_ref, [:ctx_pointer, :goal_pointer], :void
|
185
189
|
attach_function :Z3_goal_depth, [:ctx_pointer, :goal_pointer], :uint
|
186
190
|
attach_function :Z3_goal_formula, [:ctx_pointer, :goal_pointer, :uint], :ast_pointer
|
@@ -192,18 +196,21 @@ module Z3
|
|
192
196
|
attach_function :Z3_goal_precision, [:ctx_pointer, :goal_pointer], :uint
|
193
197
|
attach_function :Z3_goal_reset, [:ctx_pointer, :goal_pointer], :void
|
194
198
|
attach_function :Z3_goal_size, [:ctx_pointer, :goal_pointer], :uint
|
199
|
+
attach_function :Z3_goal_to_dimacs_string, [:ctx_pointer, :goal_pointer, :bool], :string
|
195
200
|
attach_function :Z3_goal_to_string, [:ctx_pointer, :goal_pointer], :string
|
196
201
|
attach_function :Z3_goal_translate, [:ctx_pointer, :goal_pointer, :ctx_pointer], :goal_pointer
|
197
202
|
attach_function :Z3_inc_ref, [:ctx_pointer, :ast_pointer], :void
|
198
|
-
attach_function :Z3_interpolation_profile, [:ctx_pointer], :string
|
199
203
|
attach_function :Z3_interrupt, [:ctx_pointer], :void
|
200
204
|
attach_function :Z3_is_algebraic_number, [:ctx_pointer, :ast_pointer], :bool
|
201
205
|
attach_function :Z3_is_app, [:ctx_pointer, :ast_pointer], :bool
|
202
206
|
attach_function :Z3_is_as_array, [:ctx_pointer, :ast_pointer], :bool
|
207
|
+
attach_function :Z3_is_char_sort, [:ctx_pointer, :sort_pointer], :bool
|
203
208
|
attach_function :Z3_is_eq_ast, [:ctx_pointer, :ast_pointer, :ast_pointer], :bool
|
204
209
|
attach_function :Z3_is_eq_func_decl, [:ctx_pointer, :func_decl_pointer, :func_decl_pointer], :bool
|
205
210
|
attach_function :Z3_is_eq_sort, [:ctx_pointer, :sort_pointer, :sort_pointer], :bool
|
211
|
+
attach_function :Z3_is_lambda, [:ctx_pointer, :ast_pointer], :bool
|
206
212
|
attach_function :Z3_is_numeral_ast, [:ctx_pointer, :ast_pointer], :bool
|
213
|
+
attach_function :Z3_is_quantifier_exists, [:ctx_pointer, :ast_pointer], :bool
|
207
214
|
attach_function :Z3_is_quantifier_forall, [:ctx_pointer, :ast_pointer], :bool
|
208
215
|
attach_function :Z3_is_well_sorted, [:ctx_pointer, :ast_pointer], :bool
|
209
216
|
attach_function :Z3_mk_array_default, [:ctx_pointer, :ast_pointer], :ast_pointer
|
@@ -252,12 +259,19 @@ module Z3
|
|
252
259
|
attach_function :Z3_mk_bvurem, [:ctx_pointer, :ast_pointer, :ast_pointer], :ast_pointer
|
253
260
|
attach_function :Z3_mk_bvxnor, [:ctx_pointer, :ast_pointer, :ast_pointer], :ast_pointer
|
254
261
|
attach_function :Z3_mk_bvxor, [:ctx_pointer, :ast_pointer, :ast_pointer], :ast_pointer
|
262
|
+
attach_function :Z3_mk_char_from_bv, [:ctx_pointer, :ast_pointer], :ast_pointer
|
263
|
+
attach_function :Z3_mk_char_is_digit, [:ctx_pointer, :ast_pointer], :ast_pointer
|
264
|
+
attach_function :Z3_mk_char_le, [:ctx_pointer, :ast_pointer, :ast_pointer], :ast_pointer
|
265
|
+
attach_function :Z3_mk_char_sort, [:ctx_pointer], :sort_pointer
|
266
|
+
attach_function :Z3_mk_char_to_bv, [:ctx_pointer, :ast_pointer], :ast_pointer
|
267
|
+
attach_function :Z3_mk_char_to_int, [:ctx_pointer, :ast_pointer], :ast_pointer
|
255
268
|
attach_function :Z3_mk_concat, [:ctx_pointer, :ast_pointer, :ast_pointer], :ast_pointer
|
256
269
|
attach_function :Z3_mk_config, [], :config_pointer
|
257
270
|
attach_function :Z3_mk_const, [:ctx_pointer, :symbol_pointer, :sort_pointer], :ast_pointer
|
258
271
|
attach_function :Z3_mk_const_array, [:ctx_pointer, :sort_pointer, :ast_pointer], :ast_pointer
|
259
272
|
attach_function :Z3_mk_context_rc, [:config_pointer], :ctx_pointer
|
260
273
|
attach_function :Z3_mk_div, [:ctx_pointer, :ast_pointer, :ast_pointer], :ast_pointer
|
274
|
+
attach_function :Z3_mk_divides, [:ctx_pointer, :ast_pointer, :ast_pointer], :ast_pointer
|
261
275
|
attach_function :Z3_mk_empty_set, [:ctx_pointer, :sort_pointer], :ast_pointer
|
262
276
|
attach_function :Z3_mk_eq, [:ctx_pointer, :ast_pointer, :ast_pointer], :ast_pointer
|
263
277
|
attach_function :Z3_mk_ext_rotate_left, [:ctx_pointer, :ast_pointer, :ast_pointer], :ast_pointer
|
@@ -337,11 +351,11 @@ module Z3
|
|
337
351
|
attach_function :Z3_mk_int_sort, [:ctx_pointer], :sort_pointer
|
338
352
|
attach_function :Z3_mk_int_symbol, [:ctx_pointer, :int], :symbol_pointer
|
339
353
|
attach_function :Z3_mk_int_to_str, [:ctx_pointer, :ast_pointer], :ast_pointer
|
340
|
-
attach_function :Z3_mk_interpolant, [:ctx_pointer, :ast_pointer], :ast_pointer
|
341
|
-
attach_function :Z3_mk_interpolation_context, [:config_pointer], :ctx_pointer
|
342
354
|
attach_function :Z3_mk_is_int, [:ctx_pointer, :ast_pointer], :ast_pointer
|
343
355
|
attach_function :Z3_mk_ite, [:ctx_pointer, :ast_pointer, :ast_pointer, :ast_pointer], :ast_pointer
|
344
356
|
attach_function :Z3_mk_le, [:ctx_pointer, :ast_pointer, :ast_pointer], :ast_pointer
|
357
|
+
attach_function :Z3_mk_linear_order, [:ctx_pointer, :sort_pointer, :uint], :func_decl_pointer
|
358
|
+
attach_function :Z3_mk_lstring, [:ctx_pointer, :uint, :string], :ast_pointer
|
345
359
|
attach_function :Z3_mk_lt, [:ctx_pointer, :ast_pointer, :ast_pointer], :ast_pointer
|
346
360
|
attach_function :Z3_mk_mod, [:ctx_pointer, :ast_pointer, :ast_pointer], :ast_pointer
|
347
361
|
attach_function :Z3_mk_model, [:ctx_pointer], :model_pointer
|
@@ -349,8 +363,11 @@ module Z3
|
|
349
363
|
attach_function :Z3_mk_numeral, [:ctx_pointer, :string, :sort_pointer], :ast_pointer
|
350
364
|
attach_function :Z3_mk_optimize, [:ctx_pointer], :optimize_pointer
|
351
365
|
attach_function :Z3_mk_params, [:ctx_pointer], :params_pointer
|
366
|
+
attach_function :Z3_mk_partial_order, [:ctx_pointer, :sort_pointer, :uint], :func_decl_pointer
|
367
|
+
attach_function :Z3_mk_piecewise_linear_order, [:ctx_pointer, :sort_pointer, :uint], :func_decl_pointer
|
352
368
|
attach_function :Z3_mk_power, [:ctx_pointer, :ast_pointer, :ast_pointer], :ast_pointer
|
353
369
|
attach_function :Z3_mk_probe, [:ctx_pointer, :string], :probe_pointer
|
370
|
+
attach_function :Z3_mk_re_allchar, [:ctx_pointer, :sort_pointer], :ast_pointer
|
354
371
|
attach_function :Z3_mk_re_complement, [:ctx_pointer, :ast_pointer], :ast_pointer
|
355
372
|
attach_function :Z3_mk_re_empty, [:ctx_pointer, :sort_pointer], :ast_pointer
|
356
373
|
attach_function :Z3_mk_re_full, [:ctx_pointer, :sort_pointer], :ast_pointer
|
@@ -363,11 +380,15 @@ module Z3
|
|
363
380
|
attach_function :Z3_mk_repeat, [:ctx_pointer, :uint, :ast_pointer], :ast_pointer
|
364
381
|
attach_function :Z3_mk_rotate_left, [:ctx_pointer, :uint, :ast_pointer], :ast_pointer
|
365
382
|
attach_function :Z3_mk_rotate_right, [:ctx_pointer, :uint, :ast_pointer], :ast_pointer
|
383
|
+
attach_function :Z3_mk_sbv_to_str, [:ctx_pointer, :ast_pointer], :ast_pointer
|
366
384
|
attach_function :Z3_mk_select, [:ctx_pointer, :ast_pointer, :ast_pointer], :ast_pointer
|
385
|
+
attach_function :Z3_mk_seq_last_index, [:ctx_pointer, :ast_pointer, :ast_pointer], :ast_pointer
|
386
|
+
attach_function :Z3_mk_seq_nth, [:ctx_pointer, :ast_pointer, :ast_pointer], :ast_pointer
|
367
387
|
attach_function :Z3_mk_set_add, [:ctx_pointer, :ast_pointer, :ast_pointer], :ast_pointer
|
368
388
|
attach_function :Z3_mk_set_complement, [:ctx_pointer, :ast_pointer], :ast_pointer
|
369
389
|
attach_function :Z3_mk_set_del, [:ctx_pointer, :ast_pointer, :ast_pointer], :ast_pointer
|
370
390
|
attach_function :Z3_mk_set_difference, [:ctx_pointer, :ast_pointer, :ast_pointer], :ast_pointer
|
391
|
+
attach_function :Z3_mk_set_has_size, [:ctx_pointer, :ast_pointer, :ast_pointer], :ast_pointer
|
371
392
|
attach_function :Z3_mk_set_member, [:ctx_pointer, :ast_pointer, :ast_pointer], :ast_pointer
|
372
393
|
attach_function :Z3_mk_set_sort, [:ctx_pointer, :sort_pointer], :sort_pointer
|
373
394
|
attach_function :Z3_mk_set_subset, [:ctx_pointer, :ast_pointer, :ast_pointer], :ast_pointer
|
@@ -377,10 +398,15 @@ module Z3
|
|
377
398
|
attach_function :Z3_mk_solver_for_logic, [:ctx_pointer, :symbol_pointer], :solver_pointer
|
378
399
|
attach_function :Z3_mk_solver_from_tactic, [:ctx_pointer, :tactic_pointer], :solver_pointer
|
379
400
|
attach_function :Z3_mk_store, [:ctx_pointer, :ast_pointer, :ast_pointer, :ast_pointer], :ast_pointer
|
401
|
+
attach_function :Z3_mk_str_le, [:ctx_pointer, :ast_pointer, :ast_pointer], :ast_pointer
|
402
|
+
attach_function :Z3_mk_str_lt, [:ctx_pointer, :ast_pointer, :ast_pointer], :ast_pointer
|
380
403
|
attach_function :Z3_mk_str_to_int, [:ctx_pointer, :ast_pointer], :ast_pointer
|
381
404
|
attach_function :Z3_mk_string_symbol, [:ctx_pointer, :string], :symbol_pointer
|
382
405
|
attach_function :Z3_mk_tactic, [:ctx_pointer, :string], :tactic_pointer
|
406
|
+
attach_function :Z3_mk_transitive_closure, [:ctx_pointer, :func_decl_pointer], :func_decl_pointer
|
407
|
+
attach_function :Z3_mk_tree_order, [:ctx_pointer, :sort_pointer, :uint], :func_decl_pointer
|
383
408
|
attach_function :Z3_mk_true, [:ctx_pointer], :ast_pointer
|
409
|
+
attach_function :Z3_mk_ubv_to_str, [:ctx_pointer, :ast_pointer], :ast_pointer
|
384
410
|
attach_function :Z3_mk_unary_minus, [:ctx_pointer, :ast_pointer], :ast_pointer
|
385
411
|
attach_function :Z3_mk_uninterpreted_sort, [:ctx_pointer, :symbol_pointer], :sort_pointer
|
386
412
|
attach_function :Z3_mk_unsigned_int, [:ctx_pointer, :uint, :sort_pointer], :ast_pointer
|
@@ -401,9 +427,10 @@ module Z3
|
|
401
427
|
attach_function :Z3_model_has_interp, [:ctx_pointer, :model_pointer, :func_decl_pointer], :bool
|
402
428
|
attach_function :Z3_model_inc_ref, [:ctx_pointer, :model_pointer], :void
|
403
429
|
attach_function :Z3_model_to_string, [:ctx_pointer, :model_pointer], :string
|
430
|
+
attach_function :Z3_model_translate, [:ctx_pointer, :model_pointer, :ctx_pointer], :model_pointer
|
404
431
|
attach_function :Z3_optimize_assert, [:ctx_pointer, :optimize_pointer, :ast_pointer], :void
|
432
|
+
attach_function :Z3_optimize_assert_and_track, [:ctx_pointer, :optimize_pointer, :ast_pointer, :ast_pointer], :void
|
405
433
|
attach_function :Z3_optimize_assert_soft, [:ctx_pointer, :optimize_pointer, :ast_pointer, :string, :symbol_pointer], :uint
|
406
|
-
attach_function :Z3_optimize_check, [:ctx_pointer, :optimize_pointer], :int
|
407
434
|
attach_function :Z3_optimize_dec_ref, [:ctx_pointer, :optimize_pointer], :void
|
408
435
|
attach_function :Z3_optimize_from_file, [:ctx_pointer, :optimize_pointer, :string], :void
|
409
436
|
attach_function :Z3_optimize_from_string, [:ctx_pointer, :optimize_pointer, :string], :void
|
@@ -416,6 +443,7 @@ module Z3
|
|
416
443
|
attach_function :Z3_optimize_get_param_descrs, [:ctx_pointer, :optimize_pointer], :param_descrs_pointer
|
417
444
|
attach_function :Z3_optimize_get_reason_unknown, [:ctx_pointer, :optimize_pointer], :string
|
418
445
|
attach_function :Z3_optimize_get_statistics, [:ctx_pointer, :optimize_pointer], :stats_pointer
|
446
|
+
attach_function :Z3_optimize_get_unsat_core, [:ctx_pointer, :optimize_pointer], :ast_vector_pointer
|
419
447
|
attach_function :Z3_optimize_get_upper, [:ctx_pointer, :optimize_pointer, :uint], :ast_pointer
|
420
448
|
attach_function :Z3_optimize_get_upper_as_vector, [:ctx_pointer, :optimize_pointer, :uint], :ast_vector_pointer
|
421
449
|
attach_function :Z3_optimize_inc_ref, [:ctx_pointer, :optimize_pointer], :void
|
@@ -485,6 +513,7 @@ module Z3
|
|
485
513
|
attach_function :Z3_solver_assert, [:ctx_pointer, :solver_pointer, :ast_pointer], :void
|
486
514
|
attach_function :Z3_solver_assert_and_track, [:ctx_pointer, :solver_pointer, :ast_pointer, :ast_pointer], :void
|
487
515
|
attach_function :Z3_solver_check, [:ctx_pointer, :solver_pointer], :int
|
516
|
+
attach_function :Z3_solver_cube, [:ctx_pointer, :solver_pointer, :ast_vector_pointer, :uint], :ast_vector_pointer
|
488
517
|
attach_function :Z3_solver_dec_ref, [:ctx_pointer, :solver_pointer], :void
|
489
518
|
attach_function :Z3_solver_from_file, [:ctx_pointer, :solver_pointer, :string], :void
|
490
519
|
attach_function :Z3_solver_from_string, [:ctx_pointer, :solver_pointer, :string], :void
|
@@ -492,17 +521,24 @@ module Z3
|
|
492
521
|
attach_function :Z3_solver_get_consequences, [:ctx_pointer, :solver_pointer, :ast_vector_pointer, :ast_vector_pointer, :ast_vector_pointer], :int
|
493
522
|
attach_function :Z3_solver_get_help, [:ctx_pointer, :solver_pointer], :string
|
494
523
|
attach_function :Z3_solver_get_model, [:ctx_pointer, :solver_pointer], :model_pointer
|
524
|
+
attach_function :Z3_solver_get_non_units, [:ctx_pointer, :solver_pointer], :ast_vector_pointer
|
495
525
|
attach_function :Z3_solver_get_num_scopes, [:ctx_pointer, :solver_pointer], :uint
|
496
526
|
attach_function :Z3_solver_get_param_descrs, [:ctx_pointer, :solver_pointer], :param_descrs_pointer
|
497
527
|
attach_function :Z3_solver_get_proof, [:ctx_pointer, :solver_pointer], :ast_pointer
|
498
528
|
attach_function :Z3_solver_get_reason_unknown, [:ctx_pointer, :solver_pointer], :string
|
499
529
|
attach_function :Z3_solver_get_statistics, [:ctx_pointer, :solver_pointer], :stats_pointer
|
530
|
+
attach_function :Z3_solver_get_trail, [:ctx_pointer, :solver_pointer], :ast_vector_pointer
|
531
|
+
attach_function :Z3_solver_get_units, [:ctx_pointer, :solver_pointer], :ast_vector_pointer
|
500
532
|
attach_function :Z3_solver_get_unsat_core, [:ctx_pointer, :solver_pointer], :ast_vector_pointer
|
533
|
+
attach_function :Z3_solver_import_model_converter, [:ctx_pointer, :solver_pointer, :solver_pointer], :void
|
501
534
|
attach_function :Z3_solver_inc_ref, [:ctx_pointer, :solver_pointer], :void
|
535
|
+
attach_function :Z3_solver_interrupt, [:ctx_pointer, :solver_pointer], :void
|
502
536
|
attach_function :Z3_solver_pop, [:ctx_pointer, :solver_pointer, :uint], :void
|
537
|
+
attach_function :Z3_solver_propagate_register, [:ctx_pointer, :solver_pointer, :ast_pointer], :uint
|
503
538
|
attach_function :Z3_solver_push, [:ctx_pointer, :solver_pointer], :void
|
504
539
|
attach_function :Z3_solver_reset, [:ctx_pointer, :solver_pointer], :void
|
505
540
|
attach_function :Z3_solver_set_params, [:ctx_pointer, :solver_pointer, :params_pointer], :void
|
541
|
+
attach_function :Z3_solver_to_dimacs_string, [:ctx_pointer, :solver_pointer, :bool], :string
|
506
542
|
attach_function :Z3_solver_to_string, [:ctx_pointer, :solver_pointer], :string
|
507
543
|
attach_function :Z3_stats_dec_ref, [:ctx_pointer, :stats_pointer], :void
|
508
544
|
attach_function :Z3_stats_get_double_value, [:ctx_pointer, :stats_pointer, :uint], :double
|
data/spec/expr_spec.rb
CHANGED
@@ -183,4 +183,66 @@ module Z3
|
|
183
183
|
end
|
184
184
|
end
|
185
185
|
end
|
186
|
+
|
187
|
+
describe "#hash / #eql?" do
|
188
|
+
let(:x1) { Z3.Int("x") }
|
189
|
+
let(:x2) { Z3.Int("x") }
|
190
|
+
let(:y1) { Z3.Int("y") }
|
191
|
+
let(:y2) { Z3.Int("y") }
|
192
|
+
let(:e1) { x1 + y1 }
|
193
|
+
let(:e2) { x2 + y2 }
|
194
|
+
let(:f1) { y1 + x1 }
|
195
|
+
let(:f2) { y2 + x2 }
|
196
|
+
let(:samples) { [x1, x2, y1, y2, e1, e2, f1, f2] }
|
197
|
+
|
198
|
+
it "object is eql? to itself" do
|
199
|
+
expect(x1.eql?(x1)).to be true
|
200
|
+
expect(y1.eql?(y1)).to be true
|
201
|
+
expect(e1.eql?(e1)).to be true
|
202
|
+
|
203
|
+
expect(x1.eql?(y1)).to be false
|
204
|
+
expect(x1.eql?(e1)).to be false
|
205
|
+
end
|
206
|
+
|
207
|
+
it "object is eql? to structurally identical object" do
|
208
|
+
expect(x1.eql?(x2)).to be true
|
209
|
+
expect(y1.eql?(y2)).to be true
|
210
|
+
expect(e1.eql?(e2)).to be true
|
211
|
+
expect(f1.eql?(f2)).to be true
|
212
|
+
end
|
213
|
+
|
214
|
+
it "object is not eql? to semantically identical object" do
|
215
|
+
expect(e1.eql?(f1)).to be false
|
216
|
+
end
|
217
|
+
|
218
|
+
it "#hash aligns with #eql?" do
|
219
|
+
samples.each do |a|
|
220
|
+
samples.each do |b|
|
221
|
+
if a.eql?(b)
|
222
|
+
expect(a.hash).to eq(b.hash)
|
223
|
+
else
|
224
|
+
expect(a.hash).to_not eq(b.hash)
|
225
|
+
end
|
226
|
+
end
|
227
|
+
end
|
228
|
+
end
|
229
|
+
|
230
|
+
it "works when used as Hash keys" do
|
231
|
+
ht = {}
|
232
|
+
ht[x1] = 1
|
233
|
+
ht[y1] = 2
|
234
|
+
ht[e1] = 3
|
235
|
+
ht[e2] = 4
|
236
|
+
|
237
|
+
expect(ht.size).to eq(3)
|
238
|
+
expect(ht[x1]).to eq(1)
|
239
|
+
expect(ht[x2]).to eq(1)
|
240
|
+
expect(ht[y1]).to eq(2)
|
241
|
+
expect(ht[y2]).to eq(2)
|
242
|
+
expect(ht[e1]).to eq(4)
|
243
|
+
expect(ht[e2]).to eq(4)
|
244
|
+
expect(ht[f1]).to eq(nil)
|
245
|
+
expect(ht[f2]).to eq(nil)
|
246
|
+
end
|
247
|
+
end
|
186
248
|
end
|
@@ -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
|
@@ -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
|
@@ -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
|
@@ -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,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
|
@@ -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
|
@@ -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
|
@@ -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
|