Sha256: 6b2ce157c4f8b6828556d57dc7d41c2bb4aed1a96365504a5d1ef2ea312692db

Contents?: true

Size: 1.46 KB

Versions: 19

Compression:

Stored size: 1.46 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

          def initialize(test_method)
            @test_method = test_method
          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
              "\"#{test_name}\"" + ' = "":"NA":"":"NA":"":"":""'
            elsif !lo_limit
              "\"#{test_name}\"" + " = \"\":\"NA\":\"#{hi_limit}\":\"LE\":\"#{unit}\":\"\":\"0\""
            elsif !hi_limit
              "\"#{test_name}\"" + " = \"#{lo_limit}\":\"GE\":\"\":\"NA\":\"#{unit}\":\"\":\"0\""
            else
              "\"#{test_name}\"" + " = \"#{lo_limit}\":\"GE\":\"#{hi_limit}\":\"LE\":\"#{unit}\":\"\":\"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

19 entries across 19 versions & 1 rubygems

Version Path
origen_testers-0.7.7 lib/origen_testers/smartest_based_tester/base/test_methods/limits.rb
origen_testers-0.7.6 lib/origen_testers/smartest_based_tester/base/test_methods/limits.rb
origen_testers-0.7.5 lib/origen_testers/smartest_based_tester/base/test_methods/limits.rb
origen_testers-0.7.4 lib/origen_testers/smartest_based_tester/base/test_methods/limits.rb
origen_testers-0.7.3 lib/origen_testers/smartest_based_tester/base/test_methods/limits.rb
origen_testers-0.7.2 lib/origen_testers/smartest_based_tester/base/test_methods/limits.rb
origen_testers-0.7.1 lib/origen_testers/smartest_based_tester/base/test_methods/limits.rb
origen_testers-0.7.0 lib/origen_testers/smartest_based_tester/base/test_methods/limits.rb
origen_testers-0.7.0.pre0 lib/origen_testers/smartest_based_tester/base/test_methods/limits.rb
origen_testers-0.6.2 lib/origen_testers/smartest_based_tester/base/test_methods/limits.rb
origen_testers-0.6.1 lib/origen_testers/smartest_based_tester/base/test_methods/limits.rb
origen_testers-0.6.0 lib/origen_testers/smartest_based_tester/base/test_methods/limits.rb
origen_testers-0.5.7 lib/origen_testers/smartest_based_tester/base/test_methods/limits.rb
origen_testers-0.5.6 lib/origen_testers/smartest_based_tester/base/test_methods/limits.rb
origen_testers-0.5.5 lib/origen_testers/smartest_based_tester/base/test_methods/limits.rb
origen_testers-0.5.4 lib/origen_testers/smartest_based_tester/base/test_methods/limits.rb
origen_testers-0.5.3 lib/origen_testers/smartest_based_tester/base/test_methods/limits.rb
origen_testers-0.5.2 lib/origen_testers/smartest_based_tester/base/test_methods/limits.rb
origen_testers-0.5.1 lib/origen_testers/smartest_based_tester/base/test_methods/limits.rb