mbt-gen 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/mbt-gen.rb +3 -102
- data/lib/solver-lib.rb +2 -10
- metadata +5 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 55d2d7fd4933678bc3dac436056891c26984272a85fd6ea42e4ef9d947ee89f1
|
|
4
|
+
data.tar.gz: 8a8f055137928c6b814f6a12acc7481095c47f37ed73fe8ed7b7872db8c2de9b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b2f497291c2f9c80123d6c21c4e533f2d260216053e21606ba118a0fde71c0b5acebe7a5092fa1671ef7f02337f866659f08eef3f029174bfbcf49c67193a92e
|
|
7
|
+
data.tar.gz: a63cd52e1af07b675f02b31c7457e0d1e91c20217b4066c66efc2b4e6bc04ed7a8ef15d2d4763e70ab9cc2caa6942804461512de58650d927830aeab3342258a
|
data/lib/mbt-gen.rb
CHANGED
|
@@ -18,9 +18,9 @@ DEFAULT_Z3_PATH = "z3"
|
|
|
18
18
|
|
|
19
19
|
CONFIG_FILE = "config.yml"
|
|
20
20
|
OUTPUT_FILE = "result.xml"
|
|
21
|
-
CONTINUATION_FILE =
|
|
22
|
-
COMBINATION_LOG =
|
|
23
|
-
VARS_LOG =
|
|
21
|
+
CONTINUATION_FILE = "continuation.log"
|
|
22
|
+
COMBINATION_LOG = "combinations.log"
|
|
23
|
+
VARS_LOG = "vars.log"
|
|
24
24
|
|
|
25
25
|
OUTPUT_DIR = "result"
|
|
26
26
|
LISTS_DIR = "lists"
|
|
@@ -830,33 +830,6 @@ def all_values_for_field(field)
|
|
|
830
830
|
return values
|
|
831
831
|
end
|
|
832
832
|
|
|
833
|
-
def each_combination(fields, &block)
|
|
834
|
-
if fields.size < 1 then
|
|
835
|
-
return
|
|
836
|
-
end
|
|
837
|
-
if fields.size == 1 then
|
|
838
|
-
field = fields.first
|
|
839
|
-
values = field[1][:values].clone()
|
|
840
|
-
if field[1][:optional] == true then
|
|
841
|
-
values << nil
|
|
842
|
-
end
|
|
843
|
-
values.each do |value|
|
|
844
|
-
block.call({ field[0] => value })
|
|
845
|
-
end
|
|
846
|
-
else
|
|
847
|
-
first = fields.shift
|
|
848
|
-
values = first[1][:values].clone()
|
|
849
|
-
if first[1][:optional] == true then
|
|
850
|
-
values << nil
|
|
851
|
-
end
|
|
852
|
-
each_combination(fields) do |mapping|
|
|
853
|
-
values.each do |value|
|
|
854
|
-
block.call(mapping.merge({ first[0] => value }))
|
|
855
|
-
end
|
|
856
|
-
end
|
|
857
|
-
end
|
|
858
|
-
end
|
|
859
|
-
|
|
860
833
|
def calc_combinations_for_key_fields(key_fields)
|
|
861
834
|
count = 1
|
|
862
835
|
key_fields.each do |field|
|
|
@@ -923,46 +896,6 @@ def read_docs_from_log_file(log_filename)
|
|
|
923
896
|
return result
|
|
924
897
|
end
|
|
925
898
|
|
|
926
|
-
def blocking_clause(docs, vars = docs.map{|e| e.keys}.flatten)
|
|
927
|
-
unless docs.empty?
|
|
928
|
-
codes = docs.map do |key_values|
|
|
929
|
-
value_codes = key_values.filter{|xpath,value| vars.include?(xpath) }.map do |xpath, value|
|
|
930
|
-
if value == nil then
|
|
931
|
-
"(= #{filled_var_for_field(xpath)} false)"
|
|
932
|
-
else
|
|
933
|
-
"(and (= #{filled_var_for_field(xpath)} true) (= #{value_var_for_field(xpath)} \"#{value}\"))"
|
|
934
|
-
end
|
|
935
|
-
end
|
|
936
|
-
if value_codes.empty? then
|
|
937
|
-
"true"
|
|
938
|
-
else
|
|
939
|
-
"(not (and #{value_codes.join(" ")}))"
|
|
940
|
-
end
|
|
941
|
-
end
|
|
942
|
-
return "" if codes.empty?
|
|
943
|
-
return "(assert (! (and #{codes.join(" ")}) :named blocking-clause))"
|
|
944
|
-
end
|
|
945
|
-
return nil
|
|
946
|
-
end
|
|
947
|
-
|
|
948
|
-
#def fixing_clause(key_values, fixed = key_value.keys)
|
|
949
|
-
# codes = []
|
|
950
|
-
# key_values.each do |xpath, value|
|
|
951
|
-
# if fixed.include?(xpath) then
|
|
952
|
-
# if value then
|
|
953
|
-
# codes << "(and (= #{filled_var_for_field(xpath)} true) (= #{value_var_for_field(xpath)} \"#{value}\"))"
|
|
954
|
-
# else
|
|
955
|
-
# codes << "(= #{filled_var_for_field(xpath)} false)"
|
|
956
|
-
# end
|
|
957
|
-
# end
|
|
958
|
-
# end
|
|
959
|
-
# if codes.empty? then
|
|
960
|
-
# return ""
|
|
961
|
-
# else
|
|
962
|
-
# return "(assert (! (and #{codes.join(" ")}) :named fixing-clause))"
|
|
963
|
-
# end
|
|
964
|
-
#end
|
|
965
|
-
|
|
966
899
|
def prepare_output_doc_filename(number, output_dir)
|
|
967
900
|
chunk_number = number / 100000
|
|
968
901
|
dirname = "#{output_dir}/#{chunk_number}"
|
|
@@ -972,30 +905,6 @@ def prepare_output_doc_filename(number, output_dir)
|
|
|
972
905
|
return "#{dirname}/doc#{number}.xml"
|
|
973
906
|
end
|
|
974
907
|
|
|
975
|
-
def switch_blocking_clause(fixed, current_value, var_xpath, blocked_values)
|
|
976
|
-
clauses = []
|
|
977
|
-
blocked_values.each do |value|
|
|
978
|
-
if value != nil then
|
|
979
|
-
clauses << "(not (and (= #{filled_var_for_field(var_xpath)} true) (= #{value_var_for_field(var_xpath)} \"#{value}\")))"
|
|
980
|
-
else
|
|
981
|
-
clauses << "(not (= #{filled_var_for_field(var_xpath)} false))"
|
|
982
|
-
end
|
|
983
|
-
end
|
|
984
|
-
if fixed then
|
|
985
|
-
if current_value != nil then
|
|
986
|
-
result = "; switch fixing clause\n(assert (! (and (= #{filled_var_for_field(var_xpath)} true) (= #{value_var_for_field(var_xpath)} \"#{current_value}\")) :named switch_fixing_clause))"
|
|
987
|
-
else
|
|
988
|
-
result = "; switch fixing clause\n(assert (! (= #{filled_var_for_field(var_xpath)} false) :named switch_fixing_clause))"
|
|
989
|
-
end
|
|
990
|
-
else
|
|
991
|
-
result = ""
|
|
992
|
-
end
|
|
993
|
-
unless clauses.empty? then
|
|
994
|
-
result = result + "\n; switch blocking clause\n(assert (! (and #{clauses.join(" ")}) :named switch_blocking_clause))"
|
|
995
|
-
end
|
|
996
|
-
return result
|
|
997
|
-
end
|
|
998
|
-
|
|
999
908
|
def values_for_key_field(field)
|
|
1000
909
|
if field[:type] == :field then
|
|
1001
910
|
if field[:datatype] == :enum then
|
|
@@ -1024,14 +933,6 @@ def values_for_key_field(field)
|
|
|
1024
933
|
end
|
|
1025
934
|
end
|
|
1026
935
|
|
|
1027
|
-
def fixing_clause(xpath, switched_info)
|
|
1028
|
-
if switched_info[:current_value] == nil then
|
|
1029
|
-
return "(assert (! (= #{filled_var_for_field(xpath)} false) :named fixing-clause-#{raw_field(xpath)}))"
|
|
1030
|
-
else
|
|
1031
|
-
return "(assert (! (and (= #{filled_var_for_field(xpath)} true) (= #{value_var_for_field(xpath)} \"#{switched_info[:current_value]}\")) :named fixing-clause-#{raw_field(xpath)}))"
|
|
1032
|
-
end
|
|
1033
|
-
end
|
|
1034
|
-
|
|
1035
936
|
def collect_key_fields(fkey, struct, prefix = nil)
|
|
1036
937
|
result = {}
|
|
1037
938
|
struct.each do |key, value|
|
data/lib/solver-lib.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: mbt-gen
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- FM-enthusiast
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-04-
|
|
11
|
+
date: 2026-04-26 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: nokogiri
|
|
@@ -36,12 +36,12 @@ files:
|
|
|
36
36
|
- lib/progress.rb
|
|
37
37
|
- lib/regexp-to-smtlib.rb
|
|
38
38
|
- lib/solver-lib.rb
|
|
39
|
-
homepage: https://
|
|
39
|
+
homepage: https://codeberg.org/FM-enthusiast/MBT-gen
|
|
40
40
|
licenses:
|
|
41
41
|
- GPL-3.0-only
|
|
42
42
|
metadata:
|
|
43
|
-
bug_tracker_uri: https://
|
|
44
|
-
source_code_uri: https://
|
|
43
|
+
bug_tracker_uri: https://codeberg.org/FM-enthusiast/MBT-gen/issues
|
|
44
|
+
source_code_uri: https://codeberg.org/FM-enthusiast/MBT-gen
|
|
45
45
|
post_install_message:
|
|
46
46
|
rdoc_options: []
|
|
47
47
|
require_paths:
|