Class: OrigenTesters::ATP::Validators::MissingIDs

Inherits:
OrigenTesters::ATP::Validator show all
Defined in:
lib/origen_testers/atp/validators/missing_ids.rb

Instance Attribute Summary

Attributes inherited from OrigenTesters::ATP::Validator

#flow

Instance Method Summary collapse

Methods inherited from OrigenTesters::ATP::Validator

#error, #initialize, #process, #test_process, testing, testing=

Methods inherited from Processor

#add_global_flag, #clean_flag, #extract_globals, #extract_volatiles, #global_flag?, #global_flags, #handler_missing, #process, #process_all, #run, #volatile?, #volatile_flags

Constructor Details

This class inherits a constructor from OrigenTesters::ATP::Validator

Instance Method Details

#on_completionObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/origen_testers/atp/validators/missing_ids.rb', line 10

def on_completion
  failed = false
  @referenced_ids.each do |id, nodes|
    unless @present_ids[id]
      error "Test ID #{id} is referenced in flow #{flow.name} in the following lines, but it is never defined:"
      nodes.each do |node|
        error "  #{node.source}"
      end
      failed = true
      @referenced_early.delete(id)
    end
  end
  @referenced_early.each do |id, nodes|
    error "Test ID #{id} is referenced in flow #{flow.name} in the following line(s):"
    nodes.each do |node|
      error "  #{node.source}"
    end
    error 'but it was not defined until later:'
    error "  #{@present_ids[id].first.source}"
    failed = true
  end
  failed
end

#on_id(node) ⇒ Object



34
35
36
37
38
# File 'lib/origen_testers/atp/validators/missing_ids.rb', line 34

def on_id(node)
  id = node.value
  @present_ids[id] ||= []
  @present_ids[id] << node
end

#on_if_failed(node) ⇒ Object Also known as: on_if_any_failed, on_if_all_failed, on_if_passed, on_if_any_passed, on_if_all_passed, on_if_ran, on_unless_ran



40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/origen_testers/atp/validators/missing_ids.rb', line 40

def on_if_failed(node)
  ids = node.to_a[0]
  [ids].flatten.each do |id|
    unless id =~ /^extern/
      @referenced_ids[id] ||= []
      @referenced_ids[id] << node
      unless @present_ids[id]
        @referenced_early[id] ||= []
        @referenced_early[id] << node
      end
    end
  end
  process_all(node)
end

#setupObject



4
5
6
7
8
# File 'lib/origen_testers/atp/validators/missing_ids.rb', line 4

def setup
  @referenced_ids = {}
  @present_ids ||= {}.with_indifferent_access
  @referenced_early = {}.with_indifferent_access
end