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