Sha256: 547f724b3d4a6458715dce2684089c82993a12a0d329e028131a3e1c482b8ad5

Contents?: true

Size: 980 Bytes

Versions: 5

Compression:

Stored size: 980 Bytes

Contents

require File.expand_path(File.join(File.dirname(__FILE__), '..', 'test_helper.rb'))

class FloatLiteralTest < Test::Unit::TestCase

  def setup
    @parser = Sexpistol.new
  end

  test "should parse sexp containing an implicitly positive float literal" do
    ast = @parser.parse_string("10.00")
    assert_equal [10.00], ast
  end
  
  test "should parse sexp containing an explicitly positive float literal" do
    ast = @parser.parse_string("+910.00")
    assert_equal [910.00], ast
  end
  
  test "should parse sexp containing an explicitly negative float literal" do
    ast = @parser.parse_string("-10.00")
    assert_equal [-10.00], ast
  end
  
  test "should parse sexp containing a large float literal" do
    ast = @parser.parse_string("1.0000127829")
    assert_equal [1.0000127829], ast
  end
  
  test "should parse sexp containing a float defined in scientific notation" do
    ast = @parser.parse_string("1.0e6")
    assert_equal [1.0e6], ast
  end
    
    
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
sexpistol-0.0.6 test/unit/float_literal_test.rb
sexpistol-0.0.5 test/unit/float_literal_test.rb
sexpistol-0.0.4 test/unit/float_literal_test.rb
sexpistol-0.0.3 test/unit/float_literal_test.rb
sexpistol-0.0.2 test/unit/float_literal_test.rb