From e35d7b64dc82864b88e7fe8041e1efd69aed144a Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Wed, 5 Jul 2023 21:12:54 +0100 Subject: Parse positive ints --- .../shedlang/compiler/ast/untyped/UntypedNodeMatchers.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/test/java/org/shedlang/compiler/ast') diff --git a/src/test/java/org/shedlang/compiler/ast/untyped/UntypedNodeMatchers.java b/src/test/java/org/shedlang/compiler/ast/untyped/UntypedNodeMatchers.java index a848b601..acddc159 100644 --- a/src/test/java/org/shedlang/compiler/ast/untyped/UntypedNodeMatchers.java +++ b/src/test/java/org/shedlang/compiler/ast/untyped/UntypedNodeMatchers.java @@ -2,6 +2,8 @@ package org.shedlang.compiler.ast.untyped; import org.zwobble.precisely.Matcher; +import java.math.BigInteger; + import static org.zwobble.precisely.Matchers.*; public class UntypedNodeMatchers { @@ -29,6 +31,17 @@ public class UntypedNodeMatchers { return UntypedFunctionDefinitionNodeMatcher.empty(); } + public static Matcher isUntypedIntLiteralNode(int value) { + return isUntypedIntLiteralNode(BigInteger.valueOf(value)); + } + + public static Matcher isUntypedIntLiteralNode(BigInteger value) { + return instanceOf( + UntypedIntLiteralNode.class, + has("value", x -> x.value(), equalTo(value)) + ); + } + public static Matcher isUntypedNamedArgNode( String name, Matcher expression -- cgit v1.2.3