Sha256: d5f283dfdc956e50c61ed520e7a508bb8f5f4cc809e62d0d8390f36531ffc220

Contents?: true

Size: 625 Bytes

Versions: 42

Compression:

Stored size: 625 Bytes

Contents

describe MK::Calculator do

  it 'should memoize' do
    c1 = MK::Calculator.scan('0')
    c2 = MK::Calculator.scan('0')
    c1.should == c2
  end

  {
    '100' => [0, 100],
    '+100' => [0, 100],
    '-100' => [0, -100],
    '1.5' => [0, 1.5],
    '-1.5' => [0, -1.5],

    '25%' => [0.25, 0],
    '100%' => [1, 0],

    '25% + 10' => [0.25, 10],
    '100% - 100' => [1, -100],
  }.each do |string, calc|
    it "Should handle #{string.inspect}" do
      factor = calc[0]
      constant = calc[1]
      c = MK::Calculator.scan(string)
      c.factor.should == factor
      c.constant.should == constant
    end
  end

end

Version data entries

42 entries across 36 versions & 1 rubygems

Version Path
motion-kit-1.1.1 spec/tvos/calculator_spec.rb
motion-kit-1.1.1 spec/ios/calculator_spec.rb
motion-kit-1.1.0 spec/tvos/calculator_spec.rb
motion-kit-1.1.0 spec/ios/calculator_spec.rb
motion-kit-1.0.3 spec/tvos/calculator_spec.rb
motion-kit-1.0.3 spec/ios/calculator_spec.rb
motion-kit-1.0.2 spec/ios/calculator_spec.rb
motion-kit-1.0.2 spec/tvos/calculator_spec.rb
motion-kit-1.0.1 spec/ios/calculator_spec.rb
motion-kit-1.0.1 spec/tvos/calculator_spec.rb
motion-kit-1.0.0 spec/tvos/calculator_spec.rb
motion-kit-1.0.0 spec/ios/calculator_spec.rb
motion-kit-0.18.0 spec/ios/calculator_spec.rb
motion-kit-0.17.0 spec/ios/calculator_spec.rb
motion-kit-0.16.0 spec/ios/calculator_spec.rb
motion-kit-0.15.0 spec/ios/calculator_spec.rb
motion-kit-0.14.2 spec/ios/calculator_spec.rb
motion-kit-0.14.1 spec/ios/calculator_spec.rb
motion-kit-0.14.0 spec/ios/calculator_spec.rb
motion-kit-0.13.0 spec/ios/calculator_spec.rb