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
94 lines
1.8 KiB
Text
94 lines
1.8 KiB
Text
|
|
// 2015-01-24 Bodom
|
|
//
|
|
// Tests comparison operators
|
|
// All tests expected to be true
|
|
|
|
// Int and Double
|
|
var i1 := 1;
|
|
var d1 := 1.0;
|
|
var i2 := 2;
|
|
var d2 := 2.0;
|
|
print( i1 == d1 );
|
|
print( i1 == i2 - 1 );
|
|
print( i1 != i2 );
|
|
print( i1 != d2 );
|
|
print( i1 < i2 );
|
|
print( i1 <= i2 );
|
|
print( i1 < d2 );
|
|
print( i1 <= d2 );
|
|
print( i2 > i1 );
|
|
print( i2 > d1 );
|
|
print( i2 >= i1 );
|
|
print( i2 >= d2 );
|
|
print( d1 == d1 );
|
|
print( d1 != i2 );
|
|
print( d1 != d2 );
|
|
print( d1 < i2 );
|
|
print( d1 <= i2 );
|
|
print( d1 < d2 );
|
|
print( d1 <= d2 );
|
|
print( d2 > i1 );
|
|
print( d2 > d1 );
|
|
print( d2 >= i1 );
|
|
print( d2 >= d2 );
|
|
|
|
// String
|
|
var sa := "aaaaaaaaaaaa";
|
|
var sb := "bbbbbbbbbbbb";
|
|
print( sa != sb );
|
|
print( sa == StrReplace( sa, "b", "a" ) );
|
|
print( sa < sb );
|
|
print( sa <= sb );
|
|
print( sb > sa );
|
|
print( sb >= sa );
|
|
|
|
// Uninit and Error
|
|
var un;
|
|
var err := error{};
|
|
print( un == err );
|
|
print( un != 0 );
|
|
print( err != 0 );
|
|
print( un != i1 );
|
|
print( err != i1 );
|
|
print( un < i1 );
|
|
print( err < i1 );
|
|
print( un <= i1 );
|
|
print( err <= i1 );
|
|
print( d1 > err );
|
|
print( d1 > un );
|
|
print( d1 >= err );
|
|
print( d1 >= un );
|
|
|
|
// Array
|
|
var a1 := array{ 1, 2, 3 };
|
|
var a2 := array{ 2, 3, 4 };
|
|
var a3 := array{ i1, i2, i2 + 1 };
|
|
print( a1 != a2 );
|
|
print( a1 == a3 );
|
|
|
|
// Struct
|
|
var t1 := struct{ a := 1, b := 2 };
|
|
var t2 := struct{ a := 2, b := 3 };
|
|
print( t1 != t2 );
|
|
|
|
// Comparison between objects of different kind
|
|
// (undocumented "undefined" behavior, just checked for internal consistency)
|
|
// OTUnknown = 0,
|
|
// OTUninit = 1,
|
|
// OTString = 2,
|
|
// OTLong = 3,
|
|
// OTDouble = 4,
|
|
// OTArray = 5,
|
|
// OTApplicPtr = 6,
|
|
// OTApplicObj = 7,
|
|
// OTError = 8,
|
|
// OTDictionary = 9,
|
|
// OTStruct = 10,
|
|
// OTPacket = 11,
|
|
print( t1 != a1 );
|
|
print( 0 != struct{} );
|
|
print( 0 > un );
|
|
print( 0 > err );
|
|
print( dictionary{} < struct{} );
|
|
print( array{} > 3.0 );
|