Class: OrigenTesters::SmartestBasedTester::Base::TestMethods

Inherits:
Object
  • Object
show all
Defined in:
lib/origen_testers/smartest_based_tester/base/test_methods.rb,
lib/origen_testers/smartest_based_tester/base/test_methods/ac_tml.rb,
lib/origen_testers/smartest_based_tester/base/test_methods/dc_tml.rb,
lib/origen_testers/smartest_based_tester/base/test_methods/limits.rb,
lib/origen_testers/smartest_based_tester/base/test_methods/base_tml.rb,
lib/origen_testers/smartest_based_tester/base/test_methods/custom_tml.rb

Direct Known Subclasses

V93K::TestMethods

Defined Under Namespace

Classes: AcTml, BaseTml, CustomTml, DcTml, Limits

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(flow) ⇒ TestMethods

Returns a new instance of TestMethods.


16
17
18
19
20
# File 'lib/origen_testers/smartest_based_tester/base/test_methods.rb', line 16

def initialize(flow)
  @flow = flow
  @collection = []
  @ix = 0
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object

Creates an accessor for custom test method libraries the first time they are called


47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/origen_testers/smartest_based_tester/base/test_methods.rb', line 47

def method_missing(method, *args, &block)
  custom_tmls = Origen.interface.send(:custom_tmls)
  if custom_tmls[method]
    tml = CustomTml.new(self, custom_tmls[method])
    instance_variable_set "@#{method}", tml
    define_singleton_method method do
      instance_variable_get("@#{method}")
    end
    send(method)
  else
    super
  end
end

Instance Attribute Details

#collectionObject

Returns the value of attribute collection.


14
15
16
# File 'lib/origen_testers/smartest_based_tester/base/test_methods.rb', line 14

def collection
  @collection
end

#flowObject

Returns the value of attribute flow.


14
15
16
# File 'lib/origen_testers/smartest_based_tester/base/test_methods.rb', line 14

def flow
  @flow
end

Instance Method Details

#[](ix) ⇒ Object


32
33
34
# File 'lib/origen_testers/smartest_based_tester/base/test_methods.rb', line 32

def [](ix)
  collection[ix]
end

#ac_tmlObject

Returns the AC test method library


37
38
39
# File 'lib/origen_testers/smartest_based_tester/base/test_methods.rb', line 37

def ac_tml
  @ac_tml ||= AcTml.new(self)
end

#add(test_method, options = {}) ⇒ Object


26
27
28
29
30
# File 'lib/origen_testers/smartest_based_tester/base/test_methods.rb', line 26

def add(test_method, options = {})
  collection << test_method
  test_method.send 'id=', "tm_#{collection.size}"
  test_method
end

#dc_tmlObject

Returns the DC test method library


42
43
44
# File 'lib/origen_testers/smartest_based_tester/base/test_methods.rb', line 42

def dc_tml
  @dc_tml ||= DcTml.new(self)
end

#filenameObject


22
23
24
# File 'lib/origen_testers/smartest_based_tester/base/test_methods.rb', line 22

def filename
  flow.filename
end

#finalizeObject


65
66
67
68
69
# File 'lib/origen_testers/smartest_based_tester/base/test_methods.rb', line 65

def finalize
  collection.each do |method|
    method.finalize.call(method) if method.finalize
  end
end

#respond_to?(method) ⇒ Boolean

Returns:

  • (Boolean)

61
62
63
# File 'lib/origen_testers/smartest_based_tester/base/test_methods.rb', line 61

def respond_to?(method)
  !!Origen.interface.send(:custom_tmls)[method] || super
end

#sorted_collectionObject


71
72
73
# File 'lib/origen_testers/smartest_based_tester/base/test_methods.rb', line 71

def sorted_collection
  @collection.sort_by { |tm| tm.name.to_s }
end