From e0926d87b7d4097d559abb9b7ff9098f2645e532 Mon Sep 17 00:00:00 2001 From: Johanna Stuber Date: Fri, 5 Feb 2021 11:37:45 +0100 Subject: [PATCH] fix lambda parser test --- .../model/parser/LambdaParserTest.java | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/test/java/edu/kit/typicalc/model/parser/LambdaParserTest.java b/src/test/java/edu/kit/typicalc/model/parser/LambdaParserTest.java index 3897422..4853b8e 100644 --- a/src/test/java/edu/kit/typicalc/model/parser/LambdaParserTest.java +++ b/src/test/java/edu/kit/typicalc/model/parser/LambdaParserTest.java @@ -1,19 +1,13 @@ package edu.kit.typicalc.model.parser; -import static org.junit.jupiter.api.Assertions.assertEquals; - -import edu.kit.typicalc.model.term.AbsTerm; -import edu.kit.typicalc.model.term.AppTerm; -import edu.kit.typicalc.model.term.BooleanTerm; -import edu.kit.typicalc.model.term.IntegerTerm; -import edu.kit.typicalc.model.term.LambdaTerm; -import edu.kit.typicalc.model.term.LetTerm; -import edu.kit.typicalc.model.term.VarTerm; import edu.kit.typicalc.model.parser.Token.TokenType; +import edu.kit.typicalc.model.term.*; import edu.kit.typicalc.util.Result; import nl.jqno.equalsverifier.EqualsVerifier; import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; + class LambdaParserTest { private static final VarTerm X = new VarTerm("x"); @@ -22,9 +16,9 @@ class LambdaParserTest { LambdaParser parser = new LambdaParser("x"); Result term = parser.parse(); assertEquals(new VarTerm("x"), term.unwrap()); - parser = new LambdaParser("β1 α1"); + parser = new LambdaParser("b1 a1"); term = parser.parse(); - assertEquals(new AppTerm(new VarTerm("β1"), new VarTerm("α1")), term.unwrap()); + assertEquals(new AppTerm(new VarTerm("b1"), new VarTerm("a1")), term.unwrap()); } @Test void absTerm() { @@ -106,6 +100,10 @@ class LambdaParserTest { assertEquals(new Token(TokenType.RIGHT_PARENTHESIS, ")", 1), error.getCause()); parser = new LambdaParser("??"); assertEquals(ParseError.UNEXPECTED_CHARACTER, parser.parse().unwrapError()); + parser = new LambdaParser("aλ"); + assertEquals(ParseError.UNEXPECTED_CHARACTER, parser.parse().unwrapError()); + parser = new LambdaParser("ä"); + assertEquals(ParseError.UNEXPECTED_CHARACTER, parser.parse().unwrapError()); parser = new LambdaParser("123333333333333"); assertEquals(ParseError.UNEXPECTED_CHARACTER, parser.parse().unwrapError()); parser = new LambdaParser("x 123333333333333");