diff options
Diffstat (limited to 'gcc/testsuite/gm2')
36 files changed, 807 insertions, 0 deletions
diff --git a/gcc/testsuite/gm2/errors/fail/badindrtype.mod b/gcc/testsuite/gm2/errors/fail/badindrtype.mod new file mode 100644 index 0000000..b393027 --- /dev/null +++ b/gcc/testsuite/gm2/errors/fail/badindrtype.mod @@ -0,0 +1,16 @@ +MODULE badindrtype ; + + +PROCEDURE init (VAR ch: CHAR) ; +VAR + c: CARDINAL ; +BEGIN + ch := c +END init ; + + +VAR + ch: CHAR ; +BEGIN + init (ch) +END badindrtype. diff --git a/gcc/testsuite/gm2/errors/fail/badindrtype2.mod b/gcc/testsuite/gm2/errors/fail/badindrtype2.mod new file mode 100644 index 0000000..a31303b --- /dev/null +++ b/gcc/testsuite/gm2/errors/fail/badindrtype2.mod @@ -0,0 +1,16 @@ +MODULE badindrtype2 ; + + +PROCEDURE init (VAR ch: CHAR) ; +VAR + c: CARDINAL ; +BEGIN + c := ch +END init ; + + +VAR + ch: CHAR ; +BEGIN + init (ch) +END badindrtype2. diff --git a/gcc/testsuite/gm2/iso/fail/CHAR.mod b/gcc/testsuite/gm2/iso/fail/CHAR.mod new file mode 100644 index 0000000..0e7d43e --- /dev/null +++ b/gcc/testsuite/gm2/iso/fail/CHAR.mod @@ -0,0 +1,7 @@ +MODULE CHAR ; + +IMPORT CHAR ; + +BEGIN + CHAR.Write ("h") +END CHAR. diff --git a/gcc/testsuite/gm2/iso/fail/badarray3.mod b/gcc/testsuite/gm2/iso/fail/badarray3.mod new file mode 100644 index 0000000..be53d21 --- /dev/null +++ b/gcc/testsuite/gm2/iso/fail/badarray3.mod @@ -0,0 +1,7 @@ +MODULE badarray3 ; + +VAR + x: ARRAY [1..5] OF INTEGER ; +BEGIN + x[1] := 'c'; +END badarray3. diff --git a/gcc/testsuite/gm2/iso/fail/badreturn.mod b/gcc/testsuite/gm2/iso/fail/badreturn.mod new file mode 100644 index 0000000..5417961 --- /dev/null +++ b/gcc/testsuite/gm2/iso/fail/badreturn.mod @@ -0,0 +1,5 @@ +MODULE badreturn ; + +BEGIN + RETURN 0 +END badreturn.
\ No newline at end of file diff --git a/gcc/testsuite/gm2/iso/fail/badreturn2.mod b/gcc/testsuite/gm2/iso/fail/badreturn2.mod new file mode 100644 index 0000000..a4b9008 --- /dev/null +++ b/gcc/testsuite/gm2/iso/fail/badreturn2.mod @@ -0,0 +1,12 @@ +MODULE badreturn2 ; + + +PROCEDURE foo ; +BEGIN + RETURN 0 +END foo ; + + +BEGIN + foo +END badreturn2. diff --git a/gcc/testsuite/gm2/iso/pass/modulereturn.mod b/gcc/testsuite/gm2/iso/pass/modulereturn.mod new file mode 100644 index 0000000..b39947d --- /dev/null +++ b/gcc/testsuite/gm2/iso/pass/modulereturn.mod @@ -0,0 +1,5 @@ +MODULE modulereturn ; + +BEGIN + RETURN +END modulereturn. diff --git a/gcc/testsuite/gm2/iso/pass/modulereturn2.mod b/gcc/testsuite/gm2/iso/pass/modulereturn2.mod new file mode 100644 index 0000000..934cfae --- /dev/null +++ b/gcc/testsuite/gm2/iso/pass/modulereturn2.mod @@ -0,0 +1,10 @@ +MODULE modulereturn2 ; + + +BEGIN + RETURN +EXCEPT + RETURN +FINALLY + RETURN +END modulereturn2. diff --git a/gcc/testsuite/gm2/iso/run/pass/CHAR.mod b/gcc/testsuite/gm2/iso/run/pass/CHAR.mod new file mode 100644 index 0000000..4ca86b8 --- /dev/null +++ b/gcc/testsuite/gm2/iso/run/pass/CHAR.mod @@ -0,0 +1,7 @@ +MODULE CHAR ; + +FROM libc IMPORT printf ; + +BEGIN + printf ("hello world\n") +END CHAR. diff --git a/gcc/testsuite/gm2/iso/run/pass/importself.mod b/gcc/testsuite/gm2/iso/run/pass/importself.mod new file mode 100644 index 0000000..06cf717 --- /dev/null +++ b/gcc/testsuite/gm2/iso/run/pass/importself.mod @@ -0,0 +1,14 @@ +MODULE importself ; + +IMPORT importself ; + + +PROCEDURE foo ; +BEGIN + +END foo ; + +BEGIN + foo ; + importself.foo +END importself. diff --git a/gcc/testsuite/gm2/isolib/run/pass/testdelete2.mod b/gcc/testsuite/gm2/isolib/run/pass/testdelete2.mod new file mode 100644 index 0000000..386b49d --- /dev/null +++ b/gcc/testsuite/gm2/isolib/run/pass/testdelete2.mod @@ -0,0 +1,107 @@ +MODULE testdelete2 ; + +(* A test module to test file creation and deletion using ISO + libraries. *) + + +IMPORT DynamicStrings, StringFileSysOp, + FileSysOp, SeqFile, TextIO, Strings, + IOChanUtils ; + +FROM libc IMPORT printf, exit ; +FROM FormatStrings IMPORT Sprintf1 ; + + +CONST + MaxFile = 10 ; + +VAR + files: ARRAY [0..MaxFile] OF SeqFile.ChanId ; + + +PROCEDURE Assert (condition: BOOLEAN; line: CARDINAL) ; +BEGIN + IF NOT condition + THEN + printf ("%s:%d: assert failed\n", __FILE__, line) ; + exit (1) + END +END Assert ; + + +(* + CreateFiles - create MaxFile files saving the file handle + into files. +*) + +PROCEDURE CreateFiles ; +VAR + i : CARDINAL ; + name: ARRAY [0..10] OF CHAR ; + ch : CHAR ; + res : SeqFile.OpenResults ; +BEGIN + FOR i := 1 TO HIGH (files) DO + Strings.Assign ('file', name) ; + ch := CHR (ORD ('0')+i-1) ; + name[4] := ch ; + name[5] := 0C ; + SeqFile.OpenWrite (files[i], name, + SeqFile.text+SeqFile.write, res) ; + TextIO.WriteString (files[i], "some text inside file ") ; + TextIO.WriteLn (files[i]) ; + SeqFile.Close (files[i]) + END +END CreateFiles ; + + +(* + DeleteFiles - delete every file in files. +*) + +PROCEDURE DeleteFiles ; +VAR + i : CARDINAL ; + name: ARRAY [0..10] OF CHAR ; + s : DynamicStrings.String ; + ch : CHAR ; + res : SeqFile.OpenResults ; +BEGIN + (* Open the files first. *) + FOR i := 1 TO HIGH (files) DO + Strings.Assign ('file', name) ; + ch := CHR (ORD ('0')+i-1) ; + name[4] := ch ; + name[5] := 0C ; + SeqFile.OpenRead (files[i], name, SeqFile.text, res) ; + Assert (FileSysOp.Exists (name), __LINE__) ; + Assert (FileSysOp.IsFile (name), __LINE__) + END ; + (* Now delete them. *) + FOR i := 1 TO HIGH (files) DO + s := IOChanUtils.GetFileName (files[i]) ; + Assert (StringFileSysOp.Exists (s), __LINE__) ; + Assert (StringFileSysOp.IsFile (s), __LINE__) ; + Assert (StringFileSysOp.Unlink (s), __LINE__) ; + Assert (NOT StringFileSysOp.Exists (s), __LINE__) ; + SeqFile.Close (files[i]) ; + s := DynamicStrings.KillString (s) + END +END DeleteFiles ; + + +(* + Init - +*) + +PROCEDURE Init ; +BEGIN + CreateFiles ; + DeleteFiles ; + printf ("all tests passed\n") +END Init ; + + +BEGIN + Init +END testdelete2. diff --git a/gcc/testsuite/gm2/pim/fail/badmodvar.mod b/gcc/testsuite/gm2/pim/fail/badmodvar.mod new file mode 100644 index 0000000..dd90920 --- /dev/null +++ b/gcc/testsuite/gm2/pim/fail/badmodvar.mod @@ -0,0 +1,7 @@ +MODULE badmodvar ; + +VAR + x: y ; +BEGIN + +END badmodvar. diff --git a/gcc/testsuite/gm2/pim/fail/constintarraybyte.mod b/gcc/testsuite/gm2/pim/fail/constintarraybyte.mod new file mode 100644 index 0000000..cbcc804 --- /dev/null +++ b/gcc/testsuite/gm2/pim/fail/constintarraybyte.mod @@ -0,0 +1,10 @@ +MODULE constintarraybyte ; + +FROM FormatStrings IMPORT Sprintf1 ; +FROM DynamicStrings IMPORT String, InitString ; + +VAR + s: String ; +BEGIN + s := Sprintf1 (InitString("abc%x\n"), 42) +END constintarraybyte. diff --git a/gcc/testsuite/gm2/pim/fail/cyclictypes.mod b/gcc/testsuite/gm2/pim/fail/cyclictypes.mod new file mode 100644 index 0000000..f2adb49 --- /dev/null +++ b/gcc/testsuite/gm2/pim/fail/cyclictypes.mod @@ -0,0 +1,13 @@ +MODULE cyclictypes ; + +TYPE + A = B; + B = A; + +PROCEDURE foo ; +VAR + bar: A ; +END foo ; + + +END cyclictypes. diff --git a/gcc/testsuite/gm2/pim/fail/cyclictypes2.mod b/gcc/testsuite/gm2/pim/fail/cyclictypes2.mod new file mode 100644 index 0000000..a5630c8 --- /dev/null +++ b/gcc/testsuite/gm2/pim/fail/cyclictypes2.mod @@ -0,0 +1,9 @@ +MODULE cyclictypes2 ; + +TYPE + A = B; + B = A; + +VAR + bar: A ; +END cyclictypes2. diff --git a/gcc/testsuite/gm2/pim/fail/cyclictypes4.mod b/gcc/testsuite/gm2/pim/fail/cyclictypes4.mod new file mode 100644 index 0000000..69f061b --- /dev/null +++ b/gcc/testsuite/gm2/pim/fail/cyclictypes4.mod @@ -0,0 +1,13 @@ +MODULE cyclictypes4 ; + +TYPE + A = B ; + B = C ; + C = D ; + D = A ; + +VAR + v: A ; +BEGIN + +END cyclictypes4. diff --git a/gcc/testsuite/gm2/pim/fail/testcharint.mod b/gcc/testsuite/gm2/pim/fail/testcharint.mod new file mode 100644 index 0000000..d403651 --- /dev/null +++ b/gcc/testsuite/gm2/pim/fail/testcharint.mod @@ -0,0 +1,8 @@ +MODULE testcharint ; (*!m2iso+gm2*) + +VAR + ch: CHAR ; + i : INTEGER ; +BEGIN + ch := i +END testcharint. diff --git a/gcc/testsuite/gm2/pim/fail/testindrx.mod b/gcc/testsuite/gm2/pim/fail/testindrx.mod new file mode 100644 index 0000000..2630ebd --- /dev/null +++ b/gcc/testsuite/gm2/pim/fail/testindrx.mod @@ -0,0 +1,8 @@ +MODULE testindrx ; (*!m2iso+gm2*) + +VAR + x: ARRAY [1..5] OF INTEGER ; + ch: CHAR ; +BEGIN + ch := x[1] +END testindrx. diff --git a/gcc/testsuite/gm2/pim/pass/ReturnType.mod b/gcc/testsuite/gm2/pim/pass/ReturnType.mod new file mode 100644 index 0000000..149bc85 --- /dev/null +++ b/gcc/testsuite/gm2/pim/pass/ReturnType.mod @@ -0,0 +1,17 @@ +MODULE ReturnType ; + +TYPE + bar = POINTER TO CARDINAL ; + + +PROCEDURE foo (VAR value: bar) : bar ; +BEGIN + RETURN value +END foo ; + +VAR + b: bar ; +BEGIN + b := NIL ; + b := foo (b) +END ReturnType. diff --git a/gcc/testsuite/gm2/pim/pass/ReturnType2.mod b/gcc/testsuite/gm2/pim/pass/ReturnType2.mod new file mode 100644 index 0000000..bab7f5b --- /dev/null +++ b/gcc/testsuite/gm2/pim/pass/ReturnType2.mod @@ -0,0 +1,19 @@ +MODULE ReturnType2 ; + +TYPE + bar = POINTER TO RECORD + field: CARDINAL ; + END ; + + +PROCEDURE foo (VAR value: bar) : bar ; +BEGIN + RETURN value +END foo ; + +VAR + b: bar ; +BEGIN + b := NIL ; + b := foo (b) +END ReturnType2. diff --git a/gcc/testsuite/gm2/pim/pass/forarray.mod b/gcc/testsuite/gm2/pim/pass/forarray.mod new file mode 100644 index 0000000..e1b41e7 --- /dev/null +++ b/gcc/testsuite/gm2/pim/pass/forarray.mod @@ -0,0 +1,21 @@ +MODULE forarray ; + + +VAR + array: ARRAY [0..10] OF CARDINAL ; + + +PROCEDURE Init ; +VAR + i, n: CARDINAL ; +BEGIN + array[0] := 10 ; + n := 0 ; + FOR i := 1 TO array[n] DO + END +END Init ; + + +BEGIN + Init +END forarray. diff --git a/gcc/testsuite/gm2/pim/pass/highbit.mod b/gcc/testsuite/gm2/pim/pass/highbit.mod new file mode 100644 index 0000000..c9c872a --- /dev/null +++ b/gcc/testsuite/gm2/pim/pass/highbit.mod @@ -0,0 +1,13 @@ +MODULE highbit ; + +FROM libc IMPORT printf ; + +TYPE + set = BITSET ; + +CONST + HighBit = MAX (set) ; + +BEGIN + printf ("the MAX (set) = %d\n", HighBit) +END highbit. diff --git a/gcc/testsuite/gm2/pim/pass/highbit2.mod b/gcc/testsuite/gm2/pim/pass/highbit2.mod new file mode 100644 index 0000000..940556d --- /dev/null +++ b/gcc/testsuite/gm2/pim/pass/highbit2.mod @@ -0,0 +1,13 @@ +MODULE highbit2 ; + +FROM libc IMPORT printf ; + +TYPE + set = BITSET ; + +CONST + HighBit = MAX (BITSET) ; + +BEGIN + printf ("the MAX (BITSET) = %d\n", HighBit) +END highbit2. diff --git a/gcc/testsuite/gm2/pim/pass/testxindr.mod b/gcc/testsuite/gm2/pim/pass/testxindr.mod new file mode 100644 index 0000000..271f430 --- /dev/null +++ b/gcc/testsuite/gm2/pim/pass/testxindr.mod @@ -0,0 +1,17 @@ +MODULE testxindr ; (*!m2iso+gm2*) + +CONST + NulName = 0 ; + +TYPE + Name = CARDINAL ; + + ptr = POINTER TO RECORD + n: Name ; + END ; + +VAR + p: ptr ; +BEGIN + p^.n := NulName +END testxindr. diff --git a/gcc/testsuite/gm2/pim/pass/testxindr2.mod b/gcc/testsuite/gm2/pim/pass/testxindr2.mod new file mode 100644 index 0000000..b0776dc --- /dev/null +++ b/gcc/testsuite/gm2/pim/pass/testxindr2.mod @@ -0,0 +1,17 @@ +MODULE testxindr2 ; (*!m2iso+gm2*) + +CONST + NulName = 0 ; +TYPE + Name = CARDINAL ; + +PROCEDURE set (VAR n: Name) ; +BEGIN + n := NulName +END set ; + +VAR + n: Name ; +BEGIN + set (n) +END testxindr2. diff --git a/gcc/testsuite/gm2/pim/pass/testxindr3.mod b/gcc/testsuite/gm2/pim/pass/testxindr3.mod new file mode 100644 index 0000000..5625c3e --- /dev/null +++ b/gcc/testsuite/gm2/pim/pass/testxindr3.mod @@ -0,0 +1,15 @@ +MODULE testxindr3 ; (*!m2iso+gm2*) + +CONST + NulName = 0 ; + +PROCEDURE set (VAR n: CARDINAL) ; +BEGIN + n := NulName +END set ; + +VAR + n: CARDINAL ; +BEGIN + set (n) +END testxindr3. diff --git a/gcc/testsuite/gm2/pimlib/logitech/run/pass/testdelete2.mod b/gcc/testsuite/gm2/pimlib/logitech/run/pass/testdelete2.mod new file mode 100644 index 0000000..977d498 --- /dev/null +++ b/gcc/testsuite/gm2/pimlib/logitech/run/pass/testdelete2.mod @@ -0,0 +1,104 @@ +MODULE testdelete2 ; + +(* A test module to test file creation and deletion using log + libraries. *) + + +IMPORT FIO, SFIO, DynamicStrings, StringFileSysOp, + FileSysOp, FileSystem, StrLib ; + +FROM libc IMPORT printf, exit ; +FROM FormatStrings IMPORT Sprintf1 ; + + +CONST + MaxFile = 10 ; + +VAR + files: ARRAY [0..MaxFile] OF FileSystem.File ; + + +PROCEDURE Assert (condition: BOOLEAN; line: CARDINAL) ; +BEGIN + IF NOT condition + THEN + printf ("%s:%d: assert failed\n", __FILE__, line) ; + exit (1) + END +END Assert ; + + +(* + CreateFiles - create MaxFile files saving the file handle + into files. +*) + +PROCEDURE CreateFiles ; +VAR + i : CARDINAL ; + name: ARRAY [0..10] OF CHAR ; + ch : CHAR ; +BEGIN + FOR i := 1 TO HIGH (files) DO + StrLib.StrCopy ('file', name) ; + ch := CHR (ORD ('0')+i-1) ; + name[4] := ch ; + name[5] := 0C ; + FileSystem.Lookup (files[i], name, TRUE) ; + FileSystem.WriteString (files[i], "some text inside file ") ; + FileSystem.WriteChar (files[i], ch) ; + FileSystem.WriteString (files[i], "\n") ; + FileSystem.Close (files[i]) + END +END CreateFiles ; + + +(* + DeleteFiles - delete every file in files. +*) + +PROCEDURE DeleteFiles ; +VAR + i : CARDINAL ; + name: ARRAY [0..10] OF CHAR ; + s : DynamicStrings.String ; + ch : CHAR ; +BEGIN + (* Open the files first. *) + FOR i := 1 TO HIGH (files) DO + StrLib.StrCopy ('file', name) ; + ch := CHR (ORD ('0')+i-1) ; + name[4] := ch ; + name[5] := 0C ; + FileSystem.Lookup (files[i], name, FALSE) ; + Assert (FileSysOp.Exists (name), __LINE__) ; + Assert (FileSysOp.IsFile (name), __LINE__) + END ; + (* Now delete them. *) + FOR i := 1 TO HIGH (files) DO + s := FileSystem.GetFileName (files[i]) ; + Assert (StringFileSysOp.Exists (s), __LINE__) ; + Assert (StringFileSysOp.IsFile (s), __LINE__) ; + Assert (StringFileSysOp.Unlink (s), __LINE__) ; + Assert (NOT StringFileSysOp.Exists (s), __LINE__) ; + FileSystem.Close (files[i]) ; + s := DynamicStrings.KillString (s) + END +END DeleteFiles ; + + +(* + Init - +*) + +PROCEDURE Init ; +BEGIN + CreateFiles ; + DeleteFiles ; + printf ("all tests passed\n") +END Init ; + + +BEGIN + Init +END testdelete2. diff --git a/gcc/testsuite/gm2/pimlib/logitech/run/pass/teststrings.mod b/gcc/testsuite/gm2/pimlib/logitech/run/pass/teststrings.mod new file mode 100644 index 0000000..1085d9c --- /dev/null +++ b/gcc/testsuite/gm2/pimlib/logitech/run/pass/teststrings.mod @@ -0,0 +1,16 @@ +MODULE teststrings ; + +IMPORT InOut,Strings; + +VAR + content : ARRAY[1..256] OF CHAR; + position: CARDINAL; + +(* the content is just random text. *) + +BEGIN + content := "erreur: In program module « essai3 »: attempting to pass (1) parameters to procedure"; + InOut.WriteString(content); + InOut.WriteLn; + position := Strings.Pos ("IMPORT", content); +END teststrings . diff --git a/gcc/testsuite/gm2/pimlib/run/pass/format2.mod b/gcc/testsuite/gm2/pimlib/run/pass/format2.mod new file mode 100644 index 0000000..2ad6a8c --- /dev/null +++ b/gcc/testsuite/gm2/pimlib/run/pass/format2.mod @@ -0,0 +1,63 @@ +MODULE format2; + +FROM libc IMPORT exit, printf ; +FROM Terminal IMPORT Write, WriteLn; +FROM NumberIO IMPORT WriteCard; +FROM DynamicStrings IMPORT String, Length, char, InitString; +FROM FormatStrings IMPORT Sprintf1; + +PROCEDURE WriteString (s: String); +VAR + l, i: CARDINAL; +BEGIN + l := Length (s) ; + i := 0 ; + WHILE i < l DO + Write (char (s, i)) ; + INC (i) + END +END WriteString; + + +(* + assert - +*) + +PROCEDURE assert (cond: BOOLEAN; line: CARDINAL; file: ARRAY OF CHAR) ; +BEGIN + IF NOT cond + THEN + printf ("%s:%d assertion failed\n", file, line); + exit (1) + END +END assert ; + + +VAR + n: CARDINAL; + r, s: String; +BEGIN + n := 2; + r := InitString("%u pieces of cake") ; + WriteString (r) ; WriteLn ; + assert (Length (r) = 17, __LINE__, __FILE__) ; + s := Sprintf1 (r, n) ; + WriteCard (Length (s), 4) ; WriteLn ; + assert (Length (s) = 16, __LINE__, __FILE__) ; + + r := InitString("%d pieces of cake") ; + WriteString (r) ; WriteLn ; + assert (Length (r) = 17, __LINE__, __FILE__) ; + s := Sprintf1 (r, n) ; + WriteCard (Length (s), 4) ; WriteLn ; + assert (Length (s) = 16, __LINE__, __FILE__) ; + + r := InitString("%x pieces of cake") ; + WriteString (r) ; WriteLn ; + assert (Length (r) = 17, __LINE__, __FILE__) ; + s := Sprintf1 (r, n) ; + WriteCard (Length (s), 4) ; WriteLn ; + assert (Length (s) = 16, __LINE__, __FILE__) ; + + WriteString (InitString ('all tests pass')) ; WriteLn ; +END format2. diff --git a/gcc/testsuite/gm2/pimlib/run/pass/testdelete.mod b/gcc/testsuite/gm2/pimlib/run/pass/testdelete.mod new file mode 100644 index 0000000..8afdc44 --- /dev/null +++ b/gcc/testsuite/gm2/pimlib/run/pass/testdelete.mod @@ -0,0 +1,97 @@ +MODULE testdelete ; + +(* A test module to test file creation and deletion using base + PIM libraries. *) + + +IMPORT FIO, SFIO, DynamicStrings, StringFileSysOp ; +FROM libc IMPORT printf, exit ; +FROM FormatStrings IMPORT Sprintf1 ; + + +CONST + MaxFile = 10 ; + +VAR + files: ARRAY [0..MaxFile] OF FIO.File ; + + +PROCEDURE Assert (condition: BOOLEAN; line: CARDINAL) ; +BEGIN + IF NOT condition + THEN + printf ("%s:%d: assert failed\n", __FILE__, line) ; + exit (1) + END +END Assert ; + + +(* + CreateFiles - create MaxFile files saving the file handle + into files. +*) + +PROCEDURE CreateFiles ; +VAR + i: CARDINAL ; + s: DynamicStrings.String ; +BEGIN + FOR i := 1 TO HIGH (files) DO + s := DynamicStrings.InitString ("file%03d") ; + s := Sprintf1 (s, i) ; + files[i] := SFIO.OpenToWrite (s) ; + s := DynamicStrings.KillString (s) ; + s := DynamicStrings.InitString ("some text inside file %d\n") ; + s := Sprintf1 (s, i) ; + s := DynamicStrings.KillString (SFIO.WriteS (files[i], s)) ; + FIO.Close (files[i]) + END +END CreateFiles ; + + +(* + DeleteFiles - delete every file in files. +*) + +PROCEDURE DeleteFiles ; +VAR + i: CARDINAL ; + s: DynamicStrings.String ; +BEGIN + (* Open the files first. *) + FOR i := 1 TO HIGH (files) DO + s := DynamicStrings.InitString ("file%03d") ; + s := Sprintf1 (s, i) ; + files[i] := SFIO.OpenToRead (s) ; + Assert (StringFileSysOp.Exists (s), __LINE__) ; + Assert (StringFileSysOp.IsFile (s), __LINE__) ; + s := DynamicStrings.KillString (s) + END ; + (* Now delete them. *) + FOR i := 1 TO HIGH (files) DO + s := SFIO.GetFileName (files[i]) ; + Assert (StringFileSysOp.Exists (s), __LINE__) ; + Assert (StringFileSysOp.IsFile (s), __LINE__) ; + Assert (StringFileSysOp.Unlink (s), __LINE__) ; + Assert (NOT StringFileSysOp.Exists (s), __LINE__) ; + FIO.Close (files[i]) ; + s := DynamicStrings.KillString (s) + END +END DeleteFiles ; + + +(* + Init - +*) + +PROCEDURE Init ; +BEGIN + CreateFiles ; + DeleteFiles ; + printf ("all tests passed\n") +END Init ; + + +BEGIN + Init +END testdelete. diff --git a/gcc/testsuite/gm2/pimlib/run/pass/testwrite.mod b/gcc/testsuite/gm2/pimlib/run/pass/testwrite.mod new file mode 100644 index 0000000..ce1f035 --- /dev/null +++ b/gcc/testsuite/gm2/pimlib/run/pass/testwrite.mod @@ -0,0 +1,8 @@ +MODULE testwrite ; + +IMPORT ARRAYOFCHAR ; +FROM FIO IMPORT StdOut ; + +BEGIN + ARRAYOFCHAR.Write (StdOut, "hello world") ; ARRAYOFCHAR.WriteLn (StdOut) +END testwrite. diff --git a/gcc/testsuite/gm2/pimlib/run/pass/testwritechar.mod b/gcc/testsuite/gm2/pimlib/run/pass/testwritechar.mod new file mode 100644 index 0000000..c2f739d --- /dev/null +++ b/gcc/testsuite/gm2/pimlib/run/pass/testwritechar.mod @@ -0,0 +1,13 @@ +MODULE testwritechar ; + +IMPORT CHAR ; +FROM FIO IMPORT StdOut ; + +BEGIN + CHAR.Write (StdOut, 'h') ; + CHAR.Write (StdOut, 'e') ; + CHAR.Write (StdOut, 'l') ; + CHAR.Write (StdOut, 'l') ; + CHAR.Write (StdOut, 'o') ; + CHAR.WriteLn (StdOut) +END testwritechar. diff --git a/gcc/testsuite/gm2/switches/pedantic-params/fail/arrayofchar.def b/gcc/testsuite/gm2/switches/pedantic-params/fail/arrayofchar.def new file mode 100644 index 0000000..a24f7d3 --- /dev/null +++ b/gcc/testsuite/gm2/switches/pedantic-params/fail/arrayofchar.def @@ -0,0 +1,12 @@ +DEFINITION MODULE arrayofchar ; + +FROM FIO IMPORT File ; + +(* + Description: provides write procedures for ARRAY OF CHAR. +*) + +PROCEDURE Write (f: File; str: ARRAY OF CHAR) ; +PROCEDURE WriteLn (f: File) ; + +END arrayofchar. diff --git a/gcc/testsuite/gm2/switches/pedantic-params/fail/arrayofchar.mod b/gcc/testsuite/gm2/switches/pedantic-params/fail/arrayofchar.mod new file mode 100644 index 0000000..4e630a9 --- /dev/null +++ b/gcc/testsuite/gm2/switches/pedantic-params/fail/arrayofchar.mod @@ -0,0 +1,30 @@ +IMPLEMENTATION MODULE arrayofchar ; + +FROM FIO IMPORT WriteChar, WriteLine ; +IMPORT StrLib ; + + +(* + Write - writes a string to file f. +*) + +PROCEDURE Write (f: File; a: ARRAY OF CHAR) ; +VAR + len, i: CARDINAL ; +BEGIN + len := StrLib.StrLen (a) ; + i := 0 ; + WHILE i < len DO + WriteChar (f, a[i]) ; + INC (i) + END +END Write ; + + +PROCEDURE WriteLn (f: File) ; +BEGIN + WriteLine (f) +END WriteLn ; + + +END arrayofchar. diff --git a/gcc/testsuite/gm2/warnings/style/fail/badvarname.mod b/gcc/testsuite/gm2/warnings/style/fail/badvarname.mod new file mode 100644 index 0000000..e589b0d --- /dev/null +++ b/gcc/testsuite/gm2/warnings/style/fail/badvarname.mod @@ -0,0 +1,14 @@ +MODULE badvarname ; + + +PROCEDURE Foo ; +VAR + end: CARDINAL ; +BEGIN + end := 1 +END Foo ; + + +BEGIN + Foo +END badvarname. diff --git a/gcc/testsuite/gm2/warnings/style/fail/warnings-style-fail.exp b/gcc/testsuite/gm2/warnings/style/fail/warnings-style-fail.exp new file mode 100644 index 0000000..f44ed80 --- /dev/null +++ b/gcc/testsuite/gm2/warnings/style/fail/warnings-style-fail.exp @@ -0,0 +1,44 @@ +# Expect driver script for GCC Regression Tests +# Copyright (C) 2025 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# <http://www.gnu.org/licenses/>. + +# This file was written by Gaius Mulley (gaius.mulley@southwales.ac.uk) +# for GNU Modula-2. + +if $tracelevel then { + strace $tracelevel +} + +# load support procs +load_lib gm2-torture.exp + +gm2_init_pim "${srcdir}/gm2/warnings/style/fail" + +global TORTURE_OPTIONS + +set old_options $TORTURE_OPTIONS +set TORTURE_OPTIONS { { -O0 -g -Werror=style } } + +foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/*.mod]] { + # If we're only testing specific files and this isn't one of them, skip it. + if ![runtest_file_p $runtests $testcase] then { + continue + } + + gm2-torture-fail $testcase +} + +set TORTURE_OPTIONS $old_options |