]> thyrsus.com Git - intercal.git/commitdiff
A test program for the IFFI fingerprint
authorAlex Smith <ais523@bham.ac.uk>
Mon, 7 Jul 2008 01:09:35 +0000 (21:09 -0400)
committerEric S. Raymond <esr@thyrsus.com>
Thu, 26 Aug 2010 00:35:10 +0000 (20:35 -0400)
pit/CATALOG
pit/tests/iffit.doc [new file with mode: 0644]
pit/tests/iffit1.i [new file with mode: 0644]
pit/tests/iffit2.b98 [new file with mode: 0644]

index f1990a428a3e8b2b9635c00e7b26fcfe60730d37..e5aa975b94e5eeb805db97316c73e4bc88eb4279 100644 (file)
@@ -8,7 +8,9 @@ COPYING.txt from the main installation directory if you want to
 redistribute these separately from that compiler.\r
 \r
 The subdirectory lib contains code fragments that are not complete\r
-programs.\r
+programs; the programs in explib are expansion libraries written in C,\r
+which serve as examples of the C-INTERCAL to C interface as well as\r
+potentially being useful.\r
 \r
 Contents:\r
 \r
@@ -130,6 +132,9 @@ by Alex Smith
   tests/ignorret.doc  What ignorret does on several compilers\r
   tests/normaldist.i  Checking the standard deviation of (1910)\r
   tests/testcreate.i  A test for the CREATE statement\r
+  tests/iffit1.i      The INTERCAL side of the INTERCAL/Funge-98 test\r
+  tests/iffit2.b98    The Funge side of the INTERCAL/Funge-98 test\r
+  tests/iffit.doc     Documentation for the INTERCAL/Funge-98 test\r
   explib/syslibc.c    The INTERCAL base 2 syslib, optimised version in C\r
   explib/compunex.c   An example flow-control routine (computed NEXT)\r
   explib/ecto_b98.c   A library that links INTERCAL and Funge-98 code\r
diff --git a/pit/tests/iffit.doc b/pit/tests/iffit.doc
new file mode 100644 (file)
index 0000000..380ec9e
--- /dev/null
@@ -0,0 +1,51 @@
+iffit1.i and iffit2.b98 are a test of the C-INTERCAL/cfunge external
+calls system. To use the test, use this command:
+
+ick -ea iffit1.i iffit2.b98
+
+What follows is the expected output, annotated to show what causes
+each line to be printed.
+
+Before IFFI... Printed by the Funge program before IFFI is loaded.
+0              Printed immediately after IFFI loads; the program then
+               yields immediately, running the INTERCAL program.
+I             Printed at the start of the INTERCAL program; tests Y.
+2             Printed by the Funge program after (100) is NEXTed to.
+              This tests NEXTING to an L in the Funge program.
+III           Printed by INTERCAL after the Funge program does 2R
+              (i.e. RESUME 2).
+IV            Tests COMING FROM an L when in mark-mode after a NEXT.
+5             Tests NEXTING FROM the INTERCAL program to the Funge
+              program using X.
+VI            Tests RESUMING to the INTERCAL program after the NEXT
+              FROM in the Befunge program.
+VII           Tests that COME FROMs happen at the end of a command.
+8             Tests COMING FROM the INTERCAL program to the Funge
+              program using C.
+IX            Tests FORGET using F, and also RESUME after a COME FROM
+              in the Befunge program.
+X             This (irrelevantly) tests ONCE in the INTERCAL program.
+11            This (likewise irrelevantly) tests that p in Funge has
+              correctly altered the flow of control.
+XII           Tests COMING FROM an L when not in mark-mode.
+13            Tests variable access using G in the Funge program to
+              read an INTERCAL variable, also a second marker.
+XIV           Tests the use of S to set an INTERCAL variable.
+15            Tests that CREATEd commands send values correctly.
+16            Tests that CREATEd commands send bitwidths correctly.
+17            Tests that CREATEd commands send names correctly.
+              The above three tests test CREATION using A and D.
+XVIII         Tests that V sets arguments to CREATED commands
+              correctly, and also that Y correctly reflects the
+              second time.
+
+At this point the program should end, having tested all the commands
+in the IFFI fingerprint. (Obviously, this is not an exhaustive test,
+because, for instance, G was only used to get onespot variables not
+twospot variables.)
+
+It is an interesting challenge to try to figure out how the tests
+work, especially given that the Funge program is self-modifying, the
+statements in the INTERCAL program don't always do the same thing
+every time they're run, and the Funge program modifies the syntax of
+the INTERCAL program at runtime.
diff --git a/pit/tests/iffit1.i b/pit/tests/iffit1.i
new file mode 100644 (file)
index 0000000..b094adc
--- /dev/null
@@ -0,0 +1,30 @@
+       DO READ OUT #1
+(2)    PLEASE DO (4) NEXT
+       DO READ OUT #9
+       DO REINSTATE (18)
+       DO (110) NEXT
+(4)    PLEASE DO (7) NEXT
+       DO REINSTATE (9)
+       PLEASE DO READ OUT #3
+(7)    DO (100) NEXT
+       DO YOU REALISE THAT THIS SHOULD BE UNREACHABLE?
+(9)    DON'T COME FROM (100)
+(110)  DO (21) NEXT
+       DO READ OUT #6
+       DO (120) NEXT
+       DO FORGET THINGS CORRECTLY
+(120)  DO READ OUT #7
+       DO AVOID THIS LINE TOO
+(18)   DON'T COME FROM (9)
+       DO READ OUT #12
+       PLEASE DO .1 <- #13
+       PLEASE DO (130) NEXT
+       DO READ OUT .1
+       PLEASE DO (140) NEXT
+       PLEASE DO .17 <- #15
+       DO T .17
+       DO READ OUT .17
+       DO GIVE UP
+(21)   PLEASE DO READ OUT #4 ONCE
+       DON'T READ OUT #10 ONCE
+       PLEASE DO RESUME #1
diff --git a/pit/tests/iffit2.b98 b/pit/tests/iffit2.b98
new file mode 100644 (file)
index 0000000..b263c6c
--- /dev/null
@@ -0,0 +1,14 @@
+<v"Before IFFI..."a
+v>:#,_  #v         #<
+>"IFFI"4#v('0,a,Y
+>        >'E,'r,'r,a,@
+   >' 35#^p#    1# R#<
+ ; ^,a<,,:1' v< v;v1e<
+      ^p5< >v'X ;v>Sv.
+ ;e*L".T"d$^;5*vd·a; G
+^  <  <  ^<',<b>a *L1^
+,R> 2R^       a ;^  >a
+ 1^,a,2'$$L*aa·#<ac*Cv
+   #  '8,a,2F#a1R   v>
+#^Y^ >a,.a,9; f;2*0V#z
+$\$\.^R1A*fa< >*L0D.a,