Create a unit7 for all unit tests.

This commit is contained in:
Christoffer Lerno
2025-02-24 01:05:45 +01:00
parent 70029cc4b8
commit 87725a3a9e
128 changed files with 9311 additions and 103 deletions

View File

@@ -0,0 +1,20 @@
module string_test;
fn void test_clear() @test
{
DString s = dstring::new_with_capacity(mem, 32);
defer s.free();
assert(s.len() == 0);
assert(s.capacity() == 32);
s.append_repeat('x', 63);
assert(s.capacity() == 64);
assert(s.len() == 63);
char* addr = (char*)s.str_view();
s.clear();
assert(s.capacity() == 64);
assert(s.len() == 0);
s.append_repeat('x', 63);
assert(s.capacity() == 64);
assert(s.len() == 63);
assert(addr == (char*)s.str_view());
}