mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Add array::zip and Related Macros (#2370)
* zip / zip_into * Deprecate `add_array` in favour of `push_all` on lists. * Add support for generic lists for zip. --------- Co-authored-by: Christoffer Lerno <christoffer@aegik.com>
This commit is contained in:
@@ -78,7 +78,7 @@ alias CountingSortTestList = List{int};
|
||||
fn void countingsort_list()
|
||||
{
|
||||
CountingSortTestList list;
|
||||
list.add_array({ 2, 1, 3});
|
||||
list.push_all({ 2, 1, 3});
|
||||
sort::countingsort(list, &sort::key_int_value);
|
||||
assert(check::int_ascending_sort(list.array_view()));
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ alias InsertionSortTestList = List{int};
|
||||
fn void insertionsort_list()
|
||||
{
|
||||
InsertionSortTestList list;
|
||||
list.add_array({ 2, 1, 3});
|
||||
list.push_all({ 2, 1, 3});
|
||||
sort::insertionsort(list, &sort::cmp_int_value);
|
||||
assert(check::int_ascending_sort(list.array_view()));
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ alias List = List{int};
|
||||
fn void quicksort_list()
|
||||
{
|
||||
List list;
|
||||
list.add_array({ 2, 1, 3});
|
||||
list.push_all({ 2, 1, 3});
|
||||
sort::quicksort(list, &sort::cmp_int_value);
|
||||
assert(check::int_sort(list.array_view()));
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ fn void sorted()
|
||||
// with list
|
||||
List{int} list;
|
||||
list.tinit();
|
||||
list.add_array(tc.input);
|
||||
list.push_all(tc.input);
|
||||
|
||||
got = is_sorted(list);
|
||||
assert(got == tc.want, "list: %s, got: %s, want: %s",
|
||||
|
||||
Reference in New Issue
Block a user