LSL-PyOptimizer/unit_tests/expr.suite/sort.lsl
Sei Lisa 1867dc78e7 Add the new test suite.
This test suite has been in use for a long time now, in place of the obsolete and unmanageable testparser.py and testfuncs.py. It verifies the complete optimizer output to stdout and stderr, to ensure that the output matches the expectations.

See unit_tests/README.txt for more info.
2019-01-04 20:27:36 +01:00

33 lines
1.3 KiB
Text
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

llListSort([<1.,2.,3.,4.>,<2.,3.,4.,5.>,<5.,4.,3.,2.>,<0.,-1.,-2.,-3.>,
<4.,3.,2.,1.>,<3.,2.,1.,0.>],1,0)
+ "********"
+ llListSort([<1.,2.,3.,4.>,<2.,3.,4.,5.>,<5.,4.,3.,2.>,<0.,-1.,-2.,-3.>,
<4.,3.,2.,1.>,<3.,2.,1.,0.>],1,1)
+ "********"
+ llListSort([<1.,0.,0.>,<0.,3.,0.>,<0.,0.,1.>,<3.,0.,0.>],1,1)
+ "********"
+ llListSort([2,0,1,1,2,2,2,3,2,4,1,5,2,6], 2, 1)
+ "********"
+ llListSort([2,0,1,1,2,2,2,3,2,4,1,5,2,6], 2, 0)
+ "********"
+ llListSort([2,0,1,1,2,2,2,3,2,4,1,5,2,6,3], 2, 1)
+ "********"
// NaN in sort behaves strangely. Also when inside vectors.
+ llListSort([-1., 9., 3., 2., (float)"NaN", 5., 1.],1,1)
+ "********"
+ llListSort([<2.,0.,0.>,<1.,(float)"NaN",0.>],1,1)
+ "********"
+ llListSort([<1.,(float)"NaN",0.>,<2.,0.,0.>],1,1)
+ "********"
+ llListSort([<2.,0.,0.>,<1.,(float)"NaN",0.>],1,0)
+ "********"
+ llListSort([<1.,(float)"NaN",0.>,<2.,0.,0.>],1,0)
+ "********"
// This proves that it does not sort by UTF-16 words, but by code points.
// Otherwise u"\U0001d41a" would be before u"\ufb01" (because the UTF-16
// of u"\U0001d41a" is 0xD835 0xDC1A)
+ llListSort(["fi","á", "𝐚", "a"],1,1)
+ "********"
+ llListSort([2, "B", "C", 3, 1, "A"], 1, TRUE)
+ "********"
+ llListSort([2, "B", "C", 3, 1, "A"], 1, FALSE)