Search in sources :

Example 1 with DoubleLiteralNode

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

the class ParserTest method testParseDoubleWithExponent.

@Test
public void testParseDoubleWithExponent() {
    final DoubleLiteralNode _node;
    _node = ((DoubleLiteralNode) Parser.factory.source_("1.23412d29").parseExpression());
    assertEquals((st.gravel.support.jvm.SmalltalkFactory) DoubleLiteralNode.factory, (st.gravel.support.jvm.SmalltalkFactory) _node.factory());
    assertEquals((double) 1.23412e29d, (double) _node.value(), (double) 0.000000001f);
}
Also used : DoubleLiteralNode(st.gravel.support.compiler.ast.DoubleLiteralNode) Test(org.junit.Test)

Example 2 with DoubleLiteralNode

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

the class ParserTest method testParseDoubleWithExponent2.

@Test
public void testParseDoubleWithExponent2() {
    final DoubleLiteralNode _node;
    _node = ((DoubleLiteralNode) Parser.factory.source_("1d10").parseExpression());
    assertEquals((st.gravel.support.jvm.SmalltalkFactory) DoubleLiteralNode.factory, (st.gravel.support.jvm.SmalltalkFactory) _node.factory());
    assertEquals((double) 1.0e10d, (double) _node.value(), (double) 0.000000001f);
}
Also used : DoubleLiteralNode(st.gravel.support.compiler.ast.DoubleLiteralNode) Test(org.junit.Test)

Example 3 with DoubleLiteralNode

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

the class ParserTest method testParseDouble.

@Test
public void testParseDouble() {
    final DoubleLiteralNode _node;
    _node = ((DoubleLiteralNode) Parser.factory.source_("123412341345145145123412341234.003213123123d").parseExpression());
    assertEquals((st.gravel.support.jvm.SmalltalkFactory) DoubleLiteralNode.factory, (st.gravel.support.jvm.SmalltalkFactory) _node.factory());
    assertEquals((double) 1.2341234134515e29d, (double) _node.value(), (double) 1.0e16f);
}
Also used : DoubleLiteralNode(st.gravel.support.compiler.ast.DoubleLiteralNode) Test(org.junit.Test)

Example 4 with DoubleLiteralNode

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

the class ParserTest method testParseDoubleWithExponent3.

@Test
public void testParseDoubleWithExponent3() {
    final DoubleLiteralNode _node;
    _node = ((DoubleLiteralNode) Parser.factory.source_("1d-10").parseExpression());
    assertEquals((st.gravel.support.jvm.SmalltalkFactory) DoubleLiteralNode.factory, (st.gravel.support.jvm.SmalltalkFactory) _node.factory());
    assertEquals((double) 1.0e-10d, (double) _node.value(), (double) 0.000000001f);
}
Also used : DoubleLiteralNode(st.gravel.support.compiler.ast.DoubleLiteralNode) Test(org.junit.Test)

Example 5 with DoubleLiteralNode

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

the class ParserTest method testParseDouble2.

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

Aggregations

Test (org.junit.Test)5 DoubleLiteralNode (st.gravel.support.compiler.ast.DoubleLiteralNode)5