Sha256: 1d237da5b007808711818e47a4c810e565b3a0d2368497ca9a5fa939ec2f329c
Contents?: true
Size: 1.84 KB
Versions: 21
Compression:
Stored size: 1.84 KB
Contents
module OrigenTesters module SmartestBasedTester class Base class TestMethods class Limits attr_reader :test_method attr_accessor :lo_limit, :hi_limit attr_accessor :unit attr_accessor :tnum alias_method :lo, :lo_limit alias_method :lo=, :lo_limit= alias_method :hi, :hi_limit alias_method :hi=, :hi_limit= def initialize(test_method) @test_method = test_method @tnum = '' end def unit=(val) case val.to_s.downcase when 'v', 'volts' @unit = 'V' when 'a', 'amps' @unit = 'A' else fail "Limit unit of #{val} not implemented yet!" end end def to_s if !lo_limit && !hi_limit if tnum == '' "\"#{test_name}\"" + ' = "":"NA":"":"NA":"":"":""' else "\"#{test_name}\"" + " = \"\":\"NA\":\"\":\"NA\":\"\":\"#{tnum}\":\"0\"" end elsif !lo_limit "\"#{test_name}\"" + " = \"\":\"NA\":\"#{hi_limit}\":\"LE\":\"#{unit}\":\"#{tnum}\":\"0\"" elsif !hi_limit "\"#{test_name}\"" + " = \"#{lo_limit}\":\"GE\":\"\":\"NA\":\"#{unit}\":\"#{tnum}\":\"0\"" else "\"#{test_name}\"" + " = \"#{lo_limit}\":\"GE\":\"#{hi_limit}\":\"LE\":\"#{unit}\":\"#{tnum}\":\"0\"" end end def set_lo_limit(val) self.lo_limit = val end def set_hi_limit(val) self.hi_limit = val end private def test_name name = test_method.test_name if test_method.respond_to?(:test_name) name || 'Functional' end end end end end end
Version data entries
21 entries across 21 versions & 1 rubygems