Sha256: bd8d2d4d7bcc0ebd0ac06de7898429d9e5ebed6866796f6ce6df3a23bee3893b

Contents?: true

Size: 1.15 KB

Versions: 2

Compression:

Stored size: 1.15 KB

Contents

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

class FloatLiteralTest < Test::Unit::TestCase

  def setup
    @parser = Bracer.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

2 entries across 2 versions & 1 rubygems

Version Path
bracer-0.0.2 test/unit/float_literal_test.rb
bracer-0.0.1 test/unit/float_literal_test.rb