Sha256: 35f632f9156ecc5b329297bcf2cce6ed4e15800f6fa8f33197a03cb71d46e2f5

Contents?: true

Size: 1.16 KB

Versions: 3

Compression:

Stored size: 1.16 KB

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
  
  test "should parse sexp containing a float defined in scientific notation with no decimal place" do
    ast = @parser.parse_string("(10e2)")
    assert_equal [[10e2]], ast
  end
    
    
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
deil_sexpistol-0.0.9 test/unit/float_literal_test.rb
deil_sexpistol-0.0.8 test/unit/float_literal_test.rb
sexpistol-0.0.7 test/unit/float_literal_test.rb