Search in sources :

Example 1 with FloatLiteralNode

use of st.gravel.support.compiler.ast.FloatLiteralNode in project gravel by gravel-st.

the class ParserTest method testParseFloat2.

@Test
public void testParseFloat2() {
    final FloatLiteralNode _node;
    _node = ((FloatLiteralNode) Parser.factory.source_("3.0.").parseExpression());
    assertEquals((st.gravel.support.jvm.SmalltalkFactory) FloatLiteralNode.factory, (st.gravel.support.jvm.SmalltalkFactory) _node.factory());
    assertEquals((float) 3.0f, (float) _node.value(), (float) 0.000000001f);
}
Also used : FloatLiteralNode(st.gravel.support.compiler.ast.FloatLiteralNode) Test(org.junit.Test)

Example 2 with FloatLiteralNode

use of st.gravel.support.compiler.ast.FloatLiteralNode in project gravel by gravel-st.

the class ParserTest method testParseFloatWithNegativeExponent.

@Test
public void testParseFloatWithNegativeExponent() {
    final FloatLiteralNode _node;
    _node = ((FloatLiteralNode) Parser.factory.source_("1.23412e-29").parseExpression());
    assertEquals((st.gravel.support.jvm.SmalltalkFactory) FloatLiteralNode.factory, (st.gravel.support.jvm.SmalltalkFactory) _node.factory());
    assertEquals((float) 1.23412e-29f, (float) _node.value(), (float) 0.000000001f);
}
Also used : FloatLiteralNode(st.gravel.support.compiler.ast.FloatLiteralNode) Test(org.junit.Test)

Example 3 with FloatLiteralNode

use of st.gravel.support.compiler.ast.FloatLiteralNode in project gravel by gravel-st.

the class ParserTest method testParseFloat.

@Test
public void testParseFloat() {
    final FloatLiteralNode _node;
    _node = ((FloatLiteralNode) Parser.factory.source_("123412341345145145123412341234.003213123123").parseExpression());
    assertEquals((st.gravel.support.jvm.SmalltalkFactory) FloatLiteralNode.factory, (st.gravel.support.jvm.SmalltalkFactory) _node.factory());
    assertEquals((float) 123412341345145145123412341234.003213123123f, (float) _node.value(), (float) 0.000000001f);
}
Also used : FloatLiteralNode(st.gravel.support.compiler.ast.FloatLiteralNode) Test(org.junit.Test)

Example 4 with FloatLiteralNode

use of st.gravel.support.compiler.ast.FloatLiteralNode in project gravel by gravel-st.

the class ParserTest method testParseFloatWithExponent.

@Test
public void testParseFloatWithExponent() {
    final FloatLiteralNode _node;
    _node = ((FloatLiteralNode) Parser.factory.source_("1.23412e29").parseExpression());
    assertEquals((st.gravel.support.jvm.SmalltalkFactory) FloatLiteralNode.factory, (st.gravel.support.jvm.SmalltalkFactory) _node.factory());
    assertEquals((float) 1.23412e29f, (float) _node.value(), (float) 0.000000001f);
}
Also used : FloatLiteralNode(st.gravel.support.compiler.ast.FloatLiteralNode) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)4 FloatLiteralNode (st.gravel.support.compiler.ast.FloatLiteralNode)4