mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Fix missing free on GrowableBitSet. init_new/init_temp for GrowableBitSet, LinkedList, List, HashMap, DString, ByteBuffer. Interface to_string renamed to_new_string. Change in allocator usage, malloc is now heap. Added new_array, new_zero_array, new, new_clear, clone. Concat => concat_new. string::printf => string::new_format, string::tprintf => string::tformat. "to_*" are now "to_new_*" and "to_temp_*". "from_*" is "new_from*"
This commit is contained in:
committed by
Christoffer Lerno
parent
69470b8738
commit
1e38ccdd2b
@@ -21,11 +21,11 @@ fn void! find_subarray()
|
||||
fn void! concat()
|
||||
{
|
||||
int[3] a = { 1, 2, 3 };
|
||||
array::concat(a, a);
|
||||
array::concat(a[..], a[..]);
|
||||
array::concat(a[:0], a[:0]);
|
||||
array::concat(int[2] { 1, 2 }, a[:0]);
|
||||
array::concat(a[:0], int[2] { 1, 2 });
|
||||
int[] c = array::concat(a[1..2], a);
|
||||
array::concat_new(a, a);
|
||||
array::concat_new(a[..], a[..]);
|
||||
array::concat_new(a[:0], a[:0]);
|
||||
array::concat_new(int[2] { 1, 2 }, a[:0]);
|
||||
array::concat_new(a[:0], int[2] { 1, 2 });
|
||||
int[] c = array::concat_new(a[1..2], a);
|
||||
assert (c == int[]{ 2, 3, 1, 2, 3 });
|
||||
}
|
||||
|
||||
@@ -77,12 +77,12 @@ fn void test_print()
|
||||
defer str.free();
|
||||
String s;
|
||||
|
||||
str.printf("_%s_", "foo");
|
||||
str.appendf("_%s_", "foo");
|
||||
s = str.str_view();
|
||||
assert(s == "_foo_", "got '%s'; want '_foo_'", s);
|
||||
|
||||
str.clear();
|
||||
str.printfn("_%s_", "foo");
|
||||
str.appendfn("_%s_", "foo");
|
||||
s = str.str_view();
|
||||
assert(s == "_foo_\n", "got '%s'; want '_foo_\n'", s);
|
||||
}
|
||||
@@ -126,7 +126,7 @@ fn void test_join()
|
||||
|
||||
fn void test_insert_at()
|
||||
{
|
||||
DString str = dstring::tnew(" world");
|
||||
DString str = dstring::temp_new(" world");
|
||||
String s;
|
||||
|
||||
str.insert_at(0, "");
|
||||
@@ -144,7 +144,7 @@ fn void test_insert_at()
|
||||
|
||||
fn void test_insert_at_overlaps()
|
||||
{
|
||||
DString str = dstring::tnew("abc");
|
||||
DString str = dstring::temp_new("abc");
|
||||
String s;
|
||||
String v;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user