Class: TdlTestPoint
- Inherits:
-
Object
- Object
- TdlTestPoint
- Defined in:
- lib/tdl/exlib/test_point.rb
Constant Summary collapse
- @@name_collect =
[]
- @@inst_collect =
[]
Instance Attribute Summary collapse
-
#descript ⇒ Object
readonly
Returns the value of attribute descript.
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#filter_block ⇒ Object
Returns the value of attribute filter_block.
-
#line ⇒ Object
readonly
Returns the value of attribute line.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#target ⇒ Object
readonly
Returns the value of attribute target.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(target: nil, name: 'test_point', descript: '', file: nil, line: nil) ⇒ TdlTestPoint
constructor
A new instance of TdlTestPoint.
Constructor Details
#initialize(target: nil, name: 'test_point', descript: '', file: nil, line: nil) ⇒ TdlTestPoint
Returns a new instance of TdlTestPoint.
7 8 9 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/tdl/exlib/test_point.rb', line 7 def initialize(target: nil, name: 'test_point',descript: '',file: nil, line: nil) @name = name.to_s if @@name_collect.include? @name raise TdlError.new "Cant redefine test point with name <#{@name}>" end @target = target @descript = descript @file = File.(file) if file @line = line unless @target.respond_to? :belong_to_module raise TdlError.new "Test point<#{@name}> is not respond to belong_to_module" end ## when test unit in topmodule or topmodule techbench if target.belong_to_module.is_a?(TopModule) || (TopModule.current && (target.belong_to_module == TopModule.current.techbench)) TdlTestPoint.define_singleton_method(name) { target } end TdlTestPoint.define_singleton_method(target.belong_to_module.module_name ) { target.belong_to_module } target.belong_to_module.define_singleton_method(name) { target } _self = self target.define_singleton_method('tp_instance') { _self } @@inst_collect << self end |
Instance Attribute Details
#descript ⇒ Object (readonly)
Returns the value of attribute descript.
5 6 7 |
# File 'lib/tdl/exlib/test_point.rb', line 5 def descript @descript end |
#file ⇒ Object (readonly)
Returns the value of attribute file.
5 6 7 |
# File 'lib/tdl/exlib/test_point.rb', line 5 def file @file end |
#filter_block ⇒ Object
Returns the value of attribute filter_block.
6 7 8 |
# File 'lib/tdl/exlib/test_point.rb', line 6 def filter_block @filter_block end |
#line ⇒ Object (readonly)
Returns the value of attribute line.
5 6 7 |
# File 'lib/tdl/exlib/test_point.rb', line 5 def line @line end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/tdl/exlib/test_point.rb', line 5 def name @name end |
#target ⇒ Object (readonly)
Returns the value of attribute target.
5 6 7 |
# File 'lib/tdl/exlib/test_point.rb', line 5 def target @target end |
Class Method Details
.echo_list ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/tdl/exlib/test_point.rb', line 34 def self.echo_list ml = [' MODULE'] nl = ['NAME'] dl = ['DESCRIPT'] fl = ['FILE'] mll = 8 nll = 4 dll = 8 @@inst_collect.each do |e| unless e.target.belong_to_module.top_tb_ref? next end inst_cnt = e.target.belong_to_module.instance_variable_get("@instance_cnt") if !inst_cnt || inst_cnt == 0 next end ml << e.target.belong_to_module.module_name nl << e.name dl << e.descript if e.file fl << "#{e.file}:#{e.line}" else fl << 'Null' end mll = e.target.belong_to_module.module_name.size if e.target.belong_to_module.module_name.size > mll nll = e.name.size if e.name.size > nll dll = e.descript.size if e.descript.size > dll end ccl = [] ml.each_index do |index| # if index != 0 ccl << "[#{sprintf("%3d",index)}]#{ml[index]} #{' '*(mll-ml[index].size)}| #{nl[index]} #{' '*(nll-nl[index].size)}| #{dl[index]} #{' '*(dll-dl[index].size)}| #{fl[index]}" # else # ccl << "#{ml[index]} #{' '*(mll-ml[index].size)}| #{nl[index]} #{' '*(nll-nl[index].size)}| #{dl[index]} #{' '*(dll-dl[index].size)}| #{fl[index]}" # end end ccl.join("\n") end |
.inst_collect ⇒ Object
76 77 78 |
# File 'lib/tdl/exlib/test_point.rb', line 76 def self.inst_collect @@inst_collect end |