seafoam 0.4 → 0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (128) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/workflows.yml +39 -0
  3. data/.rubocop.yml +1 -1
  4. data/README.md +75 -2
  5. data/bin/bgv2isabelle +16 -45
  6. data/bin/bgv2json +18 -36
  7. data/bin/cfg2asm +24 -0
  8. data/bin/seafoam +1 -1
  9. data/demos/box-unbox-stats +65 -0
  10. data/docs/getting-graphs.md +4 -0
  11. data/examples/fib-java.bgv.gz +0 -0
  12. data/examples/fib.js +1 -1
  13. data/examples/java/JavaExamples.java +1 -1
  14. data/examples/ruby/clamps.rb +20 -0
  15. data/examples/ruby/graal.patch +15 -0
  16. data/examples/ruby/ruby_examples.rb +278 -0
  17. data/lib/seafoam.rb +5 -0
  18. data/lib/seafoam/annotators/graal.rb +1 -1
  19. data/lib/seafoam/cfg/cfg_parser.rb +93 -0
  20. data/lib/seafoam/cfg/disassembler.rb +70 -0
  21. data/lib/seafoam/commands.rb +185 -29
  22. data/lib/seafoam/graal/source.rb +23 -0
  23. data/lib/seafoam/isabelle_writer.rb +46 -0
  24. data/lib/seafoam/json_writer.rb +58 -0
  25. data/lib/seafoam/version.rb +1 -1
  26. data/seafoam.gemspec +2 -1
  27. data/spec/seafoam/annotators/graal_spec.rb +7 -7
  28. data/spec/seafoam/bgv/bgv_parser_spec.rb +2 -2
  29. data/spec/seafoam/cfg/cfg_parser_spec.rb +21 -0
  30. data/spec/seafoam/cfg/disassembler_spec.rb +32 -0
  31. data/spec/seafoam/command_spec.rb +78 -30
  32. data/spec/seafoam/json_writer_spec.rb +14 -0
  33. data/spec/seafoam/spec_helpers.rb +4 -0
  34. data/tools/render-all +2 -2
  35. metadata +36 -102
  36. data/.github/workflows/rubocop.yml +0 -10
  37. data/.github/workflows/specs.yml +0 -19
  38. data/examples/fib-java.bgv +0 -0
  39. data/examples/fib-js.bgv +0 -0
  40. data/examples/fib-ruby.bgv +0 -0
  41. data/examples/identity.bgv +0 -0
  42. data/examples/java/exampleArithOperator.bgv +0 -0
  43. data/examples/java/exampleArithOperator.cfg +0 -925
  44. data/examples/java/exampleArrayAllocation.bgv +0 -0
  45. data/examples/java/exampleArrayAllocation.cfg +0 -5268
  46. data/examples/java/exampleArrayRead.bgv +0 -0
  47. data/examples/java/exampleArrayRead.cfg +0 -2263
  48. data/examples/java/exampleArrayWrite.bgv +0 -0
  49. data/examples/java/exampleArrayWrite.cfg +0 -2315
  50. data/examples/java/exampleCatch.bgv +0 -0
  51. data/examples/java/exampleCatch.cfg +0 -4150
  52. data/examples/java/exampleCompareOperator.bgv +0 -0
  53. data/examples/java/exampleCompareOperator.cfg +0 -1109
  54. data/examples/java/exampleDoubleSynchronized.bgv +0 -0
  55. data/examples/java/exampleDoubleSynchronized.cfg +0 -26497
  56. data/examples/java/exampleExactArith.bgv +0 -0
  57. data/examples/java/exampleExactArith.cfg +0 -1888
  58. data/examples/java/exampleFieldRead.bgv +0 -0
  59. data/examples/java/exampleFieldRead.cfg +0 -1228
  60. data/examples/java/exampleFieldWrite.bgv +0 -0
  61. data/examples/java/exampleFieldWrite.cfg +0 -1102
  62. data/examples/java/exampleFor.bgv +0 -0
  63. data/examples/java/exampleFor.cfg +0 -3936
  64. data/examples/java/exampleFullEscape.bgv +0 -0
  65. data/examples/java/exampleFullEscape.cfg +0 -5893
  66. data/examples/java/exampleIf.bgv +0 -0
  67. data/examples/java/exampleIf.cfg +0 -2462
  68. data/examples/java/exampleIfNeverTaken.bgv +0 -0
  69. data/examples/java/exampleIfNeverTaken.cfg +0 -2476
  70. data/examples/java/exampleInstanceOfManyImpls.bgv +0 -0
  71. data/examples/java/exampleInstanceOfManyImpls.cfg +0 -6391
  72. data/examples/java/exampleInstanceOfOneImpl.bgv +0 -0
  73. data/examples/java/exampleInstanceOfOneImpl.cfg +0 -2604
  74. data/examples/java/exampleIntSwitch.bgv +0 -0
  75. data/examples/java/exampleIntSwitch.cfg +0 -3121
  76. data/examples/java/exampleInterfaceCallManyImpls.bgv +0 -0
  77. data/examples/java/exampleInterfaceCallManyImpls.cfg +0 -1358
  78. data/examples/java/exampleInterfaceCallOneImpl.bgv +0 -0
  79. data/examples/java/exampleInterfaceCallOneImpl.cfg +0 -3859
  80. data/examples/java/exampleLocalInstanceOf.bgv +0 -0
  81. data/examples/java/exampleLocalInstanceOf.cfg +0 -5276
  82. data/examples/java/exampleLocalSynchronized.bgv +0 -0
  83. data/examples/java/exampleLocalSynchronized.cfg +0 -1364
  84. data/examples/java/exampleLocalVariables.bgv +0 -0
  85. data/examples/java/exampleLocalVariables.cfg +0 -1195
  86. data/examples/java/exampleLocalVariablesState.bgv +0 -0
  87. data/examples/java/exampleLocalVariablesState.cfg +0 -1673
  88. data/examples/java/exampleNestedWhile.bgv +0 -0
  89. data/examples/java/exampleNestedWhile.cfg +0 -15499
  90. data/examples/java/exampleNestedWhileBreak.bgv +0 -0
  91. data/examples/java/exampleNestedWhileBreak.cfg +0 -11162
  92. data/examples/java/exampleNoEscape.bgv +0 -0
  93. data/examples/java/exampleNoEscape.cfg +0 -974
  94. data/examples/java/exampleObjectAllocation.bgv +0 -0
  95. data/examples/java/exampleObjectAllocation.cfg +0 -5287
  96. data/examples/java/examplePartialEscape.bgv +0 -0
  97. data/examples/java/examplePartialEscape.cfg +0 -7042
  98. data/examples/java/examplePhi.bgv +0 -0
  99. data/examples/java/examplePhi.cfg +0 -3227
  100. data/examples/java/exampleReducible.bgv +0 -0
  101. data/examples/java/exampleReducible.cfg +0 -5578
  102. data/examples/java/exampleSimpleCall.bgv +0 -0
  103. data/examples/java/exampleSimpleCall.cfg +0 -1435
  104. data/examples/java/exampleStamp.bgv +0 -0
  105. data/examples/java/exampleStamp.cfg +0 -913
  106. data/examples/java/exampleStaticCall.bgv +0 -0
  107. data/examples/java/exampleStaticCall.cfg +0 -1154
  108. data/examples/java/exampleStringSwitch.bgv +0 -0
  109. data/examples/java/exampleStringSwitch.cfg +0 -15377
  110. data/examples/java/exampleSynchronized.bgv +0 -0
  111. data/examples/java/exampleSynchronized.cfg +0 -26027
  112. data/examples/java/exampleThrow.bgv +0 -0
  113. data/examples/java/exampleThrow.cfg +0 -780
  114. data/examples/java/exampleThrowCatch.bgv +0 -0
  115. data/examples/java/exampleThrowCatch.cfg +0 -744
  116. data/examples/java/exampleUnsafeRead.bgv +0 -0
  117. data/examples/java/exampleUnsafeRead.cfg +0 -912
  118. data/examples/java/exampleUnsafeWrite.bgv +0 -0
  119. data/examples/java/exampleUnsafeWrite.cfg +0 -962
  120. data/examples/java/exampleWhile.bgv +0 -0
  121. data/examples/java/exampleWhile.cfg +0 -3936
  122. data/examples/java/exampleWhileBreak.bgv +0 -0
  123. data/examples/java/exampleWhileBreak.cfg +0 -5963
  124. data/examples/matmult-java.bgv +0 -0
  125. data/examples/matmult-ruby.bgv +0 -0
  126. data/examples/overflow.bgv +0 -0
  127. data/spec/seafoam/bgv/fixtures/not.bgv +0 -1
  128. data/spec/seafoam/bgv/fixtures/unsupported.bgv +0 -1
@@ -8,12 +8,31 @@ module Seafoam
8
8
  @config = config
9
9
  end
10
10
 
11
- # Run any command.
12
- def run(*args)
11
+ # Run the general seafoam command.
12
+ def seafoam(*args)
13
13
  first, *args = args
14
14
  case first
15
15
  when nil, 'help', '-h', '--help', '-help'
16
- help(*args)
16
+ raise ArgumentError, "unexpected arguments #{args.join(' ')}" unless args.empty?
17
+
18
+ @out.puts 'seafoam file.bgv info'
19
+ @out.puts ' file.bgv list'
20
+ @out.puts ' file.bgv[:graph][:node[-edge]] search term...'
21
+ @out.puts ' file.bgv[:graph][:node[-edge]] edges'
22
+ @out.puts ' file.bgv[:graph][:node[-edge]] props'
23
+ @out.puts ' file.bgv:graph:node source'
24
+ @out.puts ' file.bgv:graph render'
25
+ @out.puts ' --spotlight n,n,n...'
26
+ @out.puts ' --out graph.pdf'
27
+ @out.puts ' graph.svg'
28
+ @out.puts ' graph.png'
29
+ @out.puts ' graph.dot'
30
+ @out.puts ' --show-frame-state'
31
+ @out.puts ' --hide-floating'
32
+ @out.puts ' --no-reduce-edges'
33
+ @out.puts ' --option key value'
34
+ @out.puts ' --help'
35
+ @out.puts ' --version'
17
36
  when 'version', '-v', '-version', '--version'
18
37
  version(*args)
19
38
  else
@@ -32,6 +51,8 @@ module Seafoam
32
51
  edges name, *args
33
52
  when 'props'
34
53
  props name, *args
54
+ when 'source'
55
+ source name, *args
35
56
  when 'render'
36
57
  render name, *args
37
58
  when 'debug'
@@ -42,6 +63,141 @@ module Seafoam
42
63
  end
43
64
  end
44
65
 
66
+ # Run the bgv2isabelle command.
67
+ def bgv2isabelle(*args)
68
+ case args.first
69
+ when nil, 'help', '-h', '--help', '-help'
70
+ args = args.drop(1)
71
+ raise ArgumentError, "unexpected arguments #{args.join(' ')}" unless args.empty?
72
+
73
+ @out.puts 'bgv2isabelle file.bgv...'
74
+ @out.puts ' --help'
75
+ @out.puts ' --version'
76
+ when 'version', '-v', '-version', '--version'
77
+ args = args.drop(1)
78
+ version(*args)
79
+ else
80
+ files = []
81
+
82
+ until args.empty?
83
+ arg = args.shift
84
+ if arg.start_with?('-')
85
+ raise ArgumentError, "unknown option #{arg}"
86
+ else
87
+ files.push arg
88
+ end
89
+ end
90
+
91
+ writer = IsabelleWriter.new(@out)
92
+
93
+ files.each do |file|
94
+ parser = Seafoam::BGV::BGVParser.new(file)
95
+ parser.read_file_header
96
+ parser.skip_document_props
97
+
98
+ loop do
99
+ index, = parser.read_graph_preheader
100
+ break unless index
101
+
102
+ graph_header = parser.read_graph_header
103
+ name = parser.graph_name(graph_header)
104
+ graph = parser.read_graph
105
+
106
+ writer.write index, name, graph
107
+ end
108
+ end
109
+ end
110
+ end
111
+
112
+ def bgv2json(*args)
113
+ case args.first
114
+ when nil, 'help', '-h', '--help', '-help'
115
+ args = args.drop(1)
116
+ raise ArgumentError, "unexpected arguments #{args.join(' ')}" unless args.empty?
117
+
118
+ @out.puts 'bgv2json file.bgv...'
119
+ @out.puts ' --help'
120
+ @out.puts ' --version'
121
+ when 'version', '-v', '-version', '--version'
122
+ args = args.drop(1)
123
+ version(*args)
124
+ else
125
+ files = []
126
+
127
+ until args.empty?
128
+ arg = args.shift
129
+ if arg.start_with?('-')
130
+ raise ArgumentError, "unknown option #{arg}"
131
+ else
132
+ files.push arg
133
+ end
134
+ end
135
+
136
+ writer = JSONWriter.new(@out)
137
+
138
+ files.each do |file|
139
+ parser = Seafoam::BGV::BGVParser.new(file)
140
+ parser.read_file_header
141
+ parser.skip_document_props
142
+
143
+ loop do
144
+ index, = parser.read_graph_preheader
145
+ break unless index
146
+
147
+ graph_header = parser.read_graph_header
148
+ name = parser.graph_name(graph_header)
149
+ graph = parser.read_graph
150
+
151
+ writer.write name, graph
152
+ end
153
+ end
154
+ end
155
+ end
156
+
157
+ def cfg2asm(*args)
158
+ case args.first
159
+ when nil, 'help', '-h', '--help', '-help'
160
+ args = args.drop(1)
161
+ raise ArgumentError, "unexpected arguments #{args.join(' ')}" unless args.empty?
162
+
163
+ @out.puts 'cfg2asm file.bgv...'
164
+ @out.puts ' --no-comments'
165
+ @out.puts ' --help'
166
+ @out.puts ' --version'
167
+ when 'version', '-v', '-version', '--version'
168
+ args = args.drop(1)
169
+ version(*args)
170
+ else
171
+ comments = true
172
+ files = []
173
+
174
+ until args.empty?
175
+ arg = args.shift
176
+ if arg.start_with?('-')
177
+ case arg
178
+ when '--no-comments'
179
+ comments = false
180
+ else
181
+ raise ArgumentError, "unknown option #{arg}"
182
+ end
183
+ else
184
+ files.push arg
185
+ end
186
+ end
187
+
188
+ files.each_with_index do |file, n|
189
+ parser = Seafoam::CFG::CFGParser.new(@out, file)
190
+ parser.skip_over_cfg 'After code installation'
191
+ nmethod = parser.read_nmethod
192
+
193
+ disassembler = Seafoam::CFG::Disassembler.new(@out)
194
+ @out.puts if n.positive?
195
+ @out.puts "[#{file}]"
196
+ disassembler.disassemble(nmethod, comments)
197
+ end
198
+ end
199
+ end
200
+
45
201
  private
46
202
 
47
203
  # seafoam file.bgv info
@@ -218,7 +374,24 @@ module Seafoam
218
374
  end
219
375
  end
220
376
 
221
- # seafoam file.bgv:0 render options...
377
+ # seafoam file.bgv:n:n source
378
+ def source(name, *args)
379
+ file, graph_index, node_id, edge_id = parse_name(name)
380
+ raise ArgumentError, 'source needs a node' unless node_id
381
+ raise ArgumentError, 'source only works with a node' if edge_id
382
+ raise ArgumentError, 'source does not take arguments' unless args.empty?
383
+
384
+ with_graph(file, graph_index) do |parser|
385
+ parser.read_graph_header
386
+ graph = parser.read_graph
387
+ node = graph.nodes[node_id]
388
+ raise ArgumentError, 'node not found' unless node
389
+
390
+ @out.puts Graal::Source.render(node.props['nodeSourcePosition'])
391
+ end
392
+ end
393
+
394
+ # seafoam file.bgv:n render options...
222
395
  def render(name, *args)
223
396
  file, graph_index, *rest = parse_name(name)
224
397
  raise ArgumentError, 'render needs at least a graph' unless graph_index
@@ -299,10 +472,14 @@ module Seafoam
299
472
  writer.write_graph graph
300
473
  end
301
474
  else
302
- IO.popen(['dot', "-T#{out_format}", '-o', out_file], 'w') do |stream|
303
- writer = GraphvizWriter.new(stream)
304
- hidpi = out_format == :png
305
- writer.write_graph graph, hidpi
475
+ begin
476
+ IO.popen(['dot', "-T#{out_format}", '-o', out_file], 'w') do |stream|
477
+ writer = GraphvizWriter.new(stream)
478
+ hidpi = out_format == :png
479
+ writer.write_graph graph, hidpi
480
+ end
481
+ rescue Errno::ENOENT
482
+ raise 'Could not run Graphviz - is it installed?'
306
483
  end
307
484
  autoopen out_file unless explicit_out_file
308
485
  end
@@ -388,27 +565,6 @@ module Seafoam
388
565
  raise ArgumentError, 'graph not found' unless graph_found
389
566
  end
390
567
 
391
- # Prints help.
392
- def help(*args)
393
- raise ArgumentError, "unexpected arguments #{args.join(' ')}" unless args.empty?
394
-
395
- @out.puts 'seafoam file.bgv info'
396
- @out.puts ' file.bgv list'
397
- @out.puts ' file.bgv[:graph][:node[-edge]] search term...'
398
- @out.puts ' file.bgv[:graph][:node[-edge]] edges'
399
- @out.puts ' file.bgv[:graph][:node[-edge]] props'
400
- @out.puts ' file.bgv:graph render'
401
- @out.puts ' --spotlight n,n,n...'
402
- @out.puts ' --out graph.pdf'
403
- @out.puts ' graph.svg'
404
- @out.puts ' graph.png'
405
- @out.puts ' graph.dot'
406
- @out.puts ' --show-frame-state'
407
- @out.puts ' --hide-floating'
408
- @out.puts ' --no-reduce-edges'
409
- @out.puts ' --option key value'
410
- end
411
-
412
568
  # Prints the version.
413
569
  def version(*args)
414
570
  raise ArgumentError, "unexpected arguments #{args.join(' ')}" unless args.empty?
@@ -0,0 +1,23 @@
1
+ module Seafoam
2
+ module Graal
3
+ # Routines for understanding source positions in Graal.
4
+ module Source
5
+ def self.render(source_position)
6
+ lines = []
7
+ caller = source_position
8
+ while caller
9
+ method = caller[:method]
10
+ lines.push render_method(method)
11
+ caller = caller[:caller]
12
+ end
13
+ lines.join("\n")
14
+ end
15
+
16
+ def self.render_method(method)
17
+ declaring_class = method[:declaring_class]
18
+ name = method[:method_name]
19
+ "#{declaring_class}##{name}"
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,46 @@
1
+ module Seafoam
2
+ # Write graphs in the Isabelle file format.
3
+ class IsabelleWriter
4
+ def initialize(out)
5
+ @out = out
6
+ end
7
+
8
+ def write(index, name, graph)
9
+ # definition eg_short_cut_or1 :: IRGraph where
10
+ # "eg_short_cut_or1 =
11
+ # (add_node 14 ReturnNode [13] []
12
+ # (add_node 13 PhiNode [10, 11, 12] []
13
+ # (add_node 12 (ConstantNode 0) [] []
14
+ # (add_node 11 (ConstantNode 42) [] []
15
+ # (add_node 10 MergeNode [7, 9] [14]
16
+ # (add_node 9 EndNode [] []
17
+ # (add_node 8 BeginNode [] [9]
18
+ # (add_node 7 EndNode [] []
19
+ # (add_node 6 BeginNode [] [7]
20
+ # (add_node 5 IfNode [3] [6, 8]
21
+ # (add_node 3 (ShortCircuitOrNode False False) [1, 2] []
22
+ # (add_node 2 (ParameterNode 1) [] []
23
+ # (add_node 1 (ParameterNode 0) [] []
24
+ # (add_node 0 StartNode [] [5]
25
+ # empty_graph))))))))))))))"
26
+
27
+ @out.puts "graph#{index} = # #{name}"
28
+
29
+ graph.nodes.each_value do |node|
30
+ node_class = node.props[:node_class][:node_class]
31
+ case node_class
32
+ when 'org.graalvm.compiler.nodes.ConstantNode'
33
+ desc = "(ConstantNode #{node.props['rawvalue']})"
34
+ when 'org.graalvm.compiler.nodes.ParameterNode'
35
+ desc = "(ParameterNode #{node.props['index']})"
36
+ else
37
+ desc = node_class.split('.').last
38
+ end
39
+ inputs = node.inputs.map(&:from).map(&:id)
40
+ outputs = node.outputs.map(&:to).map(&:id)
41
+ @out.puts " (add_node #{node.id} #{desc} #{inputs.inspect} #{outputs.inspect}"
42
+ end
43
+ @out.puts ' empty_graph' + (')' * graph.nodes.size)
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,58 @@
1
+ require 'json'
2
+
3
+ module Seafoam
4
+ # Write files in a JSON format.
5
+ class JSONWriter
6
+ def initialize(out)
7
+ @out = out
8
+ end
9
+
10
+ def write(name, graph)
11
+ nodes = []
12
+ edges = []
13
+
14
+ graph.nodes.each_value do |node|
15
+ nodes.push(
16
+ id: node.id,
17
+ props: node.props
18
+ )
19
+
20
+ node.outputs.each do |edge|
21
+ edges.push(
22
+ from: edge.from.id,
23
+ to: edge.to.id,
24
+ props: edge.props
25
+ )
26
+ end
27
+ end
28
+
29
+ object = {
30
+ name: name,
31
+ props: graph.props,
32
+ nodes: nodes,
33
+ edges: edges
34
+ }
35
+
36
+ @out.puts JSON.pretty_generate(prepare_json(object))
37
+ end
38
+
39
+ private
40
+
41
+ def prepare_json(object)
42
+ case object
43
+ when Float
44
+ if object.nan?
45
+ '[NaN]'
46
+ else
47
+ object
48
+ end
49
+ when Array
50
+ object.map { |o| prepare_json(o) }
51
+ when Hash
52
+ object.transform_values { |v| prepare_json(v) }
53
+ else
54
+ object
55
+ end
56
+ end
57
+ end
58
+ end
@@ -1,5 +1,5 @@
1
1
  module Seafoam
2
2
  MAJOR_VERSION = 0
3
- MINOR_VERSION = 4
3
+ MINOR_VERSION = 5
4
4
  VERSION = "#{MAJOR_VERSION}.#{MINOR_VERSION}"
5
5
  end
data/seafoam.gemspec CHANGED
@@ -8,13 +8,14 @@ Gem::Specification.new do |spec|
8
8
  spec.homepage = 'https://github.com/Shopify/seafoam'
9
9
  spec.license = 'MIT'
10
10
 
11
- spec.files = `git ls-files`.split("\n")
11
+ spec.files = `git ls-files`.split("\n").reject { |f| f.end_with?('.bgv') || f.end_with?('.cfg') }
12
12
  spec.bindir = 'bin'
13
13
  spec.executables = %w[seafoam bgv2json bgv2isabelle]
14
14
 
15
15
  spec.required_ruby_version = '>= 2.5.8'
16
16
 
17
17
  spec.add_development_dependency 'benchmark-ips', '~> 2.7'
18
+ spec.add_development_dependency 'crabstone', '~> 4.0'
18
19
  spec.add_development_dependency 'rspec', '~> 3.8'
19
20
  spec.add_development_dependency 'rubocop', '~> 0.74'
20
21
  end
@@ -20,7 +20,7 @@ describe Seafoam::Annotators::GraalAnnotator do
20
20
  describe 'when run' do
21
21
  describe 'without options' do
22
22
  before :all do
23
- @graph = Seafoam::SpecHelpers.example_graph('matmult-ruby', 2)
23
+ @graph = Seafoam::SpecHelpers.example_graph('matmult-ruby', 8)
24
24
  annotator = Seafoam::Annotators::GraalAnnotator.new({})
25
25
  annotator.annotate @graph
26
26
  end
@@ -37,14 +37,14 @@ describe Seafoam::Annotators::GraalAnnotator do
37
37
  expect(@graph.edges.any? { |e| e.props[:kind].nil? }).to be_falsey
38
38
  end
39
39
 
40
- it 'annotates negated GuardNodes with "Guard not, else ..."' do
41
- expect(@graph.nodes[561].props['negated']).to be true
42
- expect(@graph.nodes[561].props[:label]).to start_with 'Guard not, else'
40
+ it 'annotates not negated GuardNodes with "Guard, else ..."' do
41
+ expect(@graph.nodes[7101].props['negated']).to be false
42
+ expect(@graph.nodes[7101].props[:label]).to start_with 'Guard, else'
43
43
  end
44
44
 
45
- it 'annotates not negated GuardNodes with "Guard, else ..."' do
46
- expect(@graph.nodes[559].props['negated']).to be false
47
- expect(@graph.nodes[559].props[:label]).to start_with 'Guard, else'
45
+ it 'annotates negated GuardNodes with "Guard not, else ..."' do
46
+ expect(@graph.nodes[7102].props['negated']).to be true
47
+ expect(@graph.nodes[7102].props[:label]).to start_with 'Guard not, else'
48
48
  end
49
49
  end
50
50
 
@@ -77,7 +77,7 @@ describe Seafoam::BGV::BGVParser do
77
77
  describe '#read_file_header' do
78
78
  it 'produces a version' do
79
79
  parser = Seafoam::BGV::BGVParser.new(@fib_java_bgv)
80
- expect(parser.read_file_header).to eq [6, 1]
80
+ expect(parser.read_file_header).to eq [7, 0]
81
81
  end
82
82
 
83
83
  it 'raises an error for files which are not BGV' do
@@ -108,7 +108,7 @@ describe Seafoam::BGV::BGVParser do
108
108
  parser = Seafoam::BGV::BGVParser.new(@fib_java_bgv)
109
109
  parser.read_file_header
110
110
  parser.skip_document_props
111
- 51.times do
111
+ 54.times do
112
112
  expect(parser.read_graph_preheader).to_not be_nil
113
113
  parser.skip_graph_header
114
114
  parser.skip_graph