mirror of
https://github.com/polserver/polserver
synced 2026-08-13 08:23:08 -04:00
* Format escript testsuite
* Manual formatting for escript testsuite
- Add format-off to places where formatter does what it should, but we don't like the results
- Manually change places where formatter outputs weird things _without_ format-off, so next format-all would show changes if not fixed
* Update .err files; add update_err.py helper script
Use the format `:line:col: message` for all .err file checks. This
allows us to change the file names without needing to edit the .err
contents.
Note that `in/inc0{1,2}.err` need have error messages between POSIX and
Windows, so their messages are a bit more "generic" than the other errs.
* Format pol testsuite
* Manual formatting for pol testsuite
* Format pol-core modules
* Manual formatting for pol-core modules
* Additional format pol-core modules
Use FormatterLineWidth=10000 since module functions must be on one line
because of the parse_modules target
* Address Discord comments
- Support multi-line module function declarations in parse_modules
* Format on df07831
48 lines
1.1 KiB
Text
48 lines
1.1 KiB
Text
program test_operators()
|
|
/* integer plus something: */
|
|
test_plus( 2, 3, 5 );
|
|
test_plus( 3, 6.5, 9.5 );
|
|
test_plus( 3, "4", "34" );
|
|
|
|
/* string plus something */
|
|
test_plus( "a", "b", "ab" );
|
|
test_plus( "a", 4, "a4" );
|
|
test_plus( "7", 3, "73" );
|
|
test_plus( "7", "3", "73" );
|
|
test_plus( "a", 6.5, "a6.5" );
|
|
test_plus( "3", 4.3, "34.3" );
|
|
|
|
/* real plus something */
|
|
test_plus( 1.7, 3, 4.7 );
|
|
test_plus( 3.2, 6.5, 9.7 );
|
|
test_plus( 3.1, "4", "3.14" );
|
|
|
|
/* integer minus something */
|
|
test_minus( 2, 3, -1 );
|
|
test_minus( 7, 2.3, 4.7 );
|
|
test_minus( 12, "2", "1" );
|
|
test_minus( 12, "a", "12" );
|
|
|
|
endprogram
|
|
|
|
function test_plus( a, b, exp )
|
|
var res := a + b;
|
|
print( "testing " + a + " + " + b + " expects " + exp );
|
|
print( " result: " + res );
|
|
if ( res == exp )
|
|
print( " Success!" );
|
|
else
|
|
print( " Failure!" );
|
|
endif
|
|
endfunction
|
|
|
|
function test_minus( a, b, exp )
|
|
var res := a - b;
|
|
print( "testing " + a + " - " + b + " expects " + exp );
|
|
print( " result: " + res );
|
|
if ( res == exp )
|
|
print( " Success!" );
|
|
else
|
|
print( " Failure!" );
|
|
endif
|
|
endfunction
|