From 88a5528070de668f7d7f00cb35ae585a9bbb1361 Mon Sep 17 00:00:00 2001 From: "Tristan B. Kildaire" Date: Sat, 20 Mar 2021 18:41:35 +0200 Subject: [PATCH] Updated test cases for testing if-statement parsing --- source/tlang/testing/basic1.t | 15 +++ source/tlang/testing/else_without_if.pl | 155 ++++++++++++++++++++++++ 2 files changed, 170 insertions(+) create mode 100644 source/tlang/testing/else_without_if.pl diff --git a/source/tlang/testing/basic1.t b/source/tlang/testing/basic1.t index e3a01d4..413d2c1 100644 --- a/source/tlang/testing/basic1.t +++ b/source/tlang/testing/basic1.t @@ -48,6 +48,21 @@ class clazz_2_1 print("Bhjkfd"); } + if(1) + { + print("Hello"); + } + else if(1) + { + print("Bruh"); + } + else + { + print("Bhjkfd"); + } + + + } diff --git a/source/tlang/testing/else_without_if.pl b/source/tlang/testing/else_without_if.pl new file mode 100644 index 0000000..6112cef --- /dev/null +++ b/source/tlang/testing/else_without_if.pl @@ -0,0 +1,155 @@ +int x; +ubyte y; + +ubyte k = 1; + +class clazz1 +{ + print("Hello world"); +} + +class clazz_2_1 +{ + class clazz_2_2 + { + class clazz_2_2_1 + { + + } + } + + class clazz_2_3 + { + class clazz_2_3_1 + { + if(1) + { + print("Hello"); + } + else if(1) + { + print("Bruh"); + } + else + { + print("Bhjkfd"); + } + + if(1) + { + print("Hello"); + } + else if(1) + { + print("Bruh"); + } + else + { + print("Bhjkfd"); + } + + if(1) + { + print("Hello"); + } + else + { + print("Bruh"); + } + + else if(1) + { + print("Bhjkfd"); + } + + + + } + + print("Hello"); + } +} + + +void main(int hello, byte d) +{ + ubyte thing = "Hello"; + print("Hello world"); + print(1+1); + print(1+1); + + ubyte eish = 1+1; + + ubyte poes = ((1+1)); + + if(1+1) + { + if(1) + { + if((1)) + { + print("Hello"); + } + print("Hello"); + } + } + + if(((2))) + { + print(1+1); + } + + if(2+222222/2) + { + while(1) + { + while(2+2) + { + + } + } + } +} + +void k(int j, int k) +{ + ubyte thing = "Hello"; + print("Hello world"); + print(1+1); + print(1+1); + + ubyte eish = 1+1; + + ubyte poes = ((1+1)); + + if(1+1) + { + if(1) + { + if((1)) + { + print("Hello"); + } + print("Hello"); + } + } + + if(((2))) + { + print(1+1); + } + + if(2+222222/2) + { + while(1) + { + while(2+2) + { + + } + } + } +} + + +