mirror of
https://github.com/scummvm/scummvm.git
synced 2025-04-02 10:52:32 -04:00
24 lines
830 B
Text
24 lines
830 B
Text
|
|
-- Just ints, use numeric sort
|
|
set test to [200, 100, 25, 4, 3, 2, 1]
|
|
sort(test)
|
|
scummvmAssertEqual(test, [1, 2, 3, 4, 25, 100, 200])
|
|
|
|
-- Just floats, use numeric sort
|
|
set test to [200.5, 100.5, 25.5, 4.5, 3.5, 2.5, 1.5]
|
|
sort(test)
|
|
scummvmAssertEqual(test, [1.5, 2.5, 3.5, 4.5, 25.5, 100.5, 200.5])
|
|
|
|
-- ints and floats, use numeric sort
|
|
set test to [200, 100, 25, 4, 3, 2, 1, 2.5]
|
|
sort(test)
|
|
scummvmAssertEqual(test, [1, 2, 2.5, 3, 4, 25, 100, 200])
|
|
|
|
-- Just strings, use string sort
|
|
set test to ["200", "100", "25", "4", "3", "2", "1", "2.5", "oh no"]
|
|
sort(test)
|
|
scummvmAssertEqual(test, ["1", "100", "2", "2.5", "200", "25", "3", "4", "oh no"])
|
|
|
|
-- For combined types (e.g. ints and strings), the result is undefined.
|
|
-- The real interpreter will give an answer that's nearly the same as the
|
|
-- string sort order, or softlock.
|