mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-30 15:21:12 +00:00
Test for equality on very long linked lists
This commit is contained in:
parent
0d8a2c8a49
commit
409a32b192
1 changed files with 33 additions and 0 deletions
|
@ -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() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue