summaryrefslogtreecommitdiff
path: root/tests/special/keyboard.icn
diff options
context:
space:
mode:
Diffstat (limited to 'tests/special/keyboard.icn')
-rw-r--r--tests/special/keyboard.icn42
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/special/keyboard.icn b/tests/special/keyboard.icn
new file mode 100644
index 0000000..eb9051e
--- /dev/null
+++ b/tests/special/keyboard.icn
@@ -0,0 +1,42 @@
+# This program can be used to test keyboard functions. It was provided
+# by Richard Goerwitz.
+
+procedure main()
+
+ write("\nTest 1: You should see characters echoed as you type them, and")
+ write("then a message confirming the characters you type. Hit ^D when")
+ write("finished with this test.\n")
+
+ while c := getche() do {
+ if c == "\x04" then break
+ write("you hit ",image(c))
+
+ }
+
+ write("\nTest 2: You should NOT see chars echoed as you type them, but")
+ write("you will see a message confirming the chars you type. Hit ^D when")
+ write("finished with this test.\n")
+
+ while c := getch() do {
+ if c == "\x04" then break
+ write("you hit ",image(c))
+ }
+
+ write("\nTest 3: You should see characters echoed as you type them, and")
+ write("a message confirming the chars you type. Hit your Quit key when")
+ write("finished with this test (not ^D). Hitting Quit should cause")
+ write("normal program termination, with exit status 1. NOTE that under")
+ write("DOS, characters will not always be echoed as you type them; this")
+ write("is the big difference between UNIX and DOS kbhit/getch interac-")
+ write("tions.\n")
+
+ repeat {
+ if kbhit() then
+ write("you hit ", image(getche()))
+ every 1 to 500
+ if kbhit() then
+ write("you hit ", image(getch()))
+ every 1 to 500
+ }
+
+end