class TdlSimTest::TdlBaseTestUnit

end

Attributes

active[RW]
value_default[RW]

Public Class Methods

check_same_test_name(name) click to toggle source
# 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() click to toggle source

用于终端打印

# 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) click to toggle source
# File lib/tdl/exlib/sdlmodule_sim.bak.rb, line 59
def self.load_test_unit_hash(hash)   ## KEY -> VALUE
    @@test_unit_hash = hash
end
new(name,active=false) click to toggle source
# File lib/tdl/exlib/sdlmodule_sim.bak.rb, line 17
def initialize(name,active=false)
    @active = active
    TdlBaseTestUnit.check_same_test_name(name)
end
test_unit_hash() click to toggle source
# File lib/tdl/exlib/sdlmodule_sim.bak.rb, line 63
def self.test_unit_hash 
    @@test_unit_hash || {}
end
test_unit_hash=(a) click to toggle source
# 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() click to toggle source
# File lib/tdl/exlib/sdlmodule_sim.bak.rb, line 51
def self.top_sim_list
    @@top_sim_list
end
top_sim_list=(a) click to toggle source
# File lib/tdl/exlib/sdlmodule_sim.bak.rb, line 55
def self.top_sim_list=(a)
    @@top_sim_list = a 
end

Public Instance Methods

use_default?() click to toggle source
# 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() click to toggle source
# 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

Private Instance Methods

active_symb() click to toggle source
# File lib/tdl/exlib/sdlmodule_sim.bak.rb, line 40
def active_symb
    @active ? 'Y' : ''
end