scummvm/engines/director/lingo/tests/sort.lingo
Scott Percival 9b29fff76c DIRECTOR: Make b_sort behaviour more accurate
Fixes the constants init loading section of Star Trek TNG
Episode Guide.
2023-06-08 09:16:30 +02:00

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.