Test for equality on very long linked lists

This commit is contained in:
Brian Carroll 2021-12-27 15:05:59 +00:00
parent 0d8a2c8a49
commit 409a32b192

View file

@ -372,6 +372,39 @@ fn eq_linked_list_false() {
);
}
#[test]
#[cfg(any(feature = "gen-wasm"))]
fn eq_linked_list_long() {
assert_evals_to!(
indoc!(
r#"
app "test" provides [ main ] to "./platform"
LinkedList a : [ Nil, Cons a (LinkedList a) ]
prependOnes = \n, tail ->
if n == 0 then
tail
else
prependOnes (n-1) (Cons 1 tail)
main =
n = 100_000
x : LinkedList I64
x = prependOnes n (Cons 999 Nil)
y : LinkedList I64
y = prependOnes n (Cons 123 Nil)
y == x
"#
),
false,
bool
);
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
fn eq_nullable_expr() {