Class: TdlSimTest::TdlHashTestUnit

Inherits:
TdlBaseTestUnit show all
Defined in:
lib/tdl/exlib/sdlmodule_sim.bak.rb

Instance Attribute Summary

Attributes inherited from TdlBaseTestUnit

#active, #value_default

Instance Method Summary collapse

Methods inherited from TdlBaseTestUnit

check_same_test_name, echo_prj_test_list, load_test_unit_hash, test_unit_hash, test_unit_hash=, top_sim_list, top_sim_list=, #use_default?

Constructor Details

#initialize(name: 'TdlNumTestUnit-0', value_default: {}, sim_target_hash: {}) ⇒ TdlHashTestUnit

Returns a new instance of TdlHashTestUnit.



208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
# File 'lib/tdl/exlib/sdlmodule_sim.bak.rb', line 208

def initialize(name: 'TdlNumTestUnit-0',value_default: {}, sim_target_hash: {})
    super name
    @name = name 
    @value_default = {} 
    value_default.each do |k,v|
        @value_default[k] = v
        @value_default[k.to_s] = v
        @value_default[k.to_s.to_sym] = v
    end

    @sim_target = {}
    if sim_target_hash[name].is_a? Hash
        @active = true
        sim_target_hash[name].each do |k,v|
            @sim_target[k] = v
            @sim_target[k.to_s] = v
            @sim_target[k.to_s.to_sym] = v
        end
    elsif sim_target_hash[name] == true 
        @active = true
    end
end

Instance Method Details

#echo_infoObject



257
258
259
# File 'lib/tdl/exlib/sdlmodule_sim.bak.rb', line 257

def echo_info 
    echo_info_array.join(" ## ")
end

#echo_info_arrayObject



236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
# File 'lib/tdl/exlib/sdlmodule_sim.bak.rb', line 236

def echo_info_array
    # test type :: test name :: test value :: test default ? :: tset others
    def_str = []
    @value_default.each do |k,v|
        def_str << "#{k}:#{v}" if k.is_a?(String)
    end

    value_str = []

    value().each do |k,v|
        value_str << "#{k}:#{v}" if v != @value_default[k] && k.is_a?(String)
    end
    if value_str.any?
        value_str = value_str.join(', ')
    else
        value_str = 'default'
    end

    ['HASH-UNIT',@name,active_symb,value_str, use_default?().to_s, "default(#{def_str.join(", ")})" ] 
end

#valueObject



232
233
234
# File 'lib/tdl/exlib/sdlmodule_sim.bak.rb', line 232

def value
    return  @value_default.merge @sim_target
end