Sha256: 9058604644be18e36ca986dd7d27a4b7debbfb29af82571d1021db4969e2b0e3
Contents?: true
Size: 909 Bytes
Versions: 1
Compression:
Stored size: 909 Bytes
Contents
require 'test/unit' require 'rockit/dparser' require 'calculator/multifunc_calculator' require File.join(File.dirname(__FILE__), "calc_tests_common") class ATestSamplesMultiFuncCalc < Test::Unit::TestCase include CalcTestsCommon def setup @grammar = Samples::MultiFuncCalcGrammar @calculator = Samples::MultiFuncCalculator.new end def test_10_eval assert_calc(8, "2^3") # The calculator is the same between successive calls to assert_calc so # the variables should retain their values assert_calc(1, "a = 1") assert_calc(-2, "b=-2") assert_calc(-1, "a+b") assert_calc(-97, "c = (3 - 100)") assert_calc(-2*-97+(4*1), "(b*c)+(4*a)") assert_calc(Math.log(2), "ln(2)") end def test_11_exponentiation_is_right_associative assert_calc(2**(3**3), "2^3^3") end def test_12_precedence_and_associativity assert_calc(15, "1+2*3^2-4") end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rockit-0.7.1 | tests/acceptance/rockit/dparser/atest_samples_multifunccalculator.rb |