1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
|
#!/usr/local/bin/fim -E
# $Id: sanity.fim 203 2009-01-10 11:13:17Z dezperado $
# this script is going to be replaced, or regenerated, from the tests contained in src/testdir.
#!/usr/local/bin/fim -t -E
#!/usr/local/bin/fim --no-framebuffer -E
#!/usr/bin/env fim -E
#
# This script tests the Fim language correctness.
# It is used during Fim maintenance, debugging, and developement.
#
# Fim should execute this script and return 0 if all tests pass.
#
if ( 1 ) { echo "if construct seems working"; }
else { echo "if construct seems not working"; }
if ( 0 ) { echo "if construct seems not working"; }
else { echo "if construct seems working"; }
if ( 0 == 0 ) { echo "equality works"; }
else { echo "equality does not work"; return -1; }
if ( 0 != 1 ) { echo "disequality works"; }
else { echo "disequality does not work"; return -1; }
if ( 40 == 50-10 ) { echo "basic integer arithmetics works"; }
else { echo "basic integer arithmetics does not work"; return -1; }
if ( 41 != 50-10 ) { echo "basic integer arithmetics works"; }
else { echo "basic integer arithmetics does not work"; return -1; }
iv=1;
if ( iv ) { echo "integer variables work"; }
else { echo "integer variables don't work"; return -1; }
iv=0;
if ( !iv ) { echo "integer variables work"; }
else { echo "integer variables don't work"; return -1; }
if ( !!iv ) { echo "integer variables don't work"; return -1; }
else { echo "integer variables work"; }
if ( !!!iv ) { echo "integer variables work"; }
else { echo "integer variables don't work"; return -1; }
if ( iv == 0 ) { echo "integer variables work"; }
else { echo "integer variables don't work"; return -1; }
if ( iv == 3*iv-2*iv ) { echo "integer variables work"; }
else { echo "integer variables don't work"; return -1; }
if ( iv != 3*iv-2*iv ) { echo "integer variables don't work"; return -1; }
else { echo "integer variables work"; }
if ( iv != iv ) { echo "integer variables don't work"; return -1; }
else { echo "integer variables work"; }
# Like in Vim, the following form is not correct for an arithmetic assignment:
# fv=2.0;
# The next one is the correct one:
fv="2.0";
if ( fv ) { echo "float variables work"; }
else { echo "float variables don't work"; return -1; }
if ( !fv ) { echo "float variables don't work"; return -1; }
else { echo "float variables work"; }
if ( !!fv ) { echo "float variables work"; }
else { echo "float variables don't work"; return -1; }
if ( !!!fv ) { echo "float variables don't work"; return -1; }
else { echo "float variables work"; }
if ( fv == "0.0" ) { echo "float variables don't work"; return -1; }
else { echo "float variables work"; }
if ( ! ( fv != "0.0" ) ) { echo "float variables don't work"; return -1; }
else { echo "float variables work"; }
if ( !!! ( fv != "0.0" ) ) { echo "float variables don't work"; return -1; }
else { echo "float variables work"; }
if ( !! ( fv == "0.0" ) ) { echo "float variables don't work"; return -1; }
else { echo "float variables work"; }
if ( fv == "2.0" ) { echo "float variables work"; }
else { echo "float variables don't work"; return -1; }
if ( fv != "3.0" ) { echo "float variables work"; }
else { echo "float variables don't work"; return -1; }
echo "tab works";
echo
"newline works";
if
( 1==1 )
{
echo "multiline" " and multiarg constructs ".
"work"
}
else { return -1; }
if( "aba"."a"=="a"."ba"."a" ){echo "string collation works";}
else {echo "string collation does not work"; return -1;}
if( "aba"!="a"."sba"."a" ){echo "string collation works";}
else {echo "string collation does not work"; return -1;}
if( "aba"=~"a.*a" ){echo "regular expressions work";}
else {echo "regular expressions does not work"; return -1;}
if( !("aba"=~"a.*a") ) {echo "single negations on regular expressions does not work"; return -1;}
else {echo "single negations on regular expressions work";}
# the following doesn't work in fim 0.3.
if( !(!("aba"=~"a.*a")) ){echo "double negations on regular expressions work";}
else {echo "double negations on regular expressions does not work"; }
a=1;
{a=5}
if( a==5 ){echo "{command} constructs work";}
else {echo "{command} constructs don't work";}
{a=10;}
if( a==10 ){echo "{command;} constructs work";}
else {echo "{command;} constructs don't work";}
#the following does not work
#{a=20;;}
if( a==20 ){echo "{command;;} constructs work";}
else {echo "{command;;} constructs don't work";}
rc=0;
return rc;
|