From 60c2d3ea8844f671bf11ea2276ea840c6256caf0 Mon Sep 17 00:00:00 2001 From: cozis Date: Wed, 7 Dec 2022 18:45:22 +0100 Subject: [PATCH] updated compiler testcases --- tests/suite/Testcase_011_005 | 12 +--------- tests/suite/Testcase_011_006 | 12 +--------- tests/suite/Testcase_011_007 | 12 +--------- tests/suite/Testcase_011_008 | 24 ++------------------ tests/suite/Testcase_011_009 | 44 ++++-------------------------------- tests/suite/Testcase_012_003 | 13 +---------- 6 files changed, 10 insertions(+), 107 deletions(-) diff --git a/tests/suite/Testcase_011_005 b/tests/suite/Testcase_011_005 index 63ff9a0..27f8e4f 100644 --- a/tests/suite/Testcase_011_005 +++ b/tests/suite/Testcase_011_005 @@ -12,18 +12,8 @@ POP 1; JUMP end; fun: - PUSHTYP; PUSHVAR "None"; - PUSHTYP; - PUSHTYPTYP; - EQL; - JUMPIFNOTANDPOP arg_annot_not_type; - EQL; - JUMPIFANDPOP arg_ok; - ERROR "Bad type for argument 0"; -arg_annot_not_type: - ERROR "Argument 0 type annotation 0 is not a type"; -arg_ok: + CHECKTYPE 0, "a"; ASS "a"; POP 1; PUSHVAR "a"; diff --git a/tests/suite/Testcase_011_006 b/tests/suite/Testcase_011_006 index 0694ff6..f7214b3 100644 --- a/tests/suite/Testcase_011_006 +++ b/tests/suite/Testcase_011_006 @@ -14,18 +14,8 @@ fun: ASS "b"; POP 1; - PUSHTYP; PUSHVAR "int"; - PUSHTYP; - PUSHTYPTYP; - EQL; - JUMPIFNOTANDPOP arg0_annot0_bad; - EQL; - JUMPIFANDPOP arg_ok; - ERROR "Bad type for argument 0"; -arg0_annot0_bad: - ERROR "Argument 0 type annotation 0 is not a type"; -arg_ok: + CHECKTYPE 0, "a"; ASS "a"; POP 1; PUSHVAR "a"; diff --git a/tests/suite/Testcase_011_007 b/tests/suite/Testcase_011_007 index 4de2f81..e942aea 100644 --- a/tests/suite/Testcase_011_007 +++ b/tests/suite/Testcase_011_007 @@ -12,18 +12,8 @@ POP 1; JUMP end; fun: - PUSHTYP; PUSHVAR "int"; - PUSHTYP; - PUSHTYPTYP; - EQL; - JUMPIFNOTANDPOP annot_bad; - EQL; - JUMPIFANDPOP arg_ok; - ERROR "Bad type for argument 1"; -annot_bad: - ERROR "Argument 1 type annotation 0 is not a type"; -arg_ok: + CHECKTYPE 1, "b"; ASS "b"; POP 1; ASS "a"; diff --git a/tests/suite/Testcase_011_008 b/tests/suite/Testcase_011_008 index 4e446a9..47b403c 100644 --- a/tests/suite/Testcase_011_008 +++ b/tests/suite/Testcase_011_008 @@ -12,32 +12,12 @@ POP 1; JUMP end; fun: - PUSHTYP; PUSHVAR "int"; - PUSHTYP; - PUSHTYPTYP; - EQL; - JUMPIFNOTANDPOP arg1_annot0_not_type; - EQL; - JUMPIFANDPOP arg1_ok; - ERROR "Bad type for argument 1"; -arg1_annot0_not_type: - ERROR "Argument 1 type annotation 0 is not a type"; -arg1_ok: + CHECKTYPE 1, "b"; ASS "b"; POP 1; - PUSHTYP; PUSHVAR "int"; - PUSHTYP; - PUSHTYPTYP; - EQL; - JUMPIFNOTANDPOP arg0_annot0_not_type; - EQL; - JUMPIFANDPOP arg0_ok; - ERROR "Bad type for argument 0"; -arg0_annot0_not_type: - ERROR "Argument 0 type annotation 0 is not a type"; -arg0_ok: + CHECKTYPE 0, "a"; ASS "a"; POP 1; PUSHVAR "a"; diff --git a/tests/suite/Testcase_011_009 b/tests/suite/Testcase_011_009 index 00ef23f..aabe61a 100644 --- a/tests/suite/Testcase_011_009 +++ b/tests/suite/Testcase_011_009 @@ -12,52 +12,16 @@ POP 1; JUMP end; fun: - PUSHTYP; PUSHVAR "bool"; - PUSHTYP; - PUSHTYPTYP; - EQL; - JUMPIFNOTANDPOP arg1_annot0_bad; - EQL; - JUMPIFANDPOP arg1_ok; - PUSHTYP; PUSHVAR "Map"; - PUSHTYP; - PUSHTYPTYP; - EQL; - JUMPIFNOTANDPOP arg1_annot1_bad; - EQL; - JUMPIFANDPOP arg1_ok; - ERROR "Bad type for argument 1"; -arg1_annot0_bad: - ERROR "Argument 1 type annotation 0 is not a type"; -arg1_annot1_bad: - ERROR "Argument 1 type annotation 1 is not a type"; -arg1_ok: + STP; + CHECKTYPE 1, "b"; ASS "b"; POP 1; - PUSHTYP; PUSHVAR "int"; - PUSHTYP; - PUSHTYPTYP; - EQL; - JUMPIFNOTANDPOP arg0_annot0_bad; - EQL; - JUMPIFANDPOP arg0_ok; - PUSHTYP; PUSHVAR "float"; - PUSHTYP; - PUSHTYPTYP; - EQL; - JUMPIFNOTANDPOP arg0_annot1_bad; - EQL; - JUMPIFANDPOP arg0_ok; - ERROR "Bad type for argument 0"; -arg0_annot0_bad: - ERROR "Argument 0 type annotation 0 is not a type"; -arg0_annot1_bad: - ERROR "Argument 0 type annotation 1 is not a type"; -arg0_ok: + STP; + CHECKTYPE 0, "a"; ASS "a"; POP 1; PUSHVAR "a"; diff --git a/tests/suite/Testcase_012_003 b/tests/suite/Testcase_012_003 index 73b180a..86e68e2 100644 --- a/tests/suite/Testcase_012_003 +++ b/tests/suite/Testcase_012_003 @@ -18,19 +18,8 @@ nop: POP 1; PUSHINT 1; not_none: - - PUSHTYP; PUSHVAR "int"; - PUSHTYP; - PUSHTYPTYP; - EQL; - JUMPIFNOTANDPOP annot_not_ok; - EQL; - JUMPIFANDPOP type_ok; - ERROR "Bad type for argument 0"; -annot_not_ok: - ERROR "Argument 0 type annotation 0 is not a type"; -type_ok: + CHECKTYPE 0, "a"; ASS "a"; POP 1; RETURN 0;