spec/evaluator_spec.rb in dentaku-1.2.3 vs spec/evaluator_spec.rb in dentaku-1.2.4
- old
+ new
@@ -44,9 +44,10 @@
it 'supports unary minus' do
expect(evaluator.evaluate(token_stream(:subtract, 1))).to eq(-1)
expect(evaluator.evaluate(token_stream(1, :subtract, :subtract, 1))).to eq(2)
expect(evaluator.evaluate(token_stream(1, :subtract, :subtract, :subtract, 1))).to eq(0)
expect(evaluator.evaluate(token_stream(:subtract, 1, :add, 1))).to eq(0)
+ expect(evaluator.evaluate(token_stream(3, :add, 0, :multiply, :subtract, 3))).to eq(3)
end
it 'evaluates a number multiplied by an exponent' do
expect(evaluator.evaluate(token_stream(10, :pow, 2))).to eq(100)
expect(evaluator.evaluate(token_stream(0, :multiply, 10, :pow, 5))).to eq(0)