mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 23:04:49 +00:00
update tests
This commit is contained in:
parent
165672330d
commit
f3b8c707b1
1 changed files with 59 additions and 3 deletions
|
@ -1122,6 +1122,40 @@ mod gen_primitives {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn linked_list_is_singleton() {
|
||||||
|
assert_non_opt_evals_to!(
|
||||||
|
indoc!(
|
||||||
|
r#"
|
||||||
|
app "test" provides [ main ] to "./platform"
|
||||||
|
|
||||||
|
ConsList a : [ Cons a (ConsList a), Nil ]
|
||||||
|
|
||||||
|
empty : ConsList a
|
||||||
|
empty = Nil
|
||||||
|
|
||||||
|
isSingleton : ConsList a -> Bool
|
||||||
|
isSingleton = \list ->
|
||||||
|
when list is
|
||||||
|
Cons _ Nil ->
|
||||||
|
True
|
||||||
|
|
||||||
|
_ ->
|
||||||
|
False
|
||||||
|
|
||||||
|
main : Bool
|
||||||
|
main =
|
||||||
|
myList : ConsList I64
|
||||||
|
myList = empty
|
||||||
|
|
||||||
|
isSingleton myList
|
||||||
|
"#
|
||||||
|
),
|
||||||
|
false,
|
||||||
|
bool
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn linked_list_is_empty_1() {
|
fn linked_list_is_empty_1() {
|
||||||
assert_non_opt_evals_to!(
|
assert_non_opt_evals_to!(
|
||||||
|
@ -1176,7 +1210,7 @@ mod gen_primitives {
|
||||||
|
|
||||||
main : Bool
|
main : Bool
|
||||||
main =
|
main =
|
||||||
myList : ConsList (Int *)
|
myList : ConsList I64
|
||||||
myList = Cons 0x1 Nil
|
myList = Cons 0x1 Nil
|
||||||
|
|
||||||
isEmpty myList
|
isEmpty myList
|
||||||
|
@ -1187,6 +1221,26 @@ mod gen_primitives {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn linked_list_singleton() {
|
||||||
|
// verifies only that valid llvm is produced
|
||||||
|
assert_non_opt_evals_to!(
|
||||||
|
indoc!(
|
||||||
|
r#"
|
||||||
|
app "test" provides [ main ] to "./platform"
|
||||||
|
|
||||||
|
ConsList a : [ Cons a (ConsList a), Nil ]
|
||||||
|
|
||||||
|
main : ConsList I64
|
||||||
|
main = Cons 0x1 Nil
|
||||||
|
"#
|
||||||
|
),
|
||||||
|
0,
|
||||||
|
i64,
|
||||||
|
|_| 0
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn recursive_functon_with_rigid() {
|
fn recursive_functon_with_rigid() {
|
||||||
assert_non_opt_evals_to!(
|
assert_non_opt_evals_to!(
|
||||||
|
@ -1354,7 +1408,8 @@ mod gen_primitives {
|
||||||
"#
|
"#
|
||||||
),
|
),
|
||||||
1,
|
1,
|
||||||
i64
|
&i64,
|
||||||
|
|x: &i64| *x
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1451,7 +1506,8 @@ mod gen_primitives {
|
||||||
"#
|
"#
|
||||||
),
|
),
|
||||||
1,
|
1,
|
||||||
i64
|
&i64,
|
||||||
|
|x: &i64| *x
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue