stupidedi 1.3.21 → 1.3.22
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/stupidedi/builder/builder_dsl.rb +5 -0
- data/lib/stupidedi/builder/constraint_table.rb +100 -74
- data/lib/stupidedi/builder/generation.rb +73 -70
- data/lib/stupidedi/builder/instruction.rb +10 -0
- data/lib/stupidedi/builder/instruction_table.rb +19 -7
- data/lib/stupidedi/builder/state_machine.rb +9 -3
- data/lib/stupidedi/builder/states/abstract_state.rb +1 -1
- data/lib/stupidedi/builder/states/failure_state.rb +1 -1
- data/lib/stupidedi/builder/states/initial_state.rb +4 -4
- data/lib/stupidedi/contrib/002001/guides/SH856.rb +4 -4
- data/lib/stupidedi/contrib/002001/transaction_set_defs/PO830.rb +2 -2
- data/lib/stupidedi/contrib/003010/guides/PS830.rb +4 -4
- data/lib/stupidedi/contrib/003010/guides/RA820.rb +22 -12
- data/lib/stupidedi/contrib/003010/transaction_set_defs/PC860.rb +2 -2
- data/lib/stupidedi/contrib/003010/transaction_set_defs/PS830.rb +1 -1
- data/lib/stupidedi/contrib/003050/guides/PO850.rb +2 -2
- data/lib/stupidedi/contrib/003050/transaction_set_defs/PO850.rb +2 -2
- data/lib/stupidedi/contrib/004010/guides.rb +0 -1
- data/lib/stupidedi/contrib/004010/transaction_set_defs/AR943.rb +1 -1
- data/lib/stupidedi/contrib/004010/transaction_set_defs/IM210.rb +2 -2
- data/lib/stupidedi/contrib/004010/transaction_set_defs/RE944.rb +1 -1
- data/lib/stupidedi/contrib/004010/transaction_set_defs/SH856.rb +1 -7
- data/lib/stupidedi/editor.rb +0 -1
- data/lib/stupidedi/guides/004010/guide_builder.rb +1 -1
- data/lib/stupidedi/guides/005010/X223-HC837I.rb +1192 -1195
- data/lib/stupidedi/guides/005010/guide_builder.rb +1 -1
- data/lib/stupidedi/schema.rb +1 -0
- data/lib/stupidedi/schema/auditor.rb +435 -0
- data/lib/stupidedi/schema/loop_def.rb +18 -1
- data/lib/stupidedi/schema/transaction_set_def.rb +12 -0
- data/lib/stupidedi/version.rb +1 -1
- data/lib/stupidedi/versions/functional_groups/004010/transaction_set_defs/HP835.rb +3 -17
- data/lib/stupidedi/versions/functional_groups/005010/element_types/time_val.rb +3 -2
- data/lib/stupidedi/versions/functional_groups/005010/segment_defs.rb +9 -6
- data/lib/stupidedi/versions/functional_groups/005010/transaction_set_defs/HB271.rb +25 -9
- data/lib/stupidedi/versions/functional_groups/005010/transaction_set_defs/HP835.rb +2 -2
- data/lib/stupidedi/zipper.rb +20 -1
- data/lib/stupidedi/zipper/memoized_cursor.rb +2 -0
- data/lib/stupidedi/zipper/path.rb +10 -0
- data/lib/stupidedi/zipper/root_cursor.rb +1 -1
- data/lib/stupidedi/zipper/stack_cursor.rb +174 -0
- data/spec/examples/stupidedi/audit_spec.rb +58 -0
- data/spec/spec_helper.rb +21 -13
- data/spec/support/rcov.rb +9 -4
- metadata +4 -1
@@ -0,0 +1,58 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Stupidedi::Schema::Auditor, :focus => true do
|
4
|
+
|
5
|
+
def self.definitions
|
6
|
+
ansi = Stupidedi::Color.ansi
|
7
|
+
|
8
|
+
@definitions ||= lambda do |root|
|
9
|
+
# Prevent walking in circles due to cycles in the graph
|
10
|
+
history = Hash.new
|
11
|
+
results = []
|
12
|
+
|
13
|
+
f = lambda do |namespace, recurse|
|
14
|
+
history[namespace] = true
|
15
|
+
|
16
|
+
for child in namespace.constants
|
17
|
+
begin
|
18
|
+
name = [namespace, child].join("::")
|
19
|
+
value = namespace.const_get(child)
|
20
|
+
|
21
|
+
if value.is_a?(Module)
|
22
|
+
if not history[value]
|
23
|
+
recurse.call(value, recurse)
|
24
|
+
end
|
25
|
+
elsif value.kind_of?(Stupidedi::Schema::TransactionSetDef)
|
26
|
+
results << [name, value]
|
27
|
+
end
|
28
|
+
rescue Stupidedi::Exceptions::InvalidSchemaError
|
29
|
+
$stderr.puts "warning: #{ansi.red("#{$!.class} #{$!.message}")}"
|
30
|
+
$stderr.puts " module: #{name}"
|
31
|
+
$stderr.puts " trace: #{$!.backtrace[0..-30].map{|x| " " + x}.join("\n")}"
|
32
|
+
$stderr.puts
|
33
|
+
rescue LoadError, NameError
|
34
|
+
$stderr.puts "warning: #{ansi.red("#{$!.class} #{$!.message}")}"
|
35
|
+
$stderr.puts " module: #{name}"
|
36
|
+
$stderr.puts
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
f.call(root, f)
|
42
|
+
results
|
43
|
+
end.call(Stupidedi)
|
44
|
+
end
|
45
|
+
|
46
|
+
definitions.each do |name, definition|
|
47
|
+
next if name =~ /FiftyTen::X223::HC837I/
|
48
|
+
|
49
|
+
it name do
|
50
|
+
Stupidedi::Schema::Auditor.build(definition).audit
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
pending "Stupidedi::Schema::Auditor Stupidedi::Guides::FiftyTen::X223::HC837I" do
|
55
|
+
Stupidedi::Schema::Auditor.build(Stupidedi::Guides::FiftyTen::X223::HC837I).audit
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require File.expand_path("../../lib/stupidedi", __FILE__)
|
2
|
-
require
|
2
|
+
require "pathname"
|
3
|
+
require "pp"
|
3
4
|
|
4
5
|
begin
|
5
6
|
# RSpec-1: https://github.com/dchelimsky/rspec
|
@@ -17,9 +18,11 @@ rescue LoadError
|
|
17
18
|
end if RUBY_VERSION >= "1.9"
|
18
19
|
|
19
20
|
# Require supporting files with custom matchers and macros
|
20
|
-
|
21
|
-
|
22
|
-
|
21
|
+
begin
|
22
|
+
specdir = Pathname.new(File.dirname(__FILE__))
|
23
|
+
Dir["#{specdir}/support/**/*.rb"].each do |file|
|
24
|
+
require Pathname.new(file).relative_path_from(specdir)
|
25
|
+
end
|
23
26
|
end
|
24
27
|
|
25
28
|
RSpec::Expectations.configuration.warn_about_potential_false_positives = false
|
@@ -31,17 +34,22 @@ RSpec.configure do |config|
|
|
31
34
|
c.syntax = [:should, :expect]
|
32
35
|
end
|
33
36
|
|
34
|
-
#
|
35
|
-
#
|
37
|
+
# Use either of these to run only specs marked 'focus: true'
|
38
|
+
# config.filter_run(:focus => true)
|
39
|
+
# $ rspec -I lib -t focus spec
|
36
40
|
|
37
|
-
#
|
38
|
-
#
|
41
|
+
# Use either of these to run only randomized specs:
|
42
|
+
# config.filter_run(:random => true)
|
43
|
+
# $ rspec -I lib -t random spec
|
39
44
|
|
40
|
-
#
|
41
|
-
|
45
|
+
# When a randomized test fails, it will print a seed value you
|
46
|
+
# can use to repeat the test with the same generated inputs:
|
47
|
+
# srand 44182052595481443184625304627718313206
|
42
48
|
|
43
|
-
#
|
44
|
-
#
|
49
|
+
# Use either of these to skip running randomized specs:
|
50
|
+
# config.filter_run_excluding(:random => true)
|
51
|
+
# $ rspec -I lib -t ~random spec
|
45
52
|
|
46
|
-
#
|
53
|
+
# Skip platform-specific examples unless our platform matches
|
54
|
+
config.filter_run_excluding(:ruby => lambda{|n| RUBY_VERSION !~ /^#{n}/ })
|
47
55
|
end
|
data/spec/support/rcov.rb
CHANGED
@@ -10,23 +10,28 @@
|
|
10
10
|
if defined? Rcov or defined? SimpleCov
|
11
11
|
lambda do |root|
|
12
12
|
# Prevent walking in circles due to cycles in the graph
|
13
|
-
# like Object.constants.include?("Object") #=> true
|
14
13
|
history = Hash.new
|
14
|
+
ansi = Stupidedi::Color.ansi
|
15
15
|
|
16
16
|
f = lambda do |namespace, recurse|
|
17
17
|
history[namespace] = true
|
18
18
|
|
19
19
|
for child in namespace.constants
|
20
20
|
begin
|
21
|
-
|
21
|
+
name = [namespace, child].join("::")
|
22
22
|
value = namespace.const_get(child)
|
23
23
|
|
24
24
|
if value.is_a?(Module) and not history[value]
|
25
25
|
recurse.call(value, recurse)
|
26
26
|
end
|
27
|
+
rescue Stupidedi::Exceptions::InvalidSchemaError
|
28
|
+
$stderr.puts "warning: #{ansi.red("#{$!.class} #{$!.message}")}"
|
29
|
+
$stderr.puts " module: #{name}"
|
30
|
+
$stderr.puts
|
27
31
|
rescue LoadError, NameError
|
28
|
-
$stderr.puts "warning: #{$!.class} #{$!.message}"
|
29
|
-
$stderr.puts "
|
32
|
+
$stderr.puts "warning: #{ansi.red("#{$!.class} #{$!.message}")}"
|
33
|
+
$stderr.puts " module: #{name}"
|
34
|
+
$stderr.puts
|
30
35
|
end
|
31
36
|
end
|
32
37
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stupidedi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.22
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kyle Putnam/Isi Robayna
|
@@ -244,6 +244,7 @@ files:
|
|
244
244
|
- lib/stupidedi/schema.rb
|
245
245
|
- lib/stupidedi/schema/abstract_def.rb
|
246
246
|
- lib/stupidedi/schema/abstract_use.rb
|
247
|
+
- lib/stupidedi/schema/auditor.rb
|
247
248
|
- lib/stupidedi/schema/code_list.rb
|
248
249
|
- lib/stupidedi/schema/element_def.rb
|
249
250
|
- lib/stupidedi/schema/element_req.rb
|
@@ -972,6 +973,7 @@ files:
|
|
972
973
|
- lib/stupidedi/zipper/memoized_cursor.rb
|
973
974
|
- lib/stupidedi/zipper/path.rb
|
974
975
|
- lib/stupidedi/zipper/root_cursor.rb
|
976
|
+
- lib/stupidedi/zipper/stack_cursor.rb
|
975
977
|
- spec/examples/integration/generating_spec.rb
|
976
978
|
- spec/examples/integration/navigating_spec.rb
|
977
979
|
- spec/examples/integration/nondeterminism_spec.rb
|
@@ -987,6 +989,7 @@ files:
|
|
987
989
|
- spec/examples/ruby/symbol_spec.rb
|
988
990
|
- spec/examples/ruby/to_d_spec.rb
|
989
991
|
- spec/examples/ruby/try_spec.rb
|
992
|
+
- spec/examples/stupidedi/audit_spec.rb
|
990
993
|
- spec/examples/stupidedi/either_spec.rb
|
991
994
|
- spec/examples/stupidedi/reader/failure_spec.rb
|
992
995
|
- spec/examples/stupidedi/reader/input/delegated_input_spec.rb
|