Add gen-test for #4732

This commit is contained in:
Ayaz Hafiz 2022-12-14 13:05:41 -06:00
parent a8693e6102
commit fbfc429bc5
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58

View file

@ -3714,4 +3714,51 @@ mod pattern_match {
RocList<u16>
)
}
#[test]
fn order_list_size_tests_issue_4732() {
assert_evals_to!(
r#"
helper : List U8 -> U8
helper = \l -> when l is
[1, ..] -> 1
[2, 1, ..] -> 2
[3, 2, 1, ..] -> 3
[4, 3, 2, 1, ..] -> 4
[4, 3, 2, ..] -> 5
[4, 3, ..] -> 6
[4, ..] -> 7
_ -> 8
[
helper [1], helper [1, 2],
helper [2, 1], helper [2, 1, 3],
helper [3, 2, 1], helper [3, 2, 1, 4],
helper [4, 3, 2, 1], helper [4, 3, 2, 1, 5],
helper [4, 3, 2], helper [4, 3, 2, 5],
helper [4, 3], helper [4, 3, 5],
helper [4], helper [4, 5],
helper [], helper [7],
]
"#,
RocList::from_slice(&[
1, 1, //
2, 2, //
3, 3, //
4, 4, //
5, 5, //
6, 6, //
7, 7, //
8, 8, //
]),
RocList<u8>
)
}
}