public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r15-137] PR modula2/114929 extra for loop iteration count regression tests
@ 2024-05-03 19:48 Gaius Mulley
  0 siblings, 0 replies; only message in thread
From: Gaius Mulley @ 2024-05-03 19:48 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:c943d7b5c40f447b12431df9ad27a47dad95026d

commit r15-137-gc943d7b5c40f447b12431df9ad27a47dad95026d
Author: Gaius Mulley <gaiusmod2@gmail.com>
Date:   Fri May 3 20:48:01 2024 +0100

    PR modula2/114929 extra for loop iteration count regression tests
    
    This patch introduces three more for loop tests checking the iteration
    count using the CHAR and enumeration data types.
    
    gcc/testsuite/ChangeLog:
    
            PR modula2/114929
            * gm2/pim/run/pass/testforloopchar.mod: New test.
            * gm2/pim/run/pass/testforloopchar2.mod: New test.
            * gm2/pim/run/pass/testforloopenum.mod: New test.
    
    Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>

Diff:
---
 gcc/testsuite/gm2/pim/run/pass/testforloopchar.mod | 27 +++++++++++++++++++
 .../gm2/pim/run/pass/testforloopchar2.mod          | 27 +++++++++++++++++++
 gcc/testsuite/gm2/pim/run/pass/testforloopenum.mod | 30 ++++++++++++++++++++++
 3 files changed, 84 insertions(+)

diff --git a/gcc/testsuite/gm2/pim/run/pass/testforloopchar.mod b/gcc/testsuite/gm2/pim/run/pass/testforloopchar.mod
new file mode 100644
index 00000000000..be26ecb7149
--- /dev/null
+++ b/gcc/testsuite/gm2/pim/run/pass/testforloopchar.mod
@@ -0,0 +1,27 @@
+MODULE testforloopchar ;
+
+FROM libc IMPORT printf, exit ;
+
+PROCEDURE test ;
+VAR
+   ch   : CHAR ;
+   count: CARDINAL ;
+BEGIN
+   count := 0 ;
+   FOR ch := 'a' TO 'z' DO
+      INC (count) ;
+      printf ("ch = %c, count = %d\n", ch, count)
+   END ;
+   IF count = 26
+   THEN
+      printf ("passed\n")
+   ELSE
+      printf ("failed\n") ;
+      exit (1)
+   END
+END test ;
+
+
+BEGIN
+   test
+END testforloopchar.
diff --git a/gcc/testsuite/gm2/pim/run/pass/testforloopchar2.mod b/gcc/testsuite/gm2/pim/run/pass/testforloopchar2.mod
new file mode 100644
index 00000000000..05478b2d5f2
--- /dev/null
+++ b/gcc/testsuite/gm2/pim/run/pass/testforloopchar2.mod
@@ -0,0 +1,27 @@
+MODULE testforloopchar2 ;
+
+FROM libc IMPORT printf, exit ;
+
+PROCEDURE test ;
+VAR
+   ch   : CHAR ;
+   count: CARDINAL ;
+BEGIN
+   count := 0 ;
+   FOR ch := 'a' TO 'z' BY CHR (2) DO
+      INC (count) ;
+      printf ("ch = %c, count = %d\n", ch, count)
+   END ;
+   IF count = 13
+   THEN
+      printf ("passed\n")
+   ELSE
+      printf ("failed\n") ;
+      exit (1)
+   END
+END test ;
+
+
+BEGIN
+   test
+END testforloopchar2.
diff --git a/gcc/testsuite/gm2/pim/run/pass/testforloopenum.mod b/gcc/testsuite/gm2/pim/run/pass/testforloopenum.mod
new file mode 100644
index 00000000000..3855cae0012
--- /dev/null
+++ b/gcc/testsuite/gm2/pim/run/pass/testforloopenum.mod
@@ -0,0 +1,30 @@
+MODULE testforloopenum ;
+
+FROM libc IMPORT printf, exit ;
+
+TYPE
+   colour = (red, green, blue, yellow) ;
+
+PROCEDURE test ;
+VAR
+   c    : colour ;
+   count: CARDINAL ;
+BEGIN
+   count := 0 ;
+   FOR c := red TO blue BY colour (2) DO
+      INC (count) ;
+      printf ("c = %d, count = %d\n", c, count)
+   END ;
+   IF count = 2
+   THEN
+      printf ("passed\n")
+   ELSE
+      printf ("failed\n") ;
+      exit (1)
+   END
+END test ;
+
+
+BEGIN
+   test
+END testforloopenum.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-05-03 19:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-03 19:48 [gcc r15-137] PR modula2/114929 extra for loop iteration count regression tests Gaius Mulley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).