test/render_test.rb in cast-0.2.1 vs test/render_test.rb in cast-0.3.0
- old
+ new
@@ -4,11 +4,11 @@
#
######################################################################
require 'test_helper'
-class RenderTest < Test::Unit::TestCase
+class RenderTest < Minitest::Test
def setup
@parser = C::Parser.new
@parser.type_names << 'T'
end
@@ -627,11 +627,11 @@
end
# ------------------------------------------------------------------
# PlainLabel
# ------------------------------------------------------------------
-
+
def test_plain_label
check(C::PlainLabel, <<-EOS)
|one:
EOS
end
@@ -657,11 +657,11 @@
end
# ------------------------------------------------------------------
# Comma
# ------------------------------------------------------------------
-
+
def test_comma_two_expressions
check(C::Comma, <<-EOS)
|1, 2
EOS
end
@@ -841,11 +841,11 @@
end
# ------------------------------------------------------------------
# Cast
# ------------------------------------------------------------------
-
+
def test_cast
check(C::Cast, <<-EOS)
|(int)a
EOS
end
@@ -1709,10 +1709,25 @@
def test_int_literal_small
check(C::IntLiteral, <<-EOS)
|1
EOS
end
+ def test_int_literal_oct
+ check(C::IntLiteral, <<-EOS)
+ |010
+ EOS
+ end
+ def test_int_literal_hex
+ check(C::IntLiteral, <<-EOS)
+ |0x10
+ EOS
+ end
+ def test_int_literal_suffix
+ check(C::IntLiteral, <<-EOS)
+ |1L
+ EOS
+ end
# TODO: handle big ints -- this test fails
def xtest_int_literal_big
check(C::IntLiteral, <<-EOS)
|10000000000
EOS
@@ -1725,9 +1740,24 @@
# TODO: handle precisions properly -- probably need to store string,
# or integer,mantissa,exponent separately
def test_float_literal
check(C::FloatLiteral, <<-EOS)
|1.0
+ EOS
+ end
+ def test_float_literal_exponent
+ check(C::FloatLiteral, <<-EOS)
+ |1.23e45
+ EOS
+ end
+ def test_float_literal_suffix
+ check(C::FloatLiteral, <<-EOS)
+ |1.0f
+ EOS
+ end
+ def test_float_literal_hex_exponent
+ check(C::FloatLiteral, <<-EOS)
+ |0x12.abp3
EOS
end
def test_float_literal_precise
check(C::FloatLiteral, <<-EOS)
|1.0000000001