mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-02 16:21:11 +00:00
add some failing tests
This commit is contained in:
parent
0cac94d11d
commit
4dd7ea1356
2 changed files with 77 additions and 4 deletions
|
@ -583,7 +583,7 @@ pub fn sort_can_defs(
|
||||||
}
|
}
|
||||||
|
|
||||||
let successors_of_group = |group_id: &usize| {
|
let successors_of_group = |group_id: &usize| {
|
||||||
let mut result = ImSet::default();
|
let mut result = MutSet::default();
|
||||||
|
|
||||||
// for each symbol in this group
|
// for each symbol in this group
|
||||||
for symbol in &groups[*group_id] {
|
for symbol in &groups[*group_id] {
|
||||||
|
|
|
@ -1859,4 +1859,77 @@ mod gen_primitives {
|
||||||
i64
|
i64
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
#[ignore]
|
||||||
|
fn fingertree_basic() {
|
||||||
|
assert_non_opt_evals_to!(
|
||||||
|
indoc!(
|
||||||
|
r#"
|
||||||
|
app "test" provides [ main ] to "./platform"
|
||||||
|
|
||||||
|
Some a : [ One a, Two a a, Three a a a ]
|
||||||
|
|
||||||
|
Tuple a : [ Pair a a, Triple a a a ]
|
||||||
|
|
||||||
|
# a FingerTree implementation
|
||||||
|
Seq a : [ Nil, Unit a, More (Some a) (Seq (Tuple a)) (Some a) ]
|
||||||
|
|
||||||
|
# cons : a, Seq a -> Seq a
|
||||||
|
cons = \x, s ->
|
||||||
|
when s is
|
||||||
|
Nil -> Unit x
|
||||||
|
Unit y -> More (One x) Nil (One y)
|
||||||
|
More some q u ->
|
||||||
|
when some is
|
||||||
|
One y -> More (Two x y) q u
|
||||||
|
Two y z -> More (Three x y z) q u
|
||||||
|
Three y z w -> More (Two x y) (consTuple (Pair z w) q) u
|
||||||
|
|
||||||
|
consTuple : Tuple a, Seq (Tuple a) -> Seq (Tuple a)
|
||||||
|
consTuple = \a, b -> cons a b
|
||||||
|
|
||||||
|
main : Bool
|
||||||
|
main =
|
||||||
|
when cons 0x1 Nil is
|
||||||
|
Unit 1 -> True
|
||||||
|
_ -> False
|
||||||
|
"#
|
||||||
|
),
|
||||||
|
true,
|
||||||
|
bool
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
#[ignore]
|
||||||
|
fn rosetree_basic() {
|
||||||
|
assert_non_opt_evals_to!(
|
||||||
|
indoc!(
|
||||||
|
r#"
|
||||||
|
app "test" provides [ main ] to "./platform"
|
||||||
|
|
||||||
|
# RoseTree
|
||||||
|
Tree a : [ Tree a (List (Tree a)) ]
|
||||||
|
|
||||||
|
tree : a, List (Tree a) -> Tree a
|
||||||
|
tree = \a, t -> Tree a t
|
||||||
|
|
||||||
|
singleton : a -> Tree a
|
||||||
|
singleton = \x -> Tree x []
|
||||||
|
|
||||||
|
main : Bool
|
||||||
|
main =
|
||||||
|
x : I64
|
||||||
|
x = 1
|
||||||
|
|
||||||
|
when tree x [ singleton 5, singleton 3 ] is
|
||||||
|
Tree 0x1 _ -> True
|
||||||
|
_ -> False
|
||||||
|
"#
|
||||||
|
),
|
||||||
|
true,
|
||||||
|
bool
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue