feat(tvix/eval): Implement comparison for lists
Lists are compared lexicographically in C++ nix as of [0], and our
updated nix test suites depend on this. This implements comparison of
list values in `Value::nix_cmp` using a very similar algorithm to what
C++ does - similarly to there, this requires passing in the VM so we can
force thunks in the list elements as we go.
[0]: 09471d2680
#
Change-Id: I5d8bb07f90647a1fec83f775243e21af856afbb1
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7070
Autosubmit: grfn <grfn@gws.fyi>
Reviewed-by: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
This commit is contained in:
parent
b8a7dba709
commit
d0a836b0e1
7 changed files with 45 additions and 3 deletions
|
@ -0,0 +1 @@
|
|||
[ false true true true false true false false false true false false false true true ]
|
17
tvix/eval/src/tests/tvix_tests/eval-okay-compare-lists.nix
Normal file
17
tvix/eval/src/tests/tvix_tests/eval-okay-compare-lists.nix
Normal file
|
@ -0,0 +1,17 @@
|
|||
[
|
||||
([1 2] < [1])
|
||||
([1 2] < [2 3])
|
||||
([1 2] < [2])
|
||||
([1 2] < [1 2 3])
|
||||
([3 4] < [1])
|
||||
([1 2] > [1])
|
||||
([1 2] > [2 3])
|
||||
([1 2] > [2])
|
||||
([1 2] > [1 2 3])
|
||||
([3 4] > [1])
|
||||
([1 2] <= [1])
|
||||
([1 2] >= [2 3])
|
||||
([1 2] >= [2])
|
||||
([1 2] <= [1 2 3])
|
||||
([3 4] >= [1])
|
||||
]
|
Loading…
Add table
Add a link
Reference in a new issue