Skip to content

Commit 1e8b504

Browse files
committed
tests: add FFstrbuf smallest allocation test & minor fix
1 parent 07d0743 commit 1e8b504

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

tests/list.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ int main(void)
116116

117117
{
118118
FF_LIST_AUTO_DESTROY test = ffListCreate(1);
119-
VERIFY(test.elementSize = 1);
119+
VERIFY(test.elementSize == 1);
120120
VERIFY(test.capacity == 0);
121121
VERIFY(test.length == 0);
122122
}

tests/strbuf.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,19 @@ int main(void)
442442
VERIFY(ffStrbufEqualS(&strbuf, "AA12BB3456CCDD"));
443443
ffStrbufDestroy(&strbuf);
444444

445+
// smallest allocation test
446+
{
447+
FF_STRBUF_AUTO_DESTROY strbuf1 = ffStrbufCreateA(10);
448+
VERIFY(strbuf1.allocated == 10);
449+
ffStrbufEnsureFree(&strbuf1, 16);
450+
VERIFY(strbuf1.allocated == 32);
451+
452+
FF_STRBUF_AUTO_DESTROY strbuf2 = ffStrbufCreate();
453+
VERIFY(strbuf2.allocated == 0);
454+
ffStrbufEnsureFree(&strbuf2, 16);
455+
VERIFY(strbuf2.allocated == 32);
456+
}
457+
445458
//Success
446459
puts("\e[32mAll tests passed!" FASTFETCH_TEXT_MODIFIER_RESET);
447460
}

0 commit comments

Comments
 (0)