From: Alex Smith Date: Mon, 7 Jul 2008 01:09:35 +0000 (-0400) Subject: A test program for the IFFI fingerprint X-Git-Tag: 0.29~203 X-Git-Url: http://thyrsus.com/gitweb/?a=commitdiff_plain;h=db31292bee913b14e42b5637ee35d149c4391fcc;p=intercal.git A test program for the IFFI fingerprint --- diff --git a/pit/CATALOG b/pit/CATALOG index f1990a4..e5aa975 100644 --- a/pit/CATALOG +++ b/pit/CATALOG @@ -8,7 +8,9 @@ COPYING.txt from the main installation directory if you want to redistribute these separately from that compiler. The subdirectory lib contains code fragments that are not complete -programs. +programs; the programs in explib are expansion libraries written in C, +which serve as examples of the C-INTERCAL to C interface as well as +potentially being useful. Contents: @@ -130,6 +132,9 @@ by Alex Smith tests/ignorret.doc What ignorret does on several compilers tests/normaldist.i Checking the standard deviation of (1910) tests/testcreate.i A test for the CREATE statement + tests/iffit1.i The INTERCAL side of the INTERCAL/Funge-98 test + tests/iffit2.b98 The Funge side of the INTERCAL/Funge-98 test + tests/iffit.doc Documentation for the INTERCAL/Funge-98 test explib/syslibc.c The INTERCAL base 2 syslib, optimised version in C explib/compunex.c An example flow-control routine (computed NEXT) explib/ecto_b98.c A library that links INTERCAL and Funge-98 code diff --git a/pit/tests/iffit.doc b/pit/tests/iffit.doc new file mode 100644 index 0000000..380ec9e --- /dev/null +++ b/pit/tests/iffit.doc @@ -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 index 0000000..b094adc --- /dev/null +++ b/pit/tests/iffit1.i @@ -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 index 0000000..b263c6c --- /dev/null +++ b/pit/tests/iffit2.b98 @@ -0,0 +1,14 @@ +:#,_ #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 +^ < < ^<',a *L1^ +,R> 2R^ a ;^ >a + 1^,a,2'$$L*aa·# +#^Y^ >a,.a,9; f;2*0V#z +$\$\.^R1A*fa< >*L0D.a,