diff options
Diffstat (limited to 'tests/iii')
60 files changed, 270 insertions, 0 deletions
diff --git a/tests/iii/class-private-case/case.json b/tests/iii/class-private-case/case.json new file mode 100644 index 0000000..6d425cd --- /dev/null +++ b/tests/iii/class-private-case/case.json @@ -0,0 +1,8 @@ +{ + "errors": [ + { + "reason": "Cannot\\ access\\ private\\ field\\ hIDDEN\\ of\\ type\\ Box", + "line": 5 + } + ] +} diff --git a/tests/iii/class-private-case/notes.md b/tests/iii/class-private-case/notes.md new file mode 100644 index 0000000..0eff0da --- /dev/null +++ b/tests/iii/class-private-case/notes.md @@ -0,0 +1,3 @@ +# class-private-case + +The compiler must reject this program: Cannot access private field hIDDEN of type Box. The diagnostic must identify line 5; compilation must preserve existing output. diff --git a/tests/iii/class-private-case/program.cps b/tests/iii/class-private-case/program.cps new file mode 100644 index 0000000..9ba8e02 --- /dev/null +++ b/tests/iii/class-private-case/program.cps @@ -0,0 +1,5 @@ +CLASS Box + PRIVATE Hidden : INTEGER +ENDCLASS +DECLARE Item : Box +OUTPUT item.hIDDEN diff --git a/tests/iii/diagnostic-call-after-arguments/case.json b/tests/iii/diagnostic-call-after-arguments/case.json new file mode 100644 index 0000000..2b00e17 --- /dev/null +++ b/tests/iii/diagnostic-call-after-arguments/case.json @@ -0,0 +1,8 @@ +{ + "errors": [ + { + "reason": "BYREF\\ argument\\ to\\ Change\\ must\\ be\\ a\\ variable", + "line": 3 + } + ] +} diff --git a/tests/iii/diagnostic-call-after-arguments/notes.md b/tests/iii/diagnostic-call-after-arguments/notes.md new file mode 100644 index 0000000..9011f61 --- /dev/null +++ b/tests/iii/diagnostic-call-after-arguments/notes.md @@ -0,0 +1,3 @@ +# diagnostic-call-after-arguments + +The compiler must reject this program: BYREF argument to Change must be a variable. The diagnostic must identify line 3; compilation must preserve existing output. diff --git a/tests/iii/diagnostic-call-after-arguments/program.cps b/tests/iii/diagnostic-call-after-arguments/program.cps new file mode 100644 index 0000000..743a51c --- /dev/null +++ b/tests/iii/diagnostic-call-after-arguments/program.cps @@ -0,0 +1,5 @@ +PROCEDURE Change(BYVAL Text : STRING, BYREF Value : INTEGER) +ENDPROCEDURE +CALL Change( + LEFT("text", 2), + 1) diff --git a/tests/iii/diagnostic-multiline-name/case.json b/tests/iii/diagnostic-multiline-name/case.json new file mode 100644 index 0000000..e90b979 --- /dev/null +++ b/tests/iii/diagnostic-multiline-name/case.json @@ -0,0 +1,8 @@ +{ + "errors": [ + { + "reason": "Unknown\\ variable\\ name\\ Missing", + "line": 2 + } + ] +} diff --git a/tests/iii/diagnostic-multiline-name/notes.md b/tests/iii/diagnostic-multiline-name/notes.md new file mode 100644 index 0000000..28534c3 --- /dev/null +++ b/tests/iii/diagnostic-multiline-name/notes.md @@ -0,0 +1,3 @@ +# diagnostic-multiline-name + +The compiler must reject this program: Unknown variable name Missing. The diagnostic must identify line 2; compilation must preserve existing output. diff --git a/tests/iii/diagnostic-multiline-name/program.cps b/tests/iii/diagnostic-multiline-name/program.cps new file mode 100644 index 0000000..529dd9f --- /dev/null +++ b/tests/iii/diagnostic-multiline-name/program.cps @@ -0,0 +1,2 @@ +OUTPUT 1 + + Missing diff --git a/tests/iii/diagnostic-nested-call/case.json b/tests/iii/diagnostic-nested-call/case.json new file mode 100644 index 0000000..a00f88b --- /dev/null +++ b/tests/iii/diagnostic-nested-call/case.json @@ -0,0 +1,8 @@ +{ + "errors": [ + { + "reason": "MID\\ expects\\ 3\\ args", + "line": 2 + } + ] +} diff --git a/tests/iii/diagnostic-nested-call/notes.md b/tests/iii/diagnostic-nested-call/notes.md new file mode 100644 index 0000000..252dec7 --- /dev/null +++ b/tests/iii/diagnostic-nested-call/notes.md @@ -0,0 +1,3 @@ +# diagnostic-nested-call + +The compiler must reject this program: MID expects 3 args. The diagnostic must identify line 2; compilation must preserve existing output. diff --git a/tests/iii/diagnostic-nested-call/program.cps b/tests/iii/diagnostic-nested-call/program.cps new file mode 100644 index 0000000..0987bed --- /dev/null +++ b/tests/iii/diagnostic-nested-call/program.cps @@ -0,0 +1,3 @@ +OUTPUT LENGTH( + MID("text", 1) +) diff --git a/tests/iii/identifier-array-collision/case.json b/tests/iii/identifier-array-collision/case.json new file mode 100644 index 0000000..4bb0e66 --- /dev/null +++ b/tests/iii/identifier-array-collision/case.json @@ -0,0 +1,8 @@ +{ + "errors": [ + { + "reason": "Declaration\\ of\\ values\\ conflicts\\ with\\ an\\ existing\\ declaration\\ in\\ this\\ scope", + "line": 2 + } + ] +} diff --git a/tests/iii/identifier-array-collision/notes.md b/tests/iii/identifier-array-collision/notes.md new file mode 100644 index 0000000..e11a241 --- /dev/null +++ b/tests/iii/identifier-array-collision/notes.md @@ -0,0 +1,3 @@ +# identifier-array-collision + +Names differing only in ASCII case cannot introduce a separate symbol. Require Declaration of values conflicts with an existing declaration in this scope at line 2, a failed compilation, and preservation of any existing output. diff --git a/tests/iii/identifier-array-collision/program.cps b/tests/iii/identifier-array-collision/program.cps new file mode 100644 index 0000000..94a8083 --- /dev/null +++ b/tests/iii/identifier-array-collision/program.cps @@ -0,0 +1,2 @@ +DECLARE Values : ARRAY[1:2] OF INTEGER +DECLARE values : INTEGER diff --git a/tests/iii/identifier-builtin-collision/case.json b/tests/iii/identifier-builtin-collision/case.json new file mode 100644 index 0000000..df7c2b6 --- /dev/null +++ b/tests/iii/identifier-builtin-collision/case.json @@ -0,0 +1,8 @@ +{ + "errors": [ + { + "reason": "'lENGTH'\\ is\\ a\\ built\\-in\\ function\\ and\\ cannot\\ be\\ redefined", + "line": 1 + } + ] +} diff --git a/tests/iii/identifier-builtin-collision/notes.md b/tests/iii/identifier-builtin-collision/notes.md new file mode 100644 index 0000000..85b97fe --- /dev/null +++ b/tests/iii/identifier-builtin-collision/notes.md @@ -0,0 +1,3 @@ +# identifier-builtin-collision + +Names differing only in ASCII case cannot introduce a separate symbol. Require 'lENGTH' is a built-in function and cannot be redefined at line 1, a failed compilation, and preservation of any existing output. diff --git a/tests/iii/identifier-builtin-collision/program.cps b/tests/iii/identifier-builtin-collision/program.cps new file mode 100644 index 0000000..647aab9 --- /dev/null +++ b/tests/iii/identifier-builtin-collision/program.cps @@ -0,0 +1,3 @@ +FUNCTION lENGTH() RETURNS INTEGER + RETURN 1 +ENDFUNCTION diff --git a/tests/iii/identifier-constant-collision/case.json b/tests/iii/identifier-constant-collision/case.json new file mode 100644 index 0000000..bdb0040 --- /dev/null +++ b/tests/iii/identifier-constant-collision/case.json @@ -0,0 +1,8 @@ +{ + "errors": [ + { + "reason": "Declaration\\ of\\ lIMIT\\ conflicts\\ with\\ an\\ existing\\ declaration\\ in\\ this\\ scope", + "line": 2 + } + ] +} diff --git a/tests/iii/identifier-constant-collision/notes.md b/tests/iii/identifier-constant-collision/notes.md new file mode 100644 index 0000000..d5ea85e --- /dev/null +++ b/tests/iii/identifier-constant-collision/notes.md @@ -0,0 +1,3 @@ +# identifier-constant-collision + +Names differing only in ASCII case cannot introduce a separate symbol. Require Declaration of lIMIT conflicts with an existing declaration in this scope at line 2, a failed compilation, and preservation of any existing output. diff --git a/tests/iii/identifier-constant-collision/program.cps b/tests/iii/identifier-constant-collision/program.cps new file mode 100644 index 0000000..c202f59 --- /dev/null +++ b/tests/iii/identifier-constant-collision/program.cps @@ -0,0 +1,2 @@ +CONSTANT Limit = 3 +DECLARE lIMIT : INTEGER diff --git a/tests/iii/identifier-enum-collision/case.json b/tests/iii/identifier-enum-collision/case.json new file mode 100644 index 0000000..53f0cdc --- /dev/null +++ b/tests/iii/identifier-enum-collision/case.json @@ -0,0 +1,8 @@ +{ + "errors": [ + { + "reason": "Duplicate\\ value\\ 'spring'\\ in\\ enum\\ Season", + "line": 1 + } + ] +} diff --git a/tests/iii/identifier-enum-collision/notes.md b/tests/iii/identifier-enum-collision/notes.md new file mode 100644 index 0000000..0fdb4de --- /dev/null +++ b/tests/iii/identifier-enum-collision/notes.md @@ -0,0 +1,3 @@ +# identifier-enum-collision + +The compiler must reject this program: Duplicate value 'spring' in enum Season. The diagnostic must identify line 1; compilation must preserve existing output. diff --git a/tests/iii/identifier-enum-collision/program.cps b/tests/iii/identifier-enum-collision/program.cps new file mode 100644 index 0000000..bd80acc --- /dev/null +++ b/tests/iii/identifier-enum-collision/program.cps @@ -0,0 +1 @@ +TYPE Season = (Spring, spring) diff --git a/tests/iii/identifier-field-collision/case.json b/tests/iii/identifier-field-collision/case.json new file mode 100644 index 0000000..cb164c7 --- /dev/null +++ b/tests/iii/identifier-field-collision/case.json @@ -0,0 +1,8 @@ +{ + "errors": [ + { + "reason": "Duplicate\\ field\\ 'value'\\ in\\ record\\ Box", + "line": 1 + } + ] +} diff --git a/tests/iii/identifier-field-collision/notes.md b/tests/iii/identifier-field-collision/notes.md new file mode 100644 index 0000000..d88ddfb --- /dev/null +++ b/tests/iii/identifier-field-collision/notes.md @@ -0,0 +1,3 @@ +# identifier-field-collision + +The compiler must reject this program: Duplicate field 'value' in record Box. The diagnostic must identify line 1; compilation must preserve existing output. diff --git a/tests/iii/identifier-field-collision/program.cps b/tests/iii/identifier-field-collision/program.cps new file mode 100644 index 0000000..56597bf --- /dev/null +++ b/tests/iii/identifier-field-collision/program.cps @@ -0,0 +1,4 @@ +CLASS Box + Value : INTEGER + value : INTEGER +ENDCLASS diff --git a/tests/iii/identifier-function-collision/case.json b/tests/iii/identifier-function-collision/case.json new file mode 100644 index 0000000..7743273 --- /dev/null +++ b/tests/iii/identifier-function-collision/case.json @@ -0,0 +1,8 @@ +{ + "errors": [ + { + "reason": "Function\\ value\\ cannot\\ be\\ redefined\\.", + "line": 4 + } + ] +} diff --git a/tests/iii/identifier-function-collision/notes.md b/tests/iii/identifier-function-collision/notes.md new file mode 100644 index 0000000..795b86d --- /dev/null +++ b/tests/iii/identifier-function-collision/notes.md @@ -0,0 +1,3 @@ +# identifier-function-collision + +Names differing only in ASCII case cannot introduce a separate symbol. Require Function value cannot be redefined. at line 4, a failed compilation, and preservation of any existing output. diff --git a/tests/iii/identifier-function-collision/program.cps b/tests/iii/identifier-function-collision/program.cps new file mode 100644 index 0000000..cc7f6de --- /dev/null +++ b/tests/iii/identifier-function-collision/program.cps @@ -0,0 +1,6 @@ +FUNCTION Value() RETURNS INTEGER + RETURN 1 +ENDFUNCTION +FUNCTION value() RETURNS INTEGER + RETURN 2 +ENDFUNCTION diff --git a/tests/iii/identifier-parameter-collision/case.json b/tests/iii/identifier-parameter-collision/case.json new file mode 100644 index 0000000..17daa9a --- /dev/null +++ b/tests/iii/identifier-parameter-collision/case.json @@ -0,0 +1,8 @@ +{ + "errors": [ + { + "reason": "Duplicate\\ parameter\\ name\\ 'value'", + "line": 1 + } + ] +} diff --git a/tests/iii/identifier-parameter-collision/notes.md b/tests/iii/identifier-parameter-collision/notes.md new file mode 100644 index 0000000..c752a2f --- /dev/null +++ b/tests/iii/identifier-parameter-collision/notes.md @@ -0,0 +1,3 @@ +# identifier-parameter-collision + +The compiler must reject this program: Duplicate parameter name value. The diagnostic must identify line 1; compilation must preserve existing output. diff --git a/tests/iii/identifier-parameter-collision/program.cps b/tests/iii/identifier-parameter-collision/program.cps new file mode 100644 index 0000000..2cb5af6 --- /dev/null +++ b/tests/iii/identifier-parameter-collision/program.cps @@ -0,0 +1,2 @@ +PROCEDURE Bad(Value : INTEGER, value : INTEGER) +ENDPROCEDURE diff --git a/tests/iii/identifier-runtime-collision/case.json b/tests/iii/identifier-runtime-collision/case.json new file mode 100644 index 0000000..aa83876 --- /dev/null +++ b/tests/iii/identifier-runtime-collision/case.json @@ -0,0 +1,8 @@ +{ + "errors": [ + { + "reason": "'Printf'\\ is\\ a\\ reserved\\ runtime\\ symbol", + "line": 1 + } + ] +} diff --git a/tests/iii/identifier-runtime-collision/notes.md b/tests/iii/identifier-runtime-collision/notes.md new file mode 100644 index 0000000..ec125eb --- /dev/null +++ b/tests/iii/identifier-runtime-collision/notes.md @@ -0,0 +1,3 @@ +# identifier-runtime-collision + +Names differing only in ASCII case cannot introduce a separate symbol. Require 'Printf' is a reserved runtime symbol at line 1, a failed compilation, and preservation of any existing output. diff --git a/tests/iii/identifier-runtime-collision/program.cps b/tests/iii/identifier-runtime-collision/program.cps new file mode 100644 index 0000000..6e526fd --- /dev/null +++ b/tests/iii/identifier-runtime-collision/program.cps @@ -0,0 +1,2 @@ +PROCEDURE Printf() +ENDPROCEDURE diff --git a/tests/iii/identifier-type-collision/case.json b/tests/iii/identifier-type-collision/case.json new file mode 100644 index 0000000..93f3914 --- /dev/null +++ b/tests/iii/identifier-type-collision/case.json @@ -0,0 +1,8 @@ +{ + "errors": [ + { + "reason": "Type\\ first\\ is\\ already\\ defined", + "line": 2 + } + ] +} diff --git a/tests/iii/identifier-type-collision/notes.md b/tests/iii/identifier-type-collision/notes.md new file mode 100644 index 0000000..3483ceb --- /dev/null +++ b/tests/iii/identifier-type-collision/notes.md @@ -0,0 +1,3 @@ +# identifier-type-collision + +The compiler must reject this program: Type first is already defined. The diagnostic must identify line 2; compilation must preserve existing output. diff --git a/tests/iii/identifier-type-collision/program.cps b/tests/iii/identifier-type-collision/program.cps new file mode 100644 index 0000000..d1f475f --- /dev/null +++ b/tests/iii/identifier-type-collision/program.cps @@ -0,0 +1,2 @@ +TYPE First = ^INTEGER +TYPE first = ^INTEGER diff --git a/tests/iii/identifier-variable-collision/case.json b/tests/iii/identifier-variable-collision/case.json new file mode 100644 index 0000000..b50d602 --- /dev/null +++ b/tests/iii/identifier-variable-collision/case.json @@ -0,0 +1,8 @@ +{ + "errors": [ + { + "reason": "Declaration\\ of\\ counter\\ conflicts\\ with\\ an\\ existing\\ declaration\\ in\\ this\\ scope", + "line": 2 + } + ] +} diff --git a/tests/iii/identifier-variable-collision/notes.md b/tests/iii/identifier-variable-collision/notes.md new file mode 100644 index 0000000..a25de06 --- /dev/null +++ b/tests/iii/identifier-variable-collision/notes.md @@ -0,0 +1,3 @@ +# identifier-variable-collision + +The compiler must reject this program: Declaration of counter conflicts with an existing declaration in this scope. The diagnostic must identify line 2; compilation must preserve existing output. diff --git a/tests/iii/identifier-variable-collision/program.cps b/tests/iii/identifier-variable-collision/program.cps new file mode 100644 index 0000000..fc0d743 --- /dev/null +++ b/tests/iii/identifier-variable-collision/program.cps @@ -0,0 +1,2 @@ +DECLARE Counter : INTEGER +DECLARE counter : INTEGER diff --git a/tests/iii/integer-bound-overflow/case.json b/tests/iii/integer-bound-overflow/case.json new file mode 100644 index 0000000..6421b0f --- /dev/null +++ b/tests/iii/integer-bound-overflow/case.json @@ -0,0 +1,8 @@ +{ + "errors": [ + { + "reason": "Integer\\ literal\\ is\\ outside\\ the\\ i64\\ range", + "line": 1 + } + ] +} diff --git a/tests/iii/integer-bound-overflow/notes.md b/tests/iii/integer-bound-overflow/notes.md new file mode 100644 index 0000000..1c3171a --- /dev/null +++ b/tests/iii/integer-bound-overflow/notes.md @@ -0,0 +1,3 @@ +# integer-bound-overflow + +The compiler must reject this program: Integer literal is outside the i64 range. The diagnostic must identify line 1; compilation must preserve existing output. diff --git a/tests/iii/integer-bound-overflow/program.cps b/tests/iii/integer-bound-overflow/program.cps new file mode 100644 index 0000000..6bdd156 --- /dev/null +++ b/tests/iii/integer-bound-overflow/program.cps @@ -0,0 +1,2 @@ +PROCEDURE Bad(Values : ARRAY[0:9223372036854775808] OF INTEGER) +ENDPROCEDURE diff --git a/tests/iii/integer-constant-overflow/case.json b/tests/iii/integer-constant-overflow/case.json new file mode 100644 index 0000000..6421b0f --- /dev/null +++ b/tests/iii/integer-constant-overflow/case.json @@ -0,0 +1,8 @@ +{ + "errors": [ + { + "reason": "Integer\\ literal\\ is\\ outside\\ the\\ i64\\ range", + "line": 1 + } + ] +} diff --git a/tests/iii/integer-constant-overflow/notes.md b/tests/iii/integer-constant-overflow/notes.md new file mode 100644 index 0000000..b13c24e --- /dev/null +++ b/tests/iii/integer-constant-overflow/notes.md @@ -0,0 +1,3 @@ +# integer-constant-overflow + +The compiler must reject this program: Integer literal is outside the i64 range. The diagnostic must identify line 1; compilation must preserve existing output. diff --git a/tests/iii/integer-constant-overflow/program.cps b/tests/iii/integer-constant-overflow/program.cps new file mode 100644 index 0000000..849c3eb --- /dev/null +++ b/tests/iii/integer-constant-overflow/program.cps @@ -0,0 +1 @@ +CONSTANT TooBig = 9223372036854775808 diff --git a/tests/iii/integer-huge-overflow/case.json b/tests/iii/integer-huge-overflow/case.json new file mode 100644 index 0000000..6421b0f --- /dev/null +++ b/tests/iii/integer-huge-overflow/case.json @@ -0,0 +1,8 @@ +{ + "errors": [ + { + "reason": "Integer\\ literal\\ is\\ outside\\ the\\ i64\\ range", + "line": 1 + } + ] +} diff --git a/tests/iii/integer-huge-overflow/notes.md b/tests/iii/integer-huge-overflow/notes.md new file mode 100644 index 0000000..acc9bfb --- /dev/null +++ b/tests/iii/integer-huge-overflow/notes.md @@ -0,0 +1,3 @@ +# integer-huge-overflow + +The compiler must reject this program: Integer literal is outside the i64 range. The diagnostic must identify line 1; compilation must preserve existing output. diff --git a/tests/iii/integer-huge-overflow/program.cps b/tests/iii/integer-huge-overflow/program.cps new file mode 100644 index 0000000..2e4ba62 --- /dev/null +++ b/tests/iii/integer-huge-overflow/program.cps @@ -0,0 +1 @@ +OUTPUT 9999999999999999999999999999999999999 diff --git a/tests/iii/integer-negative-overflow/case.json b/tests/iii/integer-negative-overflow/case.json new file mode 100644 index 0000000..6421b0f --- /dev/null +++ b/tests/iii/integer-negative-overflow/case.json @@ -0,0 +1,8 @@ +{ + "errors": [ + { + "reason": "Integer\\ literal\\ is\\ outside\\ the\\ i64\\ range", + "line": 1 + } + ] +} diff --git a/tests/iii/integer-negative-overflow/notes.md b/tests/iii/integer-negative-overflow/notes.md new file mode 100644 index 0000000..029a543 --- /dev/null +++ b/tests/iii/integer-negative-overflow/notes.md @@ -0,0 +1,3 @@ +# integer-negative-overflow + +The compiler must reject this program: Integer literal is outside the i64 range. The diagnostic must identify line 1; compilation must preserve existing output. diff --git a/tests/iii/integer-negative-overflow/program.cps b/tests/iii/integer-negative-overflow/program.cps new file mode 100644 index 0000000..e208ba6 --- /dev/null +++ b/tests/iii/integer-negative-overflow/program.cps @@ -0,0 +1 @@ +OUTPUT -9223372036854775809 diff --git a/tests/iii/integer-positive-overflow/case.json b/tests/iii/integer-positive-overflow/case.json new file mode 100644 index 0000000..6421b0f --- /dev/null +++ b/tests/iii/integer-positive-overflow/case.json @@ -0,0 +1,8 @@ +{ + "errors": [ + { + "reason": "Integer\\ literal\\ is\\ outside\\ the\\ i64\\ range", + "line": 1 + } + ] +} diff --git a/tests/iii/integer-positive-overflow/notes.md b/tests/iii/integer-positive-overflow/notes.md new file mode 100644 index 0000000..2c17ff4 --- /dev/null +++ b/tests/iii/integer-positive-overflow/notes.md @@ -0,0 +1,3 @@ +# integer-positive-overflow + +The compiler must reject this program: Integer literal is outside the i64 range. The diagnostic must identify line 1; compilation must preserve existing output. diff --git a/tests/iii/integer-positive-overflow/program.cps b/tests/iii/integer-positive-overflow/program.cps new file mode 100644 index 0000000..286c0eb --- /dev/null +++ b/tests/iii/integer-positive-overflow/program.cps @@ -0,0 +1 @@ +OUTPUT 9223372036854775808 diff --git a/tests/iii/while-do-rejected/case.json b/tests/iii/while-do-rejected/case.json new file mode 100644 index 0000000..9908d5e --- /dev/null +++ b/tests/iii/while-do-rejected/case.json @@ -0,0 +1,8 @@ +{ + "errors": [ + { + "reason": "Expected\\ '<\\-'\\ after\\ identifier\\ 'DO'", + "line": 1 + } + ] +} diff --git a/tests/iii/while-do-rejected/notes.md b/tests/iii/while-do-rejected/notes.md new file mode 100644 index 0000000..ed669b5 --- /dev/null +++ b/tests/iii/while-do-rejected/notes.md @@ -0,0 +1,3 @@ +# while-do-rejected + +The compiler must reject this program: Expected '<-' after identifier 'DO'. The diagnostic must identify line 1; compilation must preserve existing output. diff --git a/tests/iii/while-do-rejected/program.cps b/tests/iii/while-do-rejected/program.cps new file mode 100644 index 0000000..b733e21 --- /dev/null +++ b/tests/iii/while-do-rejected/program.cps @@ -0,0 +1,3 @@ +WHILE FALSE DO + OUTPUT 1 +ENDWHILE |
