![verify.cal] Verification test suite file for XCAL. ! Load this file as follows: "xcal/l:*verify.cal". "\t\tVerification test suite file for XCAL.\n" ;Say what we're doing ;/NE ;Do NOT Echo verify.cal file lines. "\t\t " /T ;Display current date and time centered on screen /NB ;Disable output Base-Prefix /ND ;Disable all debugging /NR ;Use Degrees for Transcendental functions /F:6 ;Limit output to a maximum of 6 digits after the decimal point /I:10 ;Set the input base to base-10 /O:10 ;Set the output base to base-10 /C ;Enter Command-Mode after completing this verification ; command file (do not exit from XCAL). "\n\n" ;Skip 2 lines "Variables defined at XCAL startup:\n\n" /V ;List startup Variables "\n\n" ;Skip 2 lines "Operator test: Zero-Identities; all result values should be zero. A non-\n" " zero value indicates the operator specified has failed\n" " (unless the result is \34very close\34 to zero in which case\n" " a double-floating precision limitation is indicated).\n\n" " Unary Plus and Addition: +" +1++1-2 " Unary Minus and Subtraction: -" -1--1 " Multiplication: *" 1*2*3-6 " Division: /" 36/6/3/2-1 " Exponentiation: ^" 2^10-1024 " Factorial: !" 6!-720 " Integer Modulus: %" 6.2%3 " Arithmetic (bitwise) AND: &" 5&10 " Arithmetic (bitwise) OR: |" (5|10)-15 " Arithmetic (bitwise) NOT: ~" (~(~0)) " Arithmetic (bitwise) NAND: ~&" (1~&3)-(~(1&3)) " Arithmetic (bitwise) NOR: ~|" (1~|3)-(~(1|3)) " Arithmetic Right Shift: >>" 8-(32>>2) " Arithmetic Left Shift: >>" 32-(8<<2) "\n\n" ;Skip 2 lines "Variable definition, reference, and deletion test:\n" "Definition:" Length=2 Width=3 Height=5 Radius=7 "Reference: " Area=Length*Width "=Length*Width" "Reference: " CylVolume=Pi*Radius^2*Height "=Pi*Radius^2*Height" "Delete: Length, Width, Height, Radius, Area, and CylVolume\n" Length= Width= Height= Radius= Area= CylVolume= "\n\n" ;Skip a line "Test the accuracy of Pi: the result should be \"Angle=45\" degrees.\n" Radian=57.29577951308232 ;Degrees per Radian Angle=Radian*Pi/4 ;This should be 45.0 degrees Radian= ;Clean up "\n\n" ;Skip 2 lines "Transcendental Function Test (all result values should be zero).\n" " A non-zero value indicates the function specified has failed\n" " (unless the result is \34very close\34 to zero in which case\n" " a double-floating precision limitation is indicated).\n\n" /S:S ;Save XCAL's current state /F:5/NR ;These are all identities for Zero. ZSin=Sin(0) ZCos=1-Cos(0) ZSinCos=1-(Sin(30)^2+Cos(30)^2) ZTan=Tan(ATan(Sin(30)/Cos(30))-30) ZCot=Cot(Pi)-(1.0/Tan(Pi)) ZSec=Sec(Pi)-(1.0/Cos(Pi)) ZCsc=Csc(Pi)-(1.0/Sin(Pi)) ZASinCos=ASin(1)+ACos(1)-90 ZACos=ACos(1) ZATan=ATan(Sin(180)/Cos(180)) ZACot=ACot(Pi)-ATan(1.0/Pi) ZASec=ASec(Pi)-ACos(1.0/Pi) ZACsc=ACsc(Pi)-ASin(1.0/Pi) ZSin2=Sin2(Pi)-(.5-.5*Cos(2*Pi)) ZSin3=Sin3(Pi)-(.75*Sin(Pi)-.25*Sin(3*Pi)) ZLog2=Log2(Angle)-Log(Angle)/Log(2) ZLog10=Log10(Angle)-Log(Angle)/Log(10) ZExp=Angle-Log(Exp(Angle)) Zexp2=Exp2(25)-2^25 Zexp10=Exp10(25)-1e+25 ZAbs=-Angle+Abs(-Angle) ZRoundUp=1-(Round(0.9)) /S:R ;Restore XCAL's previous state "\n\n" ;Skip 2 lines "Factor & Primes test:\n" " Factor(11!)\t " Factor(11!) "=11! (has 6 prime factors)" " Factor(59999) " Factor(59999) "\t\t\t(since 59999 is prime)" " Factor(1234567890)" Factor(1234567890) " (has 6 prime factors)\n" " PrimeCount=Primes(30000,31000) should compute 3341 primes of which\n" " 95 are between 30000 and 31000.\n\n" PrimeCount=Primes(30000,31000) PrimeCount= "\n\n" ;Skip 2 lines "Macro definition test; there should be no display of macros defined.\n" Octal(@expr)='/S:S /O:8 @expr /S:R' Hex(@Expr)='/S:S /O:16 @Expr /S:R' Sex(@Expr)='/S:S /O:60 @expr /S:R' And(@1,@2)='@1&@2' Or(@1,@2)='@1|@2' Area(@Length,@Width)='@Length*@Width' Volume(@Length,@Width,Height)='Area(@Length,@Width)*@Height' Avg(@*)='Total=0 i=0 {Total=Total+@* i=i+1} Total/i' Diameter(@Radius)='@Radius*2' Circum(@Radius)='Pi*Diameter(@Radius)' CircleArea(@Radius)='Pi*Radius^2' CylVolume(@Radius,@Height)='@Height*CircleArea(@Radius)' ConeVolume(@Radius,@Height)='1/2*CylVolume(@Radius,@Height)' SphereVol(@Radius)='4/3*Pi*@Radius^3' RightHypot(@SideA,@SideB)='(@SideA^2+@SideB^2)^(1/2)' "\n[End of Macro definition test]\n\n\n" ;Skip 2 lines /S:S ;Save XCAL's current state "XCAL Quoted String Test Suite\n" "----------------------------\n\n" "Define Variable VarA=Pi*2 and Macro MacA='Macro Text'\n" " VarA=6.283185\n" VarA=Pi*2 MacA='Macro Text' "\n" ;Skip a line "Set Quiet Mode & define VarB and MacB='More Macro Text'\n" "If this test succedes, the next line will be blank\n" /S:Q VarB=Pi*4 MacB='More Macro Text' /S:R "\n" ;Skip a line "Numeric Conversion Test:\n" "If successful, print the string 'ABCDEF' on the next line.\n" "\65\66\67\68\69\70\n" "\n" ;Skip a line "Tab Test: This prints a line of numbered tabstops.\n" " 1 2 3 4 5 6 7 8 9\n" "\t1\t2\t3\t4\t5\t6\t7\t8\t9\n" "\n" ;Skip a line "BackSlash Tab Test: This prints BackSlash delineated Tabstops.\n" " \\ \\ \\ \\ \\ \\ \\ \\ \\.\n" "\t\\\t\\\t\\\t\\\t\\\t\\\t\\\t\\\t\\.\n" "\n" ;Skip a line "Backspace and Return Test; print '123 456' on the next line.\n" " 6\b\b5\b\b4\r123\n" "\n\n" ;Skip 2 lines "Variable Replacement Test:\n" "Variable VarA is: 6.283185\n" "Variable VarA is: {VarA}\n\n" "Variable VarA is: 6.283185 and VarB is: 12.566371\n" "Variable VarA is: {VarA}\tand VarB is: {varB}\n\n" "Variable VarA is: 6.283185 and VarB=12.566371 while Pi=3.141593\n" "Variable VarA is: {VarA}\tand VarB={varB}\twhile Pi={PI}\n\n" "Variable VarA is: 6.283185 and \"a123\" should be on the next line.\n" "a123\n" "Variable VarA is: {VarA}\tand \"a123\" should be on the next line.\na123\n" "\n\n" ;Skip 2 lines "Macro Replacement Test:\n" "Macro MacA is: 'Macro Text'\n" "Macro MacA is: {$macA}\n\n" "Macro MacA is: 'Macro Text' and MacB is: 'More Macro Text'\n" "Macro MacA is: {$macA}\tand MacB is: {$macB}\n\n" "Macro MacA is: 'Macro Text' while VarA is still: 6.283185\n" "Macro MacA is: {$macA}\twhile VarA is still: {VarA}\n\n" "Macro MacA is: 'Macro Text' and \"a123\" should be on the next line.\n" "a123\n" "Macro MacA is: {$macA}\tand \"a123\" should be on the next line.\na123\n" "\n\n" ;Skip 2 lines "Quoted String Error in Var & $Mac Test\n" "Macro MacC is undefined: MacC={$macC}\n" "Variable VarC is undefined: VarC={VarC}\n\n" "Variable VarD is defined but not as a Macro.!\n" /S:S /S:Q VarD=444 /S:R "Variable VarD=444, but displayed as a Macro it should be: ?$VarD\n" "Variable VarD={VarD}, but displayed as a Macro it should be: {$VarD}\n" "\n" ;Skip a line "Display all defined Variables:\n" /V "\n\n" ;Skip 2 lines "Variable Deletion Test (Delete all variables except Pi and AnyLog). ZSin= ZCos= ZSinCos= ZTan= ZCot= ZSec= ZCsc= ZASinCos= ZACos= ZATan= ZACot= ZASec= ZACsc= ZSin2= ZSin3= ZLog2= ZLog10= ZExp= Zexp2= Zexp10= ZAbs= ZRoundUp= Angle= Octal= Hex= Sex= And= Or= Area= Volume= Avg= Diameter= Circum= CircleArea= CylVolume= ConeVolume= SphereVol= RightHypot= VarA= MacA= VarB= MacB= VarD= "\n" ;Skip a line "Test XCAL's nested command file handling capabilities.\n" ; By design, XCAL's command files may be nested 10 files ; deep. ; ; The max value shown for "Depth" is the maximum command file ; nesting depth for the implementation of XCAL under test. ; "\n[Starting command file tests." Depth=1 /L:*depth.cal "\nReturning to verify.cal\n" "Returning to XCAL top level. " Depth=Depth-1 Depth= ;Delete variable Depth /Q ;Exit immediately from this command file. "\n?Error in command file verify.cal.\n" ;This shouldn't be executed. ;********************************************************************** ;******* End of verify.cal ******* ;**********************************************************************