Class: TdlSimTest::TdlBaseTestUnit
- Inherits:
-
Object
- Object
- TdlSimTest::TdlBaseTestUnit
- Defined in:
- lib/tdl/exlib/sdlmodule_sim.bak.rb
Overview
end
Direct Known Subclasses
TdlHashTestUnit, TdlNumTestUnit, TdlSelTestUnit, TdlSimpleTestUnit
Constant Summary collapse
- @@test_unit_hash =
工程文件引入一开始,必须先引入测试项文件,然后再是其他工程 sdl hdl文件 测试项
{}
- @@top_sim_list =
工程能提供的测试用例
[]
Instance Attribute Summary collapse
-
#active ⇒ Object
Returns the value of attribute active.
-
#value_default ⇒ Object
Returns the value of attribute value_default.
Class Method Summary collapse
- .check_same_test_name(name) ⇒ Object
-
.echo_prj_test_list ⇒ Object
用于终端打印.
-
.load_test_unit_hash(hash) ⇒ Object
KEY -> VALUE.
- .test_unit_hash ⇒ Object
- .test_unit_hash=(a) ⇒ Object
- .top_sim_list ⇒ Object
- .top_sim_list=(a) ⇒ Object
Instance Method Summary collapse
-
#initialize(name, active = false) ⇒ TdlBaseTestUnit
constructor
A new instance of TdlBaseTestUnit.
- #use_default? ⇒ Boolean
- #value ⇒ Object
Constructor Details
#initialize(name, active = false) ⇒ TdlBaseTestUnit
Returns a new instance of TdlBaseTestUnit.
17 18 19 20 |
# File 'lib/tdl/exlib/sdlmodule_sim.bak.rb', line 17 def initialize(name,active=false) @active = active TdlBaseTestUnit.check_same_test_name(name) end |
Instance Attribute Details
#active ⇒ Object
Returns the value of attribute active.
16 17 18 |
# File 'lib/tdl/exlib/sdlmodule_sim.bak.rb', line 16 def active @active end |
#value_default ⇒ Object
Returns the value of attribute value_default.
16 17 18 |
# File 'lib/tdl/exlib/sdlmodule_sim.bak.rb', line 16 def value_default @value_default end |
Class Method Details
.check_same_test_name(name) ⇒ Object
77 78 79 80 81 82 83 |
# File 'lib/tdl/exlib/sdlmodule_sim.bak.rb', line 77 def self.check_same_test_name(name) @@_same_test_name_collect_ ||= [] if @@_same_test_name_collect_.include? name.to_s raise TdlError.new "cant define same test name<#{name}>" end @@_same_test_name_collect_ << name.to_s end |
.echo_prj_test_list ⇒ Object
用于终端打印
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
# File 'lib/tdl/exlib/sdlmodule_sim.bak.rb', line 86 def self.echo_prj_test_list # type_list = [] # name_list = [] # value_list = [] # default_list = [] # other_list = [] # ttl = 0 # nnl = 0 # vvl = 0 # ddl = 0 info_x = [ ['TYPE'],['NAME'],['ACTIVE'],['VALUE'],['DEFAULT'],['OTHERS'] ] len_x = [7] * 6 @@top_sim_list.each do |e| rels = e.echo_info_array rels.each_index do |index| info_x[index] << rels[index].to_s len_x[index] = (rels[index].to_s.length > len_x[index] ) ? rels[index].to_s.length : len_x[index] end end collect_str = [] info_x[0].each_index do |index| sub_collect_str = [] 6.times do |xx| if xx != 5 sub_collect_str << " #{info_x[xx][index]} #{' '*(len_x[xx]+4- info_x[xx][index].size) }" else sub_collect_str << " #{info_x[xx][index]}" end end collect_str << sub_collect_str.join('|') end collect_str.join("\n")+"\n---\n Total: #{@@top_sim_list.length}\n" end |
.load_test_unit_hash(hash) ⇒ Object
KEY -> VALUE
59 60 61 |
# File 'lib/tdl/exlib/sdlmodule_sim.bak.rb', line 59 def self.load_test_unit_hash(hash) ## KEY -> VALUE @@test_unit_hash = hash end |
.test_unit_hash ⇒ Object
63 64 65 |
# File 'lib/tdl/exlib/sdlmodule_sim.bak.rb', line 63 def self.test_unit_hash @@test_unit_hash || {} end |
.test_unit_hash=(a) ⇒ Object
67 68 69 70 71 72 73 74 75 |
# File 'lib/tdl/exlib/sdlmodule_sim.bak.rb', line 67 def self.test_unit_hash=(a) _hash_ = {} a.each do |k,v| _hash_[k] = v _hash_[k.to_s] = v _hash_[k.to_s.to_sym] = v end @@test_unit_hash = _hash_ end |
.top_sim_list ⇒ Object
51 52 53 |
# File 'lib/tdl/exlib/sdlmodule_sim.bak.rb', line 51 def self.top_sim_list @@top_sim_list end |
.top_sim_list=(a) ⇒ Object
55 56 57 |
# File 'lib/tdl/exlib/sdlmodule_sim.bak.rb', line 55 def self.top_sim_list=(a) @@top_sim_list = a end |
Instance Method Details
#use_default? ⇒ Boolean
30 31 32 33 34 35 36 |
# File 'lib/tdl/exlib/sdlmodule_sim.bak.rb', line 30 def use_default? if @value_default && !@sim_target return true else return false end end |
#value ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/tdl/exlib/sdlmodule_sim.bak.rb', line 22 def value if @sim_target != true return @sim_target || @value_default else return @value_default end end |