From 36e56fa66e80e99f0622008f1dac2909c0584b09 Mon Sep 17 00:00:00 2001 From: Bruder John Date: Mon, 1 Jul 2024 12:58:24 +0200 Subject: [PATCH] added some tests --- .../CompareBoolInt.java | 13 ++++++++++ .../CorrectMemberAccess.java | 19 ++++++++++++++ .../CorrectNonCalcTest.java | 12 +++++++++ .../input/typedAstFeaturesTests/FullTest.java | 25 +++++++++++++++++++ 4 files changed, 69 insertions(+) create mode 100644 src/test/resources/input/typedAstExceptionsTests/CompareBoolInt.java create mode 100644 src/test/resources/input/typedAstFeaturesTests/CorrectMemberAccess.java create mode 100644 src/test/resources/input/typedAstFeaturesTests/CorrectNonCalcTest.java create mode 100644 src/test/resources/input/typedAstFeaturesTests/FullTest.java diff --git a/src/test/resources/input/typedAstExceptionsTests/CompareBoolInt.java b/src/test/resources/input/typedAstExceptionsTests/CompareBoolInt.java new file mode 100644 index 0000000..1eb080a --- /dev/null +++ b/src/test/resources/input/typedAstExceptionsTests/CompareBoolInt.java @@ -0,0 +1,13 @@ +// @expected: TypeMismatchException +public class Test{ + + public void test(boolean b){ + if(b == 2){ + + } else { + + } + + } + +} diff --git a/src/test/resources/input/typedAstFeaturesTests/CorrectMemberAccess.java b/src/test/resources/input/typedAstFeaturesTests/CorrectMemberAccess.java new file mode 100644 index 0000000..b9f3dbb --- /dev/null +++ b/src/test/resources/input/typedAstFeaturesTests/CorrectMemberAccess.java @@ -0,0 +1,19 @@ +public class Test{ + + public Car c; + + public int test(){ + return c.getSpeed(); + } + +} + +public class Car{ + + private int speed; + + public int getSpeed(){ + return speed; + } + +} \ No newline at end of file diff --git a/src/test/resources/input/typedAstFeaturesTests/CorrectNonCalcTest.java b/src/test/resources/input/typedAstFeaturesTests/CorrectNonCalcTest.java new file mode 100644 index 0000000..d78e926 --- /dev/null +++ b/src/test/resources/input/typedAstFeaturesTests/CorrectNonCalcTest.java @@ -0,0 +1,12 @@ +public class Test{ + + public void test(boolean b){ + if(b == true){ + + } else { + + } + + } + +} diff --git a/src/test/resources/input/typedAstFeaturesTests/FullTest.java b/src/test/resources/input/typedAstFeaturesTests/FullTest.java new file mode 100644 index 0000000..b2191b3 --- /dev/null +++ b/src/test/resources/input/typedAstFeaturesTests/FullTest.java @@ -0,0 +1,25 @@ + +public class Test { + + public Car c; + + public int test(boolean b, int x) { + if (b == true) { + return c.getSpeed(); + } else { + return x; + } + } + +} + +public class Car { + + private int speed; + + public int getSpeed() { + return speed; + } + +} +