Examples of GoLiteralInteger


Examples of ro.redeul.google.go.lang.psi.expressions.literals.GoLiteralInteger

        GoVarDeclaration[] declarations =
                childAt(0,
                        file.getGlobalVariables()
                ).getDeclarations();

        GoLiteralInteger integer;

        // x
        integer =
                getAs(GoLiteralInteger.class,
                        getAs(GoLiteralExpression.class,
                                childAt(0,
                                        declarations[0].getExpressions()
                                )
                        ).getLiteral()
                );

        assertEquals(GoLiteral.Type.Int, integer.getType());
        assertEquals(BigInteger.valueOf(10), integer.getValue());

        // y
        integer =
                getAs(GoLiteralInteger.class,
                        getAs(GoLiteralExpression.class,
                                childAt(0,
                                        declarations[1].getExpressions()
                                )
                        ).getLiteral()
                );
        assertEquals(GoLiteral.Type.Int, integer.getType());
        assertEquals(BigInteger.ZERO, integer.getValue());

        // z
        integer =
                getAs(GoLiteralInteger.class,
                        getAs(GoLiteralExpression.class,
                                childAt(0,
                                        declarations[2].getExpressions()
                                )
                        ).getLiteral()
                );
        assertEquals(GoLiteral.Type.Int, integer.getType());
        assertEquals(BigInteger.valueOf(0120), integer.getValue());

        // h1
        integer =
                getAs(GoLiteralInteger.class,
                        getAs(GoLiteralExpression.class,
                                childAt(0,
                                        declarations[3].getExpressions()
                                )
                        ).getLiteral()
                );
        assertEquals(GoLiteral.Type.Int, integer.getType());
        assertEquals(BigInteger.valueOf(0xEF), integer.getValue());

        // h1
        integer =
                getAs(GoLiteralInteger.class,
                        getAs(GoLiteralExpression.class,
                                childAt(0,
                                        declarations[4].getExpressions()
                                )
                        ).getLiteral()
                );
        assertEquals(GoLiteral.Type.Int, integer.getType());
        assertEquals(BigInteger.valueOf(0xAB), integer.getValue());

    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.