diff options
author | Otto Moerbeek <otto@cvs.openbsd.org> | 2003-11-17 11:23:03 +0000 |
---|---|---|
committer | Otto Moerbeek <otto@cvs.openbsd.org> | 2003-11-17 11:23:03 +0000 |
commit | 91a2a458ec5c149c03c4f8782102ef7d4ebbb677 (patch) | |
tree | 11eea3cf31dca61f536d5cff4e700ca05478d6a6 /regress/usr.bin/bc | |
parent | e4ba37a5333bbb44cfd6157246e4d4f07b28ce6c (diff) |
Test new boolean operators and relational operators in arbitrary expressions.
Diffstat (limited to 'regress/usr.bin/bc')
-rw-r--r-- | regress/usr.bin/bc/Makefile | 7 | ||||
-rw-r--r-- | regress/usr.bin/bc/t14.in | 28 | ||||
-rw-r--r-- | regress/usr.bin/bc/t14.out | 78 | ||||
-rw-r--r-- | regress/usr.bin/bc/t15.in | 24 | ||||
-rw-r--r-- | regress/usr.bin/bc/t15.out | 55 | ||||
-rw-r--r-- | regress/usr.bin/bc/t16.in | 24 | ||||
-rw-r--r-- | regress/usr.bin/bc/t16.out | 48 |
7 files changed, 262 insertions, 2 deletions
diff --git a/regress/usr.bin/bc/Makefile b/regress/usr.bin/bc/Makefile index 10a9ceac669..51b59fe5a93 100644 --- a/regress/usr.bin/bc/Makefile +++ b/regress/usr.bin/bc/Makefile @@ -1,8 +1,8 @@ -# $OpenBSD: Makefile,v 1.6 2003/11/11 19:50:50 otto Exp $ +# $OpenBSD: Makefile,v 1.7 2003/11/17 11:23:02 otto Exp $ BC=bc -REGRESS_TARGETS=t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 t13 +REGRESS_TARGETS=t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 t13 t14 t15 t16 # .in: input file # .out: desired result @@ -20,6 +20,9 @@ REGRESS_TARGETS=t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 t13 # t11: if else # t12: print # t13: alternive forms of define and return +# t14: compare +# t15: boolean and +# t16: boolean or all: clean ${REGRESS_TARGET} diff --git a/regress/usr.bin/bc/t14.in b/regress/usr.bin/bc/t14.in new file mode 100644 index 00000000000..8f017150733 --- /dev/null +++ b/regress/usr.bin/bc/t14.in @@ -0,0 +1,28 @@ +if ((0 == 0)) "ok" else "nok" +if ((1 == 0)) "nok" else "ok" +if ((0 == 1)) "nok" else "ok" +print "\n" +if ((0 != 0)) "nok" else "ok" +if ((1 != 0)) "ok" else "nok" +if ((0 != 1)) "ok" else "nok" +print "\n" +if ((0 == 0)) "ok" else "nok" +if ((1 == 0)) "nok" else "ok" +if ((0 == 1)) "nok" else "ok" +print "\n" +if ((0 < 1)) "ok" else "nok" +if ((1 < 0)) "nok" else "ok" +if ((1 < 1)) "nok" else "ok" +print "\n" +if ((0 <= 1)) "ok" else "nok" +if ((1 <= 0)) "nok" else "ok" +if ((1 <= 1)) "ok" else "nok" +print "\n" +if ((0 > 1)) "nok" else "ok" +if ((1 > 0)) "ok" else "nok" +if ((1 > 1)) "nok" else "ok" +print "\n" +if ((0 >= 1)) "nok" else "ok" +if ((1 >= 0)) "ok" else "nok" +if ((1 >= 1)) "ok" else "nok" +print "\n" diff --git a/regress/usr.bin/bc/t14.out b/regress/usr.bin/bc/t14.out new file mode 100644 index 00000000000..cd4a5da828f --- /dev/null +++ b/regress/usr.bin/bc/t14.out @@ -0,0 +1,78 @@ +[[ok]P]s0 +[[nok]P]s1 + 0 0G 0!=0e1 +[[nok]P]s0 +[[ok]P]s1 + 1 0G 0!=0e1 +[[nok]P]s0 +[[ok]P]s1 + 0 1G 0!=0e1 +[ +]n +[[nok]P]s0 +[[ok]P]s1 + 0 0GN 0!=0e1 +[[ok]P]s0 +[[nok]P]s1 + 1 0GN 0!=0e1 +[[ok]P]s0 +[[nok]P]s1 + 0 1GN 0!=0e1 +[ +]n +[[ok]P]s0 +[[nok]P]s1 + 0 0G 0!=0e1 +[[nok]P]s0 +[[ok]P]s1 + 1 0G 0!=0e1 +[[nok]P]s0 +[[ok]P]s1 + 0 1G 0!=0e1 +[ +]n +[[ok]P]s0 +[[nok]P]s1 + 1 0( 0!=0e1 +[[nok]P]s0 +[[ok]P]s1 + 0 1( 0!=0e1 +[[nok]P]s0 +[[ok]P]s1 + 1 1( 0!=0e1 +[ +]n +[[ok]P]s0 +[[nok]P]s1 + 1 0{ 0!=0e1 +[[nok]P]s0 +[[ok]P]s1 + 0 1{ 0!=0e1 +[[ok]P]s0 +[[nok]P]s1 + 1 1{ 0!=0e1 +[ +]n +[[nok]P]s0 +[[ok]P]s1 + 0 1( 0!=0e1 +[[ok]P]s0 +[[nok]P]s1 + 1 0( 0!=0e1 +[[nok]P]s0 +[[ok]P]s1 + 1 1( 0!=0e1 +[ +]n +[[nok]P]s0 +[[ok]P]s1 + 0 1{ 0!=0e1 +[[ok]P]s0 +[[nok]P]s1 + 1 0{ 0!=0e1 +[[ok]P]s0 +[[nok]P]s1 + 1 1{ 0!=0e1 +[ +]n +q
\ No newline at end of file diff --git a/regress/usr.bin/bc/t15.in b/regress/usr.bin/bc/t15.in new file mode 100644 index 00000000000..692d88b6216 --- /dev/null +++ b/regress/usr.bin/bc/t15.in @@ -0,0 +1,24 @@ +if (1 && 2) "ok1" +if (0 && 2) "nok2" else "ok2" +if (3 && 0) "nok3" else "ok3" +if (0 && 0) "nok4" else "ok4" +if (0 && 0 && 0) "nok5" else "ok5" +if (0 && 1 && 0) "nok6" else "ok6" +if (1 && 1 && 1) "ok7" else "nok7" +print "\n" +define f() { + "f" +} +define g() { + "g" + return 1 +} +if (f() && g()) { + "nok8" +} else "ok8" +if (!f() && g()) { + "ok9" +} else "nok9" +print "\n" +if (1 < 2 && 3 < 4) "ok10" else "nok10" +print "\n" diff --git a/regress/usr.bin/bc/t15.out b/regress/usr.bin/bc/t15.out new file mode 100644 index 00000000000..a23127db804 --- /dev/null +++ b/regress/usr.bin/bc/t15.out @@ -0,0 +1,55 @@ +[R 2]s1 +[[ok1]P]s0 + 1d0!=1 0!=0 +[R 2]s1 +[[nok2]P]s0 +[[ok2]P]s2 + 0d0!=1 0!=0e2 +[R 0]s1 +[[nok3]P]s0 +[[ok3]P]s2 + 3d0!=1 0!=0e2 +[R 0]s1 +[[nok4]P]s0 +[[ok4]P]s2 + 0d0!=1 0!=0e2 +[R 0]s1 +[R 0]s2 +[[nok5]P]s0 +[[ok5]P]s3 + 0d0!=1d0!=2 0!=0e3 +[R 1]s1 +[R 0]s2 +[[nok6]P]s0 +[[ok6]P]s3 + 0d0!=1d0!=2 0!=0e3 +[R 1]s1 +[R 1]s2 +[[ok7]P]s0 +[[nok7]P]s3 + 1d0!=1d0!=2 0!=0e3 +[ +]n +[[f]P0 1Q]s + + +[[g]P 1 1Q0 1Q]s + + +[Rlx]s1 +[[nok8]P]s0 +[[ok8]P]s2 +lxd0!=1 0!=0e2 +[Rlx]s1 +[[ok9]P]s0 +[[nok9]P]s2 +lxNd0!=1 0!=0e2 +[ +]n +[R 4 3(]s1 +[[ok10]P]s0 +[[nok10]P]s2 + 2 1(d0!=1 0!=0e2 +[ +]n +q
\ No newline at end of file diff --git a/regress/usr.bin/bc/t16.in b/regress/usr.bin/bc/t16.in new file mode 100644 index 00000000000..eef924980f3 --- /dev/null +++ b/regress/usr.bin/bc/t16.in @@ -0,0 +1,24 @@ +if (0 || 0) "nok1" else "ok1" +if (1 || 0) "ok2" else "nok2" +if (0 || 1) "ok3" else "nok3" +if (1 || 1) "ok4" else "nok4" +print "\n" + +define f() { + "f"; + return 0 +} +define g() { + "g"; + return 0 +} +define h() { + "h"; + return 1 +} + +if (f() || g() || h()) "ok5" else "nok5" +if (f() || g() || !h()) "nok6" else "ok6" +if (f() || !h() || g()) "nok7" else "ok7" + +print "\n" diff --git a/regress/usr.bin/bc/t16.out b/regress/usr.bin/bc/t16.out new file mode 100644 index 00000000000..cf01ac74283 --- /dev/null +++ b/regress/usr.bin/bc/t16.out @@ -0,0 +1,48 @@ +[R 0]s1 +[[nok1]P]s0 +[[ok1]P]s2 + 0d0=1 0!=0e2 +[R 0]s1 +[[ok2]P]s0 +[[nok2]P]s2 + 1d0=1 0!=0e2 +[R 1]s1 +[[ok3]P]s0 +[[nok3]P]s2 + 0d0=1 0!=0e2 +[R 1]s1 +[[ok4]P]s0 +[[nok4]P]s2 + 1d0=1 0!=0e2 +[ +]n + +[[f]P 0 1Q0 1Q]s + + +[[g]P 0 1Q0 1Q]s + + +[[h]P 1 1Q0 1Q]s + + + +[Rlx]s1 +[Rlx]s2 +[[ok5]P]s0 +[[nok5]P]s3 +lxd0=1d0=2 0!=0e3 +[Rlx]s1 +[RlxN]s2 +[[nok6]P]s0 +[[ok6]P]s3 +lxd0=1d0=2 0!=0e3 +[RlxN]s1 +[Rlx]s2 +[[nok7]P]s0 +[[ok7]P]s3 +lxd0=1d0=2 0!=0e3 + +[ +]n +q
\ No newline at end of file |