mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 06:44:46 +00:00
Implement List.map4
This commit is contained in:
parent
b29a029a33
commit
f9ed060e49
16 changed files with 419 additions and 16 deletions
|
@ -763,6 +763,37 @@ fn list_map_closure() {
|
|||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn list_map4_group() {
|
||||
assert_evals_to!(
|
||||
indoc!(
|
||||
r#"
|
||||
List.map4 [1,2,3] [3,2,1] [2,1,3] [3,1,2] (\a, b, c, d -> Group a b c d)
|
||||
"#
|
||||
),
|
||||
RocList::from_slice(&[(1, 3, 2, 3), (2, 2, 1, 1), (3, 1, 3, 2)]),
|
||||
RocList<(i64, i64, i64, i64)>
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn list_map4_different_length() {
|
||||
assert_evals_to!(
|
||||
indoc!(
|
||||
r#"
|
||||
List.map4
|
||||
["h", "i", "j", "k"]
|
||||
["o", "p", "q"]
|
||||
["l", "m"]
|
||||
["a"]
|
||||
(\a, b, c, d -> Str.concat a (Str.concat b (Str.concat c d)))
|
||||
"#
|
||||
),
|
||||
RocList::from_slice(&[RocStr::from_slice("hola".as_bytes()),]),
|
||||
RocList<RocStr>
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn list_map3_group() {
|
||||
assert_evals_to!(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue