ZstrCompare
Description
Compare two strings lexicographically (case-sensitive).
Parameters
| Name | Direction | Description |
|---|---|---|
s1 |
in | First string. |
s2 |
in | Second string. |
Success
Returns 0 if equal, <0 if s1<s2, >0 if s1>s2.
Failure
Aborts via LOG_FATAL when either string pointer is NULL.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
ArgParse.c:56:
static bool zstr_eq(Zstr a, Zstr b) {
return a && b && ZstrCompare(a, b) == 0;
}- In
Zstr.c:22:
}
i32 ZstrCompare(Zstr s1, Zstr s2) {
if (!s1 || !s2) {
LOG_FATAL("Invalid arguments");- In
Zstr.c:67:
}
cmp = ZstrCompare(*a, *b);
if (cmp < 0) {
return -1;- In
Str.c:215:
i32 str_cmp_zstr(const Str *s, Zstr other) {
ValidateStr(s);
return ZstrCompare(StrBegin(s), other);
}- In
Dir.c:98:
do {
// Skip "." and ".." entries
if (ZstrCompare(findFileData.cFileName, ".") == 0 || ZstrCompare(findFileData.cFileName, "..") == 0) {
continue;
}- In
Dir.c:548:
DirEntry *e = VecPtrAt(&dc, i);
Zstr entry_nm = StrBegin(&e->name);
if (ZstrCompare(entry_nm, ".") == 0 || ZstrCompare(entry_nm, "..") == 0) {
continue;
} // different positions of the raw buffer if the kernel
// generated separate copies — fall back to string compare.
if (e->path && path && ZstrCompare(e->path, path) == 0) {
return e;
}- In
PdbCache.c:96:
for (size i = 0; i < VecLen(&self->entries); ++i) {
PdbCacheEntry *e = VecPtrAt(&self->entries, i);
if (StrBegin(&e->module_path) && ZstrCompare(StrBegin(&e->module_path), module_path) == 0) {
return e;
}- In
Dns.c:584:
// 1. /etc/hosts fast path.
VecForeachPtr(&self->hosts, e) {
if (StrLen(&e->name) > 0 && ZstrCompare(StrBegin(&e->name), nq) == 0) {
SocketAddr a = e->is_ipv6 ? sockaddr_v6(e->ip, port) : sockaddr_v4(e->ip, port);
VecPushBackR(out, a);- In
MachoCache.c:42:
for (size i = 0; i < VecLen(&self->entries); ++i) {
MachoCacheEntry *e = VecPtrAt(&self->entries, i);
if (StrBegin(&e->module_path) && ZstrCompare(StrBegin(&e->module_path), module_path) == 0) {
return e;
}- In
Pe.c:582:
for (size i = 0; i < VecLen(&self->sections); ++i) {
const PeSection *s = VecPtrAt(&self->sections, i);
if (ZstrCompare(s->name, name) == 0) {
return s;
}- In
Http.c:63:
}
VecForeachPtr(headers, header) {
if (0 == ZstrCompare(StrBegin(&header->key), key)) {
return header;
}- In
MachO.c:489:
for (size i = 0; i < VecLen(&self->sections); ++i) {
const MachoSection *s = VecPtrAt(&self->sections, i);
if (ZstrCompare(s->segment, segment) == 0 && ZstrCompare(s->section, section) == 0) {
return s;
}- In
Elf.c:590:
for (u64 i = 0; i < VecLen(&self->sections); ++i) {
const ElfSection *s = VecPtrAt(&self->sections, i);
if (s->name && ZstrCompare(s->name, name) == 0) {
return s;
}- In
File.c:55:
bool result = (got == (i64)ZstrLen("hello from file")) && (StrLen(&body) == (size)ZstrLen("hello from file")) &&
ZstrCompare(StrBegin(&body), "hello from file") == 0;
StrDeinit(&body);- In
File.c:90:
Zstr expected = "this is longer than the initial buffer";
bool result = (got == (i64)ZstrLen(expected)) && (StrLen(&body) == (size)ZstrLen(expected)) &&
ZstrCompare(StrBegin(&body), expected) == 0 && StrCapacity(&body) >= StrLen(&body) + 1;
StrDeinit(&body);- In
File.c:270:
FileClose(&r);
ok = ok && (got == 3) && (StrLen(&body) == 3) && ZstrCompare(StrBegin(&body), "new") == 0;
StrDeinit(&body);- In
File.c:304:
FileClose(&r);
ok = ok && (got == 8) && ZstrCompare(StrBegin(&body), "headtail") == 0;
StrDeinit(&body);- In
File.c:340:
Str body = StrInit(alloc_base);
i64 got = FileReadAndClose(&path, &body);
ok = ok && (got == (i64)n) && (StrLen(&body) == (size)n) && ZstrCompare(StrBegin(&body), payload) == 0;
StrDeinit(&body);- In
File.c:434:
i64 got = FileRead(&r, &body);
FileClose(&r);
ok = ok && (got == 10) && ZstrCompare(StrBegin(&body), "AAA3456789") == 0;
StrDeinit(&body);- In
File.c:530:
Str body = StrInit(alloc_base);
i64 got = FileReadAndClose(&path, &body);
ok = ok && (got == 10) && ZstrCompare(StrBegin(&body), "helloworld") == 0;
StrDeinit(&body);- In
File.c:758:
FileClose(&f);
ok = ok && (got == 6) && (StrLen(&body) == 6) && ZstrCompare(StrBegin(&body), "ABCDEF") == 0;
StrDeinit(&body);- In
File.c:790:
ok = ok && (got == (i64)ZstrLen(payload)) && (StrLen(&body) == (size)ZstrLen(payload)) &&
ZstrCompare(StrBegin(&body), payload) == 0;
StrDeinit(&body);- In
File.c:875:
Str body = StrInit(alloc_base);
i64 got = FileReadAndClose(&path, &body);
ok = ok && (got == (i64)n) && (StrLen(&body) == (size)n) && ZstrCompare(StrBegin(&body), payload) == 0;
StrDeinit(&body);- In
File.c:939:
Str body = StrInit(alloc_base);
i64 got = FileReadAndClose(&path, &body);
ok = ok && (got == 5) && ZstrCompare(StrBegin(&body), "12345") == 0;
StrDeinit(&body);- In
File.c:973:
Str body = StrInit(alloc_base);
i64 got = FileReadAndClose(&path, &body);
ok = ok && (got == (i64)StrLen(&in)) && ZstrCompare(StrBegin(&body), "string-content") == 0;
StrDeinit(&body);- In
File.c:1032:
ok = ok && (StrLen(&p1) == 16) && (StrLen(&p2) == 16);
// Distinct names (overwhelmingly likely; the loop draws fresh entropy).
ok = ok && (ZstrCompare(StrBegin(&p1), StrBegin(&p2)) != 0);
// They are independent files: writing to one does not affect the other.
- In
File.c:1042:
Str b1 = StrInit(alloc_base);
Str b2 = StrInit(alloc_base);
ok = ok && (FileReadAndClose(&p1, &b1) == 3) && ZstrCompare(StrBegin(&b1), "one") == 0;
ok = ok && (FileReadAndClose(&p2, &b2) == 6) && ZstrCompare(StrBegin(&b2), "twotwo") == 0;- In
File.c:1043:
Str b2 = StrInit(alloc_base);
ok = ok && (FileReadAndClose(&p1, &b1) == 3) && ZstrCompare(StrBegin(&b1), "one") == 0;
ok = ok && (FileReadAndClose(&p2, &b2) == 6) && ZstrCompare(StrBegin(&b2), "twotwo") == 0;
StrDeinit(&b1);- In
ArgParse.c:27:
ArgRun rc = ArgParseRun(&p, 3, argv);
bool ok = (rc == ARG_RUN_OK) && listen && ZstrCompare(listen, "0.0.0.0:8080") == 0;
ArgParseDeinit(&p);
DefaultAllocatorDeinit(&a);- In
ArgParse.c:43:
ArgRun rc = ArgParseRun(&p, 2, argv);
bool ok = (rc == ARG_RUN_OK) && listen && ZstrCompare(listen, "0.0.0.0:8080") == 0;
ArgParseDeinit(&p);
DefaultAllocatorDeinit(&a);- In
ArgParse.c:59:
ArgRun rc = ArgParseRun(&p, 3, argv);
bool ok = (rc == ARG_RUN_OK) && listen && ZstrCompare(listen, "127.0.0.1:9") == 0;
ArgParseDeinit(&p);
DefaultAllocatorDeinit(&a);- In
ArgParse.c:173:
ArgRun rc = ArgParseRun(&p, 3, argv);
bool ok = (rc == ARG_RUN_OK) && ZstrCompare(src, "a.txt") == 0 && ZstrCompare(dst, "b.txt") == 0;
ArgParseDeinit(&p);
DefaultAllocatorDeinit(&a);- In
ArgParse.c:193:
ArgRun rc = ArgParseRun(&p, 4, argv);
bool ok = (rc == ARG_RUN_OK) && ZstrCompare(src, "a.txt") == 0 && ZstrCompare(dst, "b.txt") == 0 && verbose == true;
ArgParseDeinit(&p);
DefaultAllocatorDeinit(&a);- In
ArgParse.c:572:
ArgRun rc = ArgParseRun(&p, 3, argv);
bool ok = (rc == ARG_RUN_OK) && ZstrCompare(file, "--unusual-name") == 0;
ArgParseDeinit(&p);
DefaultAllocatorDeinit(&a);- In
ArgParse.c:639:
Str out = StrInit(&a);
capture_help(p, &out);
bool ok = (StrLen(&out) == ZstrLen(expected)) && (ZstrCompare(StrBegin(&out), expected) == 0);
if (!ok) {
WriteFmt("[a1] help mismatch:\n");- In
ArgParse.c:1169:
char *argv[] = {(char *)"prog", (char *)"--name", (char *)"carol"};
ArgRun rc = ArgParseRun(&p, 3, argv);
bool ok = (rc == ARG_RUN_OK) && s && (ZstrCompare(s, "carol") == 0);
ArgParseDeinit(&p);
DefaultAllocatorDeinit(&a);- In
ArgParse.c:1536:
ArgRun rc = ArgParseRun(&p, 2, argv);
bool ok = (rc == ARG_RUN_OK) && listen && ZstrCompare(listen, "host:9") == 0;
ArgParseDeinit(&p);
DefaultAllocatorDeinit(&a);- In
DateTime.c:149:
DateTime d = DateTimeFromUnixNs(T_2021 * NS_PER_SEC, 0);
StrAppendFmt(&s, "{}", d);
bool ok = ZstrCompare(StrBegin(&s), "2021-01-01T00:00:00Z") == 0;
StrDeinit(&s);
DefaultAllocatorDeinit(&alloc);- In
DateTime.c:160:
DateTime d = DateTimeFromUnixNs(T_2021 * NS_PER_SEC, IST);
StrAppendFmt(&s, "{}", d);
bool ok = ZstrCompare(StrBegin(&s), "2021-01-01T05:30:00+05:30") == 0;
StrDeinit(&s);
DefaultAllocatorDeinit(&alloc);- In
DateTime.c:171:
DateTime d = DateTimeFromUnixNs(T_2021 * NS_PER_SEC + 123456789ull, 0);
StrAppendFmt(&s, "{}", d);
bool ok = ZstrCompare(StrBegin(&s), "2021-01-01T00:00:00.123456789Z") == 0;
StrDeinit(&s);
DefaultAllocatorDeinit(&alloc);- In
Init.c:95:
bool result = GraphNodeIdIndex(node_id) == 0 && StrBegin(&name) != NULL && GraphNodeCount(&graph) == 1 &&
ZstrCompare(StrBegin(stored_name), "alpha") == 0 && StrBegin(stored_name) != StrBegin(&name);
StrDeinit(&name);- In
Init.c:119:
bool result = GraphNodeIdIndex(node_id) == 0 && GraphNodeCount(&graph) == 1 && StrBegin(stored_name) != NULL &&
ZstrCompare(StrBegin(stored_name), "alpha") == 0;
GraphDeinit(&graph);- In
Access.c:77:
result = result && !GraphHasEdge(&graph, blue, green);
result = result && !GraphHasEdge(&graph, red, blue);
result = result && (ZstrCompare(*GraphNodePtrAt(&graph, red), "red") == 0);
GraphDeinit(&graph);- In
Type.c:61:
bool result = FloatEQ(&clone, &expected);
result = result && (ZstrCompare(StrBegin(&text), "-12.5") == 0);
result = result && !FloatEQ(&clone, &original);- In
Type.c:212:
Str text = IntToStr(&result);
bool right = ok && (ZstrCompare(StrBegin(&text), "5") == 0);
StrDeinit(&text);- In
Type.c:233:
Str text = IntToStr(&result);
bool right = ok && (ZstrCompare(StrBegin(&text), "120") == 0);
StrDeinit(&text);- In
Type.c:292:
text = FloatToStr(&f);
bool result = ok && (ZstrCompare(StrBegin(&text), "100") == 0);
StrDeinit(&text);- In
Type.c:338:
bool result = (FloatExponent(&value) == 0);
result = result && (ZstrCompare(StrBegin(&text), "1152921504606846976") == 0);
StrDeinit(&text);- In
Type.c:357:
FloatAdd(&r, &a, &b);
t = FloatToStr(&r);
bool ok = ZstrCompare(StrBegin(&t), "100.1") == 0;
StrDeinit(&t);- In
Type.c:379:
FloatAdd(&r, &a, &z);
t = FloatToStr(&r);
bool ok = ZstrCompare(StrBegin(&t), "12.5") == 0;
StrDeinit(&t);- In
Math.c:82:
text = FloatToStr(&value);
bool result = ZstrCompare(StrBegin(&text), "-12.5") == 0;
StrDeinit(&text);- In
Math.c:87:
FloatAbs(&value);
text = FloatToStr(&value);
result = result && (ZstrCompare(StrBegin(&text), "12.5") == 0);
StrDeinit(&text);- In
Math.c:108:
text = FloatToStr(&result_value);
bool result = ZstrCompare(StrBegin(&text), "1.23") == 0;
StrDeinit(&text);- In
Math.c:131:
text = FloatToStr(&result_value);
bool result = ZstrCompare(StrBegin(&text), FLOAT_TEST_VERY_LARGE_THREES) == 0;
StrDeinit(&text);- In
Math.c:154:
FloatAdd(&result_value, &a, &b);
text = FloatToStr(&result_value);
bool result = ZstrCompare(StrBegin(&text), "2") == 0;
StrDeinit(&text);- In
Math.c:159:
FloatAdd(&result_value, &a, &whole);
text = FloatToStr(&result_value);
result = result && (ZstrCompare(StrBegin(&text), "3.25") == 0);
StrDeinit(&text);- In
Math.c:164:
FloatAdd(&result_value, &a, 2u);
text = FloatToStr(&result_value);
result = result && (ZstrCompare(StrBegin(&text), "3.25") == 0);
StrDeinit(&text);- In
Math.c:169:
FloatAdd(&result_value, &a, -1);
text = FloatToStr(&result_value);
result = result && (ZstrCompare(StrBegin(&text), "0.25") == 0);
StrDeinit(&text);- In
Math.c:174:
FloatAdd(&result_value, &a, 0.75f);
text = FloatToStr(&result_value);
result = result && (ZstrCompare(StrBegin(&text), "2") == 0);
StrDeinit(&text);- In
Math.c:179:
FloatAdd(&result_value, &a, 0.75);
text = FloatToStr(&result_value);
result = result && (ZstrCompare(StrBegin(&text), "2") == 0);
FloatDeinit(&a);- In
Math.c:203:
text = FloatToStr(&result_value);
bool result = ZstrCompare(StrBegin(&text), "-0.5") == 0;
StrDeinit(&text);- In
Math.c:226:
text = FloatToStr(&result_value);
bool result = ZstrCompare(StrBegin(&text), FLOAT_TEST_VERY_LARGE_TWOS) == 0;
StrDeinit(&text);- In
Math.c:249:
FloatSub(&result_value, &a, &b);
text = FloatToStr(&result_value);
bool result = ZstrCompare(StrBegin(&text), "5") == 0;
StrDeinit(&text);- In
Math.c:254:
FloatSub(&result_value, &a, &whole);
text = FloatToStr(&result_value);
result = result && (ZstrCompare(StrBegin(&text), "3.5") == 0);
StrDeinit(&text);- In
Math.c:259:
FloatSub(&result_value, &a, 2u);
text = FloatToStr(&result_value);
result = result && (ZstrCompare(StrBegin(&text), "3.5") == 0);
StrDeinit(&text);- In
Math.c:264:
FloatSub(&result_value, &a, -2);
text = FloatToStr(&result_value);
result = result && (ZstrCompare(StrBegin(&text), "7.5") == 0);
StrDeinit(&text);- In
Math.c:269:
FloatSub(&result_value, &a, 0.5f);
text = FloatToStr(&result_value);
result = result && (ZstrCompare(StrBegin(&text), "5") == 0);
FloatDeinit(&a);- In
Math.c:293:
text = FloatToStr(&result_value);
bool result = ZstrCompare(StrBegin(&text), "-2.5") == 0;
StrDeinit(&text);- In
Math.c:316:
text = FloatToStr(&result_value);
bool result = ZstrCompare(StrBegin(&text), FLOAT_TEST_VERY_LARGE_TWOS) == 0;
StrDeinit(&text);- In
Math.c:339:
FloatMul(&result_value, &a, &b);
text = FloatToStr(&result_value);
bool result = ZstrCompare(StrBegin(&text), "3") == 0;
StrDeinit(&text);- In
Math.c:344:
FloatMul(&result_value, &a, &whole);
text = FloatToStr(&result_value);
result = result && (ZstrCompare(StrBegin(&text), "3") == 0);
StrDeinit(&text);- In
Math.c:349:
FloatMul(&result_value, &a, 2u);
text = FloatToStr(&result_value);
result = result && (ZstrCompare(StrBegin(&text), "3") == 0);
StrDeinit(&text);- In
Math.c:354:
FloatMul(&result_value, &a, -2);
text = FloatToStr(&result_value);
result = result && (ZstrCompare(StrBegin(&text), "-3") == 0);
StrDeinit(&text);- In
Math.c:359:
FloatMul(&result_value, &a, 0.5f);
text = FloatToStr(&result_value);
result = result && (ZstrCompare(StrBegin(&text), "0.75") == 0);
FloatDeinit(&a);- In
Math.c:383:
text = FloatToStr(&result_value);
bool result = ZstrCompare(StrBegin(&text), "0.125") == 0;
StrDeinit(&text);- In
Math.c:406:
text = FloatToStr(&result_value);
bool result = ZstrCompare(StrBegin(&text), FLOAT_TEST_VERY_LARGE_ONES) == 0;
StrDeinit(&text);- In
Math.c:429:
FloatDiv(&result_value, &a, &b, 1);
text = FloatToStr(&result_value);
bool result = ZstrCompare(StrBegin(&text), "3") == 0;
StrDeinit(&text);- In
Math.c:434:
FloatDiv(&result_value, &a, &whole, 1);
text = FloatToStr(&result_value);
result = result && (ZstrCompare(StrBegin(&text), "2.5") == 0);
StrDeinit(&text);- In
Math.c:439:
FloatDiv(&result_value, &a, 3u, 1);
text = FloatToStr(&result_value);
result = result && (ZstrCompare(StrBegin(&text), "2.5") == 0);
StrDeinit(&text);- In
Math.c:444:
FloatDiv(&result_value, &a, -3, 1);
text = FloatToStr(&result_value);
result = result && (ZstrCompare(StrBegin(&text), "-2.5") == 0);
StrDeinit(&text);- In
Math.c:449:
FloatDiv(&result_value, &a, 0.5f, 1);
text = FloatToStr(&result_value);
result = result && (ZstrCompare(StrBegin(&text), "15") == 0);
StrDeinit(&text);- In
Math.c:454:
FloatDiv(&result_value, &a, 0.5, 1);
text = FloatToStr(&result_value);
result = result && (ZstrCompare(StrBegin(&text), "15") == 0);
FloatDeinit(&a);- In
Math.c:504:
text = FloatToStr(&result_value);
bool result = ZstrCompare(StrBegin(&text), "3") == 0;
StrDeinit(&text);- In
Math.c:532:
text = FloatToStr(&result_value);
bool result = ZstrCompare(StrBegin(&text), "-3") == 0;
StrDeinit(&text);- In
Math.c:558:
text = FloatToStr(&result_value);
bool result = ZstrCompare(StrBegin(&text), "0.75") == 0;
StrDeinit(&text);- In
Math.c:864:
text = FloatToStr(&f);
bool result = ok && (ZstrCompare(StrBegin(&text), "5") == 0);
StrDeinit(&text);- In
Math.c:886:
text = FloatToStr(&f);
bool result = ok && (ZstrCompare(StrBegin(&text), "19") == 0);
StrDeinit(&text);- In
Math.c:906:
bool ok = FloatDiv("ient, &a, &b, 8);
text = FloatToStr("ient);
bool result = ok && (ZstrCompare(StrBegin(&text), "2") == 0);
StrDeinit(&text);- In
Math.c:975:
bool ok = FloatDiv(&r, &a, 3u, 1);
text = FloatToStr(&r);
ok = ok && (ZstrCompare(StrBegin(&text), "2.5") == 0);
StrDeinit(&text);- In
Convert.c:56:
Str text = FloatToStr(&value);
bool result = ZstrCompare(StrBegin(&text), "42") == 0;
result = result && !FloatIsNegative(&value);- In
Convert.c:73:
Str text = FloatToStr(&value);
bool result = ZstrCompare(StrBegin(&text), "-42") == 0;
result = result && FloatIsNegative(&value);- In
Convert.c:91:
Str text = FloatToStr(&value);
bool result = ZstrCompare(StrBegin(&text), "12345678901234567890") == 0;
IntDeinit(&integer);- In
Convert.c:111:
bool result = FloatToInt(&result_value, &value);
text = IntToStr(&result_value);
result = result && (ZstrCompare(StrBegin(&text), "12345") == 0);
FloatDeinit(&value);- In
Convert.c:162:
Str text = FloatToStr(&value);
bool result = ZstrCompare(StrBegin(&text), "-123.45") == 0;
StrDeinit(&text);- In
Convert.c:187:
ok = float_try_to_str(&text, &value, ALLOCATOR_OF(&alloc));
bool result = ok && (ZstrCompare(StrBegin(&text), "-123.45") == 0) &&
(StrAllocator(&text)->effort == alloc.base.effort) &&
(StrAllocator(&text)->retry_limit == alloc.base.retry_limit);- In
Convert.c:205:
Str text = FloatToStr(&value);
bool result = ZstrCompare(StrBegin(&text), FLOAT_TEST_VERY_LARGE_ONES) == 0;
StrDeinit(&text);- In
Convert.c:221:
Str text = FloatToStr(&value);
bool result = ZstrCompare(StrBegin(&text), "1230") == 0;
StrDeinit(&text);- In
Convert.c:334:
Str text = FloatToStr(&value);
bool result = ZstrCompare(StrBegin(&text), "100") == 0;
result = result && (FloatCompare(&value, &whole) == 0);- In
Convert.c:361:
result = result && FloatIsNegative(&value);
result = result && (ZstrCompare(StrBegin(&text), "-2000") == 0);
result = result && (FloatExponent(&value) == 3);- In
Convert.c:391:
Float value = FloatFrom((u64)100, &alloc.base);
Str text = FloatToStr(&value);
bool ok = ZstrCompare(StrBegin(&text), "100") == 0;
StrDeinit(&text);- In
Convert.c:439:
Str printed = FloatToStr(&value);
ok = ok && (ZstrCompare(StrBegin(&printed), "3.14") == 0);
StrDeinit(&printed);- In
Convert.c:462:
Str text = FloatToStr(&value);
bool result = (ZstrCompare(StrBegin(&text), "3.14") == 0) && (StrLen(&text) == 4);
StrDeinit(&text);- In
Convert.c:484:
Str text = FloatToStr(&value);
bool result = (ZstrCompare(StrBegin(&text), "0.001") == 0) && (StrLen(&text) == 5);
StrDeinit(&text);- In
Convert.c:503:
Str text = FloatToStr(&value);
bool result = (ZstrCompare(StrBegin(&text), "100") == 0) && (StrLen(&text) == 3);
StrDeinit(&text);- In
Convert.c:607:
Str text = FloatToStr(&value);
ok = ok && (ZstrCompare(StrBegin(&text), "1") == 0);
StrDeinit(&text);- In
Convert.c:649:
Str text = FloatToStr(&value);
bool result = (ZstrCompare(StrBegin(&text), "4503599627370496") == 0) && (StrLen(&text) == 16);
StrDeinit(&text);- In
Complex.c:139:
if ((a->name && !b->name) || (!a->name && b->name))
return false;
if (a->name && b->name && ZstrCompare(a->name, b->name) != 0)
return false;- In
Complex.c:210:
// The vector's copy should still have the original values
result = result && (ZstrCompare(VecAt(&vec, 0).name, "Test Item") == 0);
result = result && (VecAt(&vec, 0).values[0] == 1);- In
Complex.c:246:
// Check items order: item2, item1, item3
result = result && (ZstrCompare(VecAt(&vec, 0).name, "Item 2") == 0);
result = result && (ZstrCompare(VecAt(&vec, 1).name, "Item 1") == 0);
result = result && (ZstrCompare(VecAt(&vec, 2).name, "Item 3") == 0);- In
Complex.c:247:
// Check items order: item2, item1, item3
result = result && (ZstrCompare(VecAt(&vec, 0).name, "Item 2") == 0);
result = result && (ZstrCompare(VecAt(&vec, 1).name, "Item 1") == 0);
result = result && (ZstrCompare(VecAt(&vec, 2).name, "Item 3") == 0);- In
Complex.c:248:
result = result && (ZstrCompare(VecAt(&vec, 0).name, "Item 2") == 0);
result = result && (ZstrCompare(VecAt(&vec, 1).name, "Item 1") == 0);
result = result && (ZstrCompare(VecAt(&vec, 2).name, "Item 3") == 0);
// Check values
- In
Complex.c:294:
// Check items order: item2, item3, item1
result = result && (ZstrCompare(VecAt(&vec, 0).name, "Item 2") == 0);
result = result && (ZstrCompare(VecAt(&vec, 1).name, "Item 3") == 0);
result = result && (ZstrCompare(VecAt(&vec, 2).name, "Item 1") == 0);- In
Complex.c:295:
// Check items order: item2, item3, item1
result = result && (ZstrCompare(VecAt(&vec, 0).name, "Item 2") == 0);
result = result && (ZstrCompare(VecAt(&vec, 1).name, "Item 3") == 0);
result = result && (ZstrCompare(VecAt(&vec, 2).name, "Item 1") == 0);- In
Complex.c:296:
result = result && (ZstrCompare(VecAt(&vec, 0).name, "Item 2") == 0);
result = result && (ZstrCompare(VecAt(&vec, 1).name, "Item 3") == 0);
result = result && (ZstrCompare(VecAt(&vec, 2).name, "Item 1") == 0);
// Clean up
- In
Complex.c:338:
// Check items in vec1: item1, item2, item3
result = result && (ZstrCompare(VecAt(&vec1, 0).name, "Item 1") == 0);
result = result && (ZstrCompare(VecAt(&vec1, 1).name, "Item 2") == 0);
result = result && (ZstrCompare(VecAt(&vec1, 2).name, "Item 3") == 0);- In
Complex.c:339:
// Check items in vec1: item1, item2, item3
result = result && (ZstrCompare(VecAt(&vec1, 0).name, "Item 1") == 0);
result = result && (ZstrCompare(VecAt(&vec1, 1).name, "Item 2") == 0);
result = result && (ZstrCompare(VecAt(&vec1, 2).name, "Item 3") == 0);- In
Complex.c:340:
result = result && (ZstrCompare(VecAt(&vec1, 0).name, "Item 1") == 0);
result = result && (ZstrCompare(VecAt(&vec1, 1).name, "Item 2") == 0);
result = result && (ZstrCompare(VecAt(&vec1, 2).name, "Item 3") == 0);
// Now test VecMergeL which transfers ownership
- In
Complex.c:370:
// Check items in vec3: item4, item5
result = result && (ZstrCompare(VecAt(&vec3, 0).name, "Item 4") == 0);
result = result && (ZstrCompare(VecAt(&vec3, 1).name, "Item 5") == 0);- In
Complex.c:371:
// Check items in vec3: item4, item5
result = result && (ZstrCompare(VecAt(&vec3, 0).name, "Item 4") == 0);
result = result && (ZstrCompare(VecAt(&vec3, 1).name, "Item 5") == 0);
// Clean up
- In
Memory.c:455:
StrClear(&s);
bool result = (StrLen(&s) == 0) && (ZstrCompare(StrBegin(&s), "") == 0);
StrDeinit(&s);- In
Memory.c:473:
StrClear(&s);
bool result = (StrLen(&s) == 0) && (ZstrCompare(StrBegin(&s), "") == 0);
StrDeinit(&s);- In
Convert.c:286:
result = result && ok && (StrAllocator(&str)->effort == alloc.base.effort) &&
(StrAllocator(&str)->retry_limit == alloc.base.retry_limit) &&
(ZstrCompare(StrBegin(&str), "101001") == 0);
StrDeinit(&str);- In
Convert.c:456:
// Should get exact same string back
result = result && (ZstrCompare(StrBegin(&str), patterns[i]) == 0);
StrDeinit(&str);- In
Convert.c:580:
// Test string conversion consistency
Str str = BitVecToStr(&bv);
result = result && (ZstrCompare(StrBegin(&str), test_cases[i].pattern) == 0);
StrDeinit(&str);- In
Convert.c:617:
// str2 and str3 are the same integer/byte packing; str1 is the string
// form. Assert each exactly.
result = result && (ZstrCompare(StrBegin(&str1), "11010110") == 0);
result = result && (ZstrCompare(StrBegin(&str2), "01101011") == 0);
result = result && (ZstrCompare(StrBegin(&str3), "01101011") == 0);- In
Convert.c:618:
// form. Assert each exactly.
result = result && (ZstrCompare(StrBegin(&str1), "11010110") == 0);
result = result && (ZstrCompare(StrBegin(&str2), "01101011") == 0);
result = result && (ZstrCompare(StrBegin(&str3), "01101011") == 0);
result = result && (ZstrCompare(StrBegin(&str2), StrBegin(&str3)) == 0);- In
Convert.c:619:
result = result && (ZstrCompare(StrBegin(&str1), "11010110") == 0);
result = result && (ZstrCompare(StrBegin(&str2), "01101011") == 0);
result = result && (ZstrCompare(StrBegin(&str3), "01101011") == 0);
result = result && (ZstrCompare(StrBegin(&str2), StrBegin(&str3)) == 0);- In
Convert.c:620:
result = result && (ZstrCompare(StrBegin(&str2), "01101011") == 0);
result = result && (ZstrCompare(StrBegin(&str3), "01101011") == 0);
result = result && (ZstrCompare(StrBegin(&str2), StrBegin(&str3)) == 0);
StrDeinit(&str1);- In
Math.c:120:
bool result = IntToU64(&result_value) == 256;
result = result && (ZstrCompare(StrBegin(&text), "100000000") == 0);
StrDeinit(&text);- In
Math.c:152:
IntAdd(&result_value, &huge, 10);
text = IntToStr(&result_value);
result = result && (ZstrCompare(StrBegin(&text), "123456789012345678901234567900") == 0);
IntDeinit(&base);- In
Math.c:205:
result = result && IntSub(&result_value, &huge, 90);
text = IntToStr(&result_value);
result = result && (ZstrCompare(StrBegin(&text), "12345678901234567800") == 0);
result = result && !IntSub(&preserved, &base, 50);- In
Math.c:271:
text = IntToStr(&result_value);
bool result = ZstrCompare(StrBegin(&text), "308641972530864197250") == 0;
IntDeinit(&value);- In
Math.c:331:
IntPow(&result_value, &base, 20u);
text = IntToStr(&result_value);
bool result = ZstrCompare(StrBegin(&text), "79792266297612001") == 0;
StrDeinit(&text);- In
Math.c:336:
IntPow(&result_value, &base, &exponent);
text = IntToStr(&result_value);
result = result && (ZstrCompare(StrBegin(&text), "79792266297612001") == 0);
IntDeinit(&base);- In
Math.c:359:
qtext = IntToStr("ient);
bool result = ZstrCompare(StrBegin(&qtext), "127275040218913071") == 0;
result = result && (IntToU64(&remainder) == 3);- In
Math.c:399:
bool result = IntDivExact(&result_value, ÷nd, 90u);
text = IntToStr(&result_value);
result = result && (ZstrCompare(StrBegin(&text), "137174210013717421") == 0);
IntDeinit(÷nd);- In
Math.c:440:
text = IntToStr("ient);
bool result = ZstrCompare(StrBegin(&text), "127275040218913071") == 0;
result = result && (IntToU64(&remainder) == 3);- In
Math.c:910:
text = IntToStr(&next);
bool result = ok && ZstrCompare(StrBegin(&text), "1000000007") == 0;
IntDeinit(&value);- In
Math.c:1933:
bool result = (IntToU64(&sum) == 128u);
result = result && (ZstrCompare(StrBegin(&bits), "10000000") == 0);
StrDeinit(&bits);- In
Math.c:2453:
bool result = ok;
result = result && (ZstrCompare(StrBegin(&qtext), "127275040218913071") == 0);
result = result && (IntToU64(&remainder) == 3u);- In
Math.c:2483:
bool result = ok;
result = result && (ZstrCompare(StrBegin(&qtext), "949667607787274453") == 0);
result = result && (IntToU64(&remainder) == 1u);- In
Math.c:3163:
bool result = ok;
result = result && (ZstrCompare(StrBegin(&qtext), "12499999874") == 0);
result = result && (ZstrCompare(StrBegin(&rtext), "833333448067901235") == 0);- In
Math.c:3164:
bool result = ok;
result = result && (ZstrCompare(StrBegin(&qtext), "12499999874") == 0);
result = result && (ZstrCompare(StrBegin(&rtext), "833333448067901235") == 0);
StrDeinit(&qtext);- In
Convert.c:103:
bool result = IntBitLength(&value) == 4;
result = result && (IntToU64(&value) == 13);
result = result && (ZstrCompare(StrBegin(&text), "1101") == 0);
StrDeinit(&text);- In
Convert.c:124:
bool result = written == 4;
result = result && (MemCompare(out, bytes, sizeof(bytes)) == 0);
result = result && (ZstrCompare(StrBegin(&text), "cdef1234") == 0);
StrDeinit(&text);- In
Convert.c:145:
bool result = written == 4;
result = result && (MemCompare(out, bytes, sizeof(bytes)) == 0);
result = result && (ZstrCompare(StrBegin(&text), "12345678") == 0);
StrDeinit(&text);- In
Convert.c:162:
bool result = IntToU64(&value) == 11;
result = result && (ZstrCompare(StrBegin(&text), "1011") == 0);
StrDeinit(&text);- In
Convert.c:179:
Str text = IntToStr(&value);
bool result = ZstrCompare(StrBegin(&text), digits) == 0;
StrDeinit(&text);- In
Convert.c:196:
bool result = IntToU64(&value) == 1295;
result = result && (ZstrCompare(StrBegin(&text), "zz") == 0);
StrDeinit(&text);- In
Convert.c:212:
Str text = IntToStrRadix(&value, 16, true);
bool result = ZstrCompare(StrBegin(&text), "BEEF") == 0;
StrDeinit(&text);- In
Convert.c:237:
ok = int_try_to_str_radix(&text, &value, 16, true, ALLOCATOR_OF(&alloc));
bool result = ok && (ZstrCompare(StrBegin(&text), "BEEF") == 0) &&
(StrAllocator(&text)->effort == alloc.base.effort) &&
(StrAllocator(&text)->retry_limit == alloc.base.retry_limit);- In
Convert.c:277:
result = result && (IntToU64(&zero, &error) == 0);
result = result && !error;
result = result && (ZstrCompare(StrBegin(&text), "0") == 0);
StrDeinit(&text);- In
Convert.c:309:
bool result = IntToU64(&value) == 493;
result = result && (ZstrCompare(StrBegin(&text), "755") == 0);
StrDeinit(&text);- In
Convert.c:326:
Str text = IntToHexStr(&value);
bool result = ZstrCompare(StrBegin(&text), hex) == 0;
StrDeinit(&text);- In
Convert.c:899:
Str dec_big = IntToStrRadix(&big, 10, false, &alloc.base);
bool result = (ZstrCompare(StrBegin(&dec_small), "7") == 0);
result = result && (ZstrCompare(StrBegin(&hex_mid), "ff") == 0);
result = result && (ZstrCompare(StrBegin(&hex_mid_u), "FF") == 0);- In
Convert.c:900:
bool result = (ZstrCompare(StrBegin(&dec_small), "7") == 0);
result = result && (ZstrCompare(StrBegin(&hex_mid), "ff") == 0);
result = result && (ZstrCompare(StrBegin(&hex_mid_u), "FF") == 0);
result = result && (ZstrCompare(StrBegin(&dec_big), "123456789012345678901234567890") == 0);- In
Convert.c:901:
bool result = (ZstrCompare(StrBegin(&dec_small), "7") == 0);
result = result && (ZstrCompare(StrBegin(&hex_mid), "ff") == 0);
result = result && (ZstrCompare(StrBegin(&hex_mid_u), "FF") == 0);
result = result && (ZstrCompare(StrBegin(&dec_big), "123456789012345678901234567890") == 0);- In
Convert.c:902:
result = result && (ZstrCompare(StrBegin(&hex_mid), "ff") == 0);
result = result && (ZstrCompare(StrBegin(&hex_mid_u), "FF") == 0);
result = result && (ZstrCompare(StrBegin(&dec_big), "123456789012345678901234567890") == 0);
StrDeinit(&dec_small);- In
Convert.c:930:
Str back_hex = IntToStrRadix(&parsed_hex, 16, false, &alloc.base);
bool result = (ZstrCompare(StrBegin(&back_dec), "987654321987654321") == 0);
result = result && (ZstrCompare(StrBegin(&back_hex), "deadbeef") == 0);- In
Convert.c:931:
bool result = (ZstrCompare(StrBegin(&back_dec), "987654321987654321") == 0);
result = result && (ZstrCompare(StrBegin(&back_hex), "deadbeef") == 0);
StrDeinit(&back_dec);- In
UserTypes.c:135:
Point2D p = {.x = 3, .y = 4};
bool ok = StrAppendFmt(&out, "{}", p);
ok = ok && (ZstrCompare(StrBegin(&out), "(3, 4)") == 0);
StrDeinit(&out);- In
UserTypes.c:151:
i32 count = 7;
bool ok = StrAppendFmt(&out, "got {} hits at {}", count, p);
ok = ok && (ZstrCompare(StrBegin(&out), "got 7 hits at (-1, 2)") == 0);
StrDeinit(&out);- In
UserTypes.c:199:
};
bool ok = StrAppendFmt(&out, "{}", b);
ok = ok && (ZstrCompare(StrBegin(&out), "[(0, 0)..(10, 20)]") == 0);
StrDeinit(&out);- In
UserTypes.c:242:
};
bool ok = StrAppendFmt(&out, "{}", r);
ok = ok && (ZstrCompare(StrBegin(&out), "42:[(0, 0)..(100, 50)]@(50, 25)") == 0);
StrDeinit(&out);- In
UserTypes.c:296:
// types and built-ins coexist in one IOFMT expansion.
bool ok = StrAppendFmt(&out, "score={.1} region={} origin={}", score, region, origin);
ok = ok && (ZstrCompare(StrBegin(&out), "score=1.5 region=7:[(1, 2)..(3, 4)]@(2, 3) origin=(0, 0)") == 0);
StrDeinit(&out);- In
Write.c:50:
StrAppendFmt(&output, "Hello, world!");
success = success && (ZstrCompare(StrBegin(&output), "Hello, world!") == 0);
StrClear(&output);- In
Write.c:54:
StrAppendFmt(&output, "{{Hello}}");
success = success && (ZstrCompare(StrBegin(&output), "{Hello}") == 0);
StrClear(&output);- In
Write.c:58:
StrAppendFmt(&output, "{{{{");
success = success && (ZstrCompare(StrBegin(&output), "{{") == 0);
StrDeinit(&output);- In
Write.c:75:
Zstr str = "Hello";
StrAppendFmt(&output, "{}", str);
success = success && (ZstrCompare(StrBegin(&output), "Hello") == 0);
StrClear(&output);- In
Write.c:84:
StrAppendFmt(&output, "{>10}", str);
success = success && (ZstrCompare(StrBegin(&output), " Hello") == 0);
StrClear(&output);- In
Write.c:88:
StrAppendFmt(&output, "{<10}", str);
success = success && (ZstrCompare(StrBegin(&output), "Hello ") == 0);
StrClear(&output);- In
Write.c:92:
StrAppendFmt(&output, "{^10}", str);
success = success && (ZstrCompare(StrBegin(&output), " Hello ") == 0);
StrClear(&output);- In
Write.c:97:
Str s = StrInitFromZstr("World", &alloc);
StrAppendFmt(&output, "{}", s);
success = success && (ZstrCompare(StrBegin(&output), "World") == 0);
StrDeinit(&s);- In
Write.c:115:
i8 i8_val = -42;
StrAppendFmt(&output, "{}", i8_val);
success = success && (ZstrCompare(StrBegin(&output), "-42") == 0);
StrClear(&output);- In
Write.c:120:
i16 i16_val = -1234;
StrAppendFmt(&output, "{}", i16_val);
success = success && (ZstrCompare(StrBegin(&output), "-1234") == 0);
StrClear(&output);- In
Write.c:125:
i32 i32_val = -123456;
StrAppendFmt(&output, "{}", i32_val);
success = success && (ZstrCompare(StrBegin(&output), "-123456") == 0);
StrClear(&output);- In
Write.c:130:
i64 i64_val = -1234567890LL;
StrAppendFmt(&output, "{}", i64_val);
success = success && (ZstrCompare(StrBegin(&output), "-1234567890") == 0);
StrClear(&output);- In
Write.c:135:
u8 u8_val = 42;
StrAppendFmt(&output, "{}", u8_val);
success = success && (ZstrCompare(StrBegin(&output), "42") == 0);
StrClear(&output);- In
Write.c:140:
u16 u16_val = 1234;
StrAppendFmt(&output, "{}", u16_val);
success = success && (ZstrCompare(StrBegin(&output), "1234") == 0);
StrClear(&output);- In
Write.c:145:
u32 u32_val = 123456;
StrAppendFmt(&output, "{}", u32_val);
success = success && (ZstrCompare(StrBegin(&output), "123456") == 0);
StrClear(&output);- In
Write.c:150:
u64 u64_val = 1234567890ULL;
StrAppendFmt(&output, "{}", u64_val);
success = success && (ZstrCompare(StrBegin(&output), "1234567890") == 0);
StrClear(&output);- In
Write.c:155:
i8 i8_max = 127;
StrAppendFmt(&output, "{}", i8_max);
success = success && (ZstrCompare(StrBegin(&output), "127") == 0);
StrClear(&output);- In
Write.c:160:
i8 i8_min = -128;
StrAppendFmt(&output, "{}", i8_min);
success = success && (ZstrCompare(StrBegin(&output), "-128") == 0);
StrClear(&output);- In
Write.c:165:
u8 u8_max = 255;
StrAppendFmt(&output, "{}", u8_max);
success = success && (ZstrCompare(StrBegin(&output), "255") == 0);
StrClear(&output);- In
Write.c:170:
u8 u8_min = 0;
StrAppendFmt(&output, "{}", u8_min);
success = success && (ZstrCompare(StrBegin(&output), "0") == 0);
StrDeinit(&output);- In
Write.c:187:
u32 val = 0xDEADBEEF;
StrAppendFmt(&output, "{x}", val);
success = success && (ZstrCompare(StrBegin(&output), "0xdeadbeef") == 0);
StrClear(&output);- In
Write.c:191:
StrAppendFmt(&output, "{X}", val);
success = success && (ZstrCompare(StrBegin(&output), "0xDEADBEEF") == 0);
StrDeinit(&output);- In
Write.c:208:
u8 val = 0xA5; // 10100101 in binary
StrAppendFmt(&output, "{b}", val);
success = success && (ZstrCompare(StrBegin(&output), "0b10100101") == 0);
StrDeinit(&output);- In
Write.c:225:
u16 val = 0777;
StrAppendFmt(&output, "{o}", val);
success = success && (ZstrCompare(StrBegin(&output), "0o777") == 0);
StrDeinit(&output);- In
Write.c:242:
f32 f32_val = 3.14159f;
StrAppendFmt(&output, "{}", f32_val);
success = success && (ZstrCompare(StrBegin(&output), "3.141590") == 0);
StrClear(&output);- In
Write.c:247:
f64 f64_val = 2.71828;
StrAppendFmt(&output, "{}", f64_val);
success = success && (ZstrCompare(StrBegin(&output), "2.718280") == 0);
StrDeinit(&output);- In
Write.c:265:
StrAppendFmt(&output, "{.2}", val);
success = success && (ZstrCompare(StrBegin(&output), "3.14") == 0);
StrClear(&output);- In
Write.c:269:
StrAppendFmt(&output, "{.0}", val);
success = success && (ZstrCompare(StrBegin(&output), "3") == 0);
StrClear(&output);- In
Write.c:273:
StrAppendFmt(&output, "{.10}", val);
success = success && (ZstrCompare(StrBegin(&output), "3.1415926536") == 0);
StrDeinit(&output);- In
Write.c:290:
f64 pos_inf = F64_INFINITY;
StrAppendFmt(&output, "{}", pos_inf);
success = success && (ZstrCompare(StrBegin(&output), "inf") == 0);
StrClear(&output);- In
Write.c:295:
f64 neg_inf = -F64_INFINITY;
StrAppendFmt(&output, "{}", neg_inf);
success = success && (ZstrCompare(StrBegin(&output), "-inf") == 0);
StrClear(&output);- In
Write.c:300:
f64 nan_val = F64_NAN;
StrAppendFmt(&output, "{}", nan_val);
success = success && (ZstrCompare(StrBegin(&output), "nan") == 0);
StrDeinit(&output);- In
Write.c:317:
i32 val = 42;
StrAppendFmt(&output, "{5}", val);
success = success && (ZstrCompare(StrBegin(&output), " 42") == 0);
StrClear(&output);- In
Write.c:321:
StrAppendFmt(&output, "{<5}", val);
success = success && (ZstrCompare(StrBegin(&output), "42 ") == 0);
StrClear(&output);- In
Write.c:325:
StrAppendFmt(&output, "{^5}", val);
success = success && (ZstrCompare(StrBegin(&output), " 42 ") == 0);
StrClear(&output);- In
Write.c:330:
Zstr str = "abc";
StrAppendFmt(&output, "{5}", str);
success = success && (ZstrCompare(StrBegin(&output), " abc") == 0);
StrClear(&output);- In
Write.c:334:
StrAppendFmt(&output, "{<5}", str);
success = success && (ZstrCompare(StrBegin(&output), "abc ") == 0);
StrClear(&output);- In
Write.c:338:
StrAppendFmt(&output, "{^5}", str);
success = success && (ZstrCompare(StrBegin(&output), " abc ") == 0);
StrDeinit(&output);- In
Write.c:358:
StrAppendFmt(&output, "{} {} {}", hello, num, pi);
success = success && (ZstrCompare(StrBegin(&output), "Hello 42 3.140000") == 0);
StrClear(&output);- In
Write.c:362:
StrAppendFmt(&output, "{} {} {}", pi, hello, num);
success = success && (ZstrCompare(StrBegin(&output), "3.140000 Hello 42") == 0);
StrDeinit(&output);- In
Write.c:379:
Zstr mixed_case = "MiXeD CaSe";
StrAppendFmt(&output, "{c}", mixed_case);
success = success && (ZstrCompare(StrBegin(&output), "MiXeD CaSe") == 0);
StrClear(&output);- In
Write.c:383:
StrAppendFmt(&output, "{a}", mixed_case);
success = success && (ZstrCompare(StrBegin(&output), "mixed case") == 0);
StrClear(&output);- In
Write.c:387:
StrAppendFmt(&output, "{A}", mixed_case);
success = success && (ZstrCompare(StrBegin(&output), "MIXED CASE") == 0);
StrClear(&output);- In
Write.c:393:
StrAppendFmt(&output, "{c}", s);
success = success && (ZstrCompare(StrBegin(&output), "MiXeD CaSe") == 0);
StrClear(&output);- In
Write.c:397:
StrAppendFmt(&output, "{a}", s);
success = success && (ZstrCompare(StrBegin(&output), "mixed case") == 0);
StrClear(&output);- In
Write.c:401:
StrAppendFmt(&output, "{A}", s);
success = success && (ZstrCompare(StrBegin(&output), "MIXED CASE") == 0);
StrClear(&output);- In
Write.c:408:
StrAppendFmt(&output, "{c}", upper_char);
success = success && (ZstrCompare(StrBegin(&output), "M") == 0);
StrClear(&output);- In
Write.c:412:
StrAppendFmt(&output, "{a}", upper_char);
success = success && (ZstrCompare(StrBegin(&output), "m") == 0);
StrClear(&output);- In
Write.c:416:
StrAppendFmt(&output, "{A}", lower_char);
success = success && (ZstrCompare(StrBegin(&output), "M") == 0);
StrClear(&output);- In
Write.c:539:
BitVec bv1 = BitVecFromStr("10110", alloc_base);
StrAppendFmt(&output, "{}", bv1);
success = success && (ZstrCompare(StrBegin(&output), "10110") == 0);
StrClear(&output);- In
Write.c:549:
BitVec bv2 = BitVecFromInteger(0xABCD, 16, alloc_base);
StrAppendFmt(&output, "{x}", bv2);
success = success && (ZstrCompare(StrBegin(&output), "0xabcd") == 0);
StrClear(&output);- In
Write.c:553:
StrAppendFmt(&output, "{X}", bv2);
success = success && (ZstrCompare(StrBegin(&output), "0xABCD") == 0);
StrClear(&output);- In
Write.c:558:
BitVec bv3 = BitVecFromInteger(0755, 10, alloc_base);
StrAppendFmt(&output, "{o}", bv3);
success = success && (ZstrCompare(StrBegin(&output), "0o755") == 0);
StrClear(&output);- In
Write.c:562:
StrAppendFmt(&output, "{>10}", bv1);
success = success && (ZstrCompare(StrBegin(&output), " 10110") == 0);
StrClear(&output);- In
Write.c:566:
StrAppendFmt(&output, "{<10}", bv1);
success = success && (ZstrCompare(StrBegin(&output), "10110 ") == 0);
StrClear(&output);- In
Write.c:570:
StrAppendFmt(&output, "{^10}", bv1);
success = success && (ZstrCompare(StrBegin(&output), " 10110 ") == 0);
StrClear(&output);- In
Write.c:575:
BitVec bv_zero = BitVecFromInteger(0, 1, alloc_base);
StrAppendFmt(&output, "{x}", bv_zero);
success = success && (ZstrCompare(StrBegin(&output), "0x0") == 0);
StrClear(&output);- In
Write.c:579:
StrAppendFmt(&output, "{o}", bv_zero);
success = success && (ZstrCompare(StrBegin(&output), "0o0") == 0);
StrClear(&output);- In
Write.c:607:
StrAppendFmt(&output, "{}", big_dec);
success = success && (ZstrCompare(StrBegin(&output), "123456789012345678901234567890") == 0);
StrClear(&output);- In
Write.c:611:
StrAppendFmt(&output, "{x}", hex_val);
success = success && (ZstrCompare(StrBegin(&output), "deadbeefcafebabe1234") == 0);
StrClear(&output);- In
Write.c:615:
StrAppendFmt(&output, "{X}", hex_val);
success = success && (ZstrCompare(StrBegin(&output), "DEADBEEFCAFEBABE1234") == 0);
StrClear(&output);- In
Write.c:619:
StrAppendFmt(&output, "{b}", bin_val);
success = success && (ZstrCompare(StrBegin(&output), "10100011") == 0);
StrClear(&output);- In
Write.c:623:
StrAppendFmt(&output, "{o}", oct_val);
success = success && (ZstrCompare(StrBegin(&output), "755") == 0);
StrClear(&output);- In
Write.c:627:
StrAppendFmt(&output, "{>34}", big_dec);
success = success && (ZstrCompare(StrBegin(&output), " 123456789012345678901234567890") == 0);
IntDeinit(&big_dec);- In
Write.c:651:
StrAppendFmt(&output, "{}", exact);
success = success && (ZstrCompare(StrBegin(&output), "1234567890.012345") == 0);
StrClear(&output);- In
Write.c:655:
StrAppendFmt(&output, "{e}", sci);
success = success && (ZstrCompare(StrBegin(&output), "1.234567e+04") == 0);
StrClear(&output);- In
Write.c:659:
StrAppendFmt(&output, "{E}", sci);
success = success && (ZstrCompare(StrBegin(&output), "1.234567E+04") == 0);
StrClear(&output);- In
Write.c:663:
StrAppendFmt(&output, "{.3}", short_v);
success = success && (ZstrCompare(StrBegin(&output), "1.200") == 0);
StrClear(&output);- In
Write.c:667:
StrAppendFmt(&output, "{>18}", sci);
success = success && (ZstrCompare(StrBegin(&output), " 12345.67") == 0);
FloatDeinit(&exact);- In
Write.c:726:
StrAppendFmt(&output, "{}", b); // Buf is a first-class {} argument now
bool ok = ZstrCompare(StrBegin(&output), "hello") == 0;
BufDeinit(&b);- In
Write.c:749:
u8 esc = 0x1B;
StrAppendFmt(&out, "{c}", esc);
ok = ok && (ZstrCompare(StrBegin(&out), "\\x1b") == 0);
StrClear(&out);- In
Write.c:755:
u8 bel = 0x07;
StrAppendFmt(&out, "{c}", bel);
ok = ok && (ZstrCompare(StrBegin(&out), "\\x07") == 0);
StrClear(&out);- In
Write.c:761:
u8 hi = 0xFF;
StrAppendFmt(&out, "{A}", hi);
ok = ok && (ZstrCompare(StrBegin(&out), "\\xFF") == 0);
StrClear(&out);- In
Write.c:767:
u8 ab = 0xAB;
StrAppendFmt(&out, "{c}", ab);
ok = ok && (ZstrCompare(StrBegin(&out), "\\xab") == 0);
StrDeinit(&out);- In
Write.c:917:
StrClear(&s);
StrAppendFmt(&s, "{}", utc);
ok = ok && ZstrCompare(StrBegin(&s), "2021-01-01T00:00:00Z") == 0;
DateTime ist = DateTimeFromUnixNs(base, 19800); // +05:30
- In
Write.c:922:
StrClear(&s);
StrAppendFmt(&s, "{}", ist);
ok = ok && ZstrCompare(StrBegin(&s), "2021-01-01T05:30:00+05:30") == 0;
DateTime neg = DateTimeFromUnixNs(base, -34200); // -09:30
- In
Write.c:927:
StrClear(&s);
StrAppendFmt(&s, "{}", neg);
ok = ok && ZstrCompare(StrBegin(&s), "2020-12-31T14:30:00-09:30") == 0;
DateTime frac = DateTimeFromUnixNs(base + 123456789ull, 0);- In
Write.c:932:
StrClear(&s);
StrAppendFmt(&s, "{}", frac);
ok = ok && ZstrCompare(StrBegin(&s), "2021-01-01T00:00:00.123456789Z") == 0;
StrDeinit(&s);- In
Write.c:1000:
Str text = FloatToStr(&f);
bool ok = (ZstrCompare(StrBegin(&text), expected) == 0);
StrDeinit(&text);- In
Write.c:1015:
Str back = StrInit(&alloc);
FileRead(&f, &back);
ok = (ZstrCompare(StrBegin(&back), expect) == 0);
StrDeinit(&back);
FileClose(&f);- In
Write.c:1197:
// of the whole buffer, so the prefix "AB" rides along: " ABxyz". A wrong
// start_len / sub->add mis-computes content_len and changes the pad count.
ok = ok && (ZstrCompare(StrBegin(&output), " ABxyz") == 0);
StrDeinit(&s);- In
Write.c:1215:
Str s = StrInitFromZstr("hi", &alloc);
StrAppendFmt(&output, "{<5}", s);
ok = ok && (ZstrCompare(StrBegin(&output), "hi ") == 0);
StrDeinit(&s);- In
Write.c:1236:
StrAppendFmt(&output, "{X}", s);
ok = ok && (ZstrCompare(StrBegin(&output), "0x0F") == 0);
StrDeinit(&s);- In
Write.c:1256:
StrAppendFmt(&output, "{x}", s);
ok = ok && (ZstrCompare(StrBegin(&output), "0x0f") == 0);
StrDeinit(&s);- In
Write.c:1279:
StrAppendFmt(&output, "{x}", s);
// gt_to_ge => " 0x01 0x02" (leading space); gt_to_le => "0x010x02".
ok = ok && (ZstrCompare(StrBegin(&output), "0x01 0x02") == 0);
StrDeinit(&s);- In
Write.c:1299:
StrAppendFmt(&output, "{x}", s);
ok = ok && (ZstrCompare(StrBegin(&output), "0x05") == 0);
StrDeinit(&s);- In
Write.c:1317:
Str s = StrInitFromZstr("hello", &alloc);
StrAppendFmt(&output, "{.3}", s);
ok = ok && (ZstrCompare(StrBegin(&output), "hel") == 0);
StrDeinit(&s);- In
Write.c:1523:
Zstr s = "AB"; // 0x41 0x42
StrAppendFmt(&output, "{x}", s);
bool ok = (ZstrCompare(StrBegin(&output), "0x41 0x42") == 0);
StrDeinit(&output);- In
Write.c:1539:
Zstr s = "Z"; // 0x5a
StrAppendFmt(&output, "{x}", s);
bool ok = (ZstrCompare(StrBegin(&output), "0x5a") == 0);
StrDeinit(&output);- In
Write.c:1556:
Zstr s = "\xab"; // single byte 0xab
StrAppendFmt(&output, "{x}", s);
bool ok = (ZstrCompare(StrBegin(&output), "0xab") == 0);
StrDeinit(&output);- In
Write.c:1573:
Zstr s = "\xab";
StrAppendFmt(&output, "{X}", s);
bool ok = (ZstrCompare(StrBegin(&output), "0xAB") == 0);
StrDeinit(&output);- In
Write.c:1589:
Zstr s = "\x05"; // single byte 0x05
StrAppendFmt(&output, "{x}", s);
bool ok = (ZstrCompare(StrBegin(&output), "0x05") == 0);
StrDeinit(&output);- In
Write.c:1604:
Zstr s = "\xfe";
StrAppendFmt(&output, "{x}", s);
bool ok = (ZstrCompare(StrBegin(&output), "0xfe") == 0);
StrDeinit(&output);- In
Write.c:1620:
Zstr s = "Hello";
StrAppendFmt(&output, "{.3}", s);
bool ok = (ZstrCompare(StrBegin(&output), "Hel") == 0);
StrDeinit(&output);- In
Write.c:1636:
Zstr s = "Hi";
StrAppendFmt(&output, "{.10}", s);
bool ok = (ZstrCompare(StrBegin(&output), "Hi") == 0);
StrDeinit(&output);- In
Write.c:1669:
Zstr s = "Hello";
StrAppendFmt(&output, "{.1}", s);
bool ok = (ZstrCompare(StrBegin(&output), "H") == 0);
StrDeinit(&output);- In
Write.c:1688:
Zstr s = "Hi";
StrAppendFmt(&output, "abc{>10}", s);
bool ok = (ZstrCompare(StrBegin(&output), " abcHi") == 0);
StrDeinit(&output);- In
Write.c:1703:
Zstr s = "Hi";
StrAppendFmt(&output, "xy{<10}", s);
bool ok = (ZstrCompare(StrBegin(&output), "xyHi ") == 0);
StrDeinit(&output);- In
Write.c:1718:
Zstr s = "";
StrAppendFmt(&output, "{>5}", s);
bool ok = (ZstrCompare(StrBegin(&output), " ") == 0);
StrDeinit(&output);- In
Write.c:1984:
StrAppendFmt(&output, "{e}", v);
ok = ok && (ZstrCompare(StrBegin(&output), "1e+00") == 0);
FloatDeinit(&v);- In
Write.c:2004:
StrAppendFmt(&output, "{.0e}", v);
ok = ok && (ZstrCompare(StrBegin(&output), "0e+00") == 0);
FloatDeinit(&v);- In
Write.c:2026:
StrAppendFmt(&output, "{.3e}", v);
ok = ok && (ZstrCompare(StrBegin(&output), "0.000e+00") == 0);
FloatDeinit(&v);- In
Write.c:2047:
StrAppendFmt(&output, "{.2e}", v);
ok = ok && (ZstrCompare(StrBegin(&output), "1.20e+01") == 0);
FloatDeinit(&v);- In
Write.c:2067:
StrAppendFmt(&output, "{e}", v);
ok = ok && (ZstrCompare(StrBegin(&output), "1.234567e+04") == 0);
StrClear(&output);- In
Write.c:2071:
StrAppendFmt(&output, "{E}", v);
ok = ok && (ZstrCompare(StrBegin(&output), "1.234567E+04") == 0);
FloatDeinit(&v);- In
Write.c:2395:
Str text = FloatToStr(&val);
success = success && (ZstrCompare(StrBegin(&text), "3.5") == 0);
StrDeinit(&text);- In
Write.c:2423:
Str text = FloatToStr(&val);
success = success && (ZstrCompare(StrBegin(&text), "12.25") == 0);
StrDeinit(&text);- In
Write.c:2450:
// 1.5e2 == 150
Str text = FloatToStr(&val);
success = success && (ZstrCompare(StrBegin(&text), "150") == 0);
StrDeinit(&text);- In
Write.c:2475:
Str text = FloatToStr(&val);
success = success && (ZstrCompare(StrBegin(&text), "-0.25") == 0);
StrDeinit(&text);- In
Write.c:2561:
StrAppendFmt(&out, "{05}", (u32)42);
ok = ok && (ZstrCompare(StrBegin(&out), "00042") == 0);
ok = ok && (StrLen(&out) == 5);- In
Write.c:2583:
StrAppendFmt(&out, "{05}", (u32)12345);
ok = ok && (ZstrCompare(StrBegin(&out), "12345") == 0);
ok = ok && (StrLen(&out) == 5);- In
Write.c:2609:
StrAppendFmt(&out, "{06}", (i32)-42);
ok = ok && (ZstrCompare(StrBegin(&out), "-00042") == 0);
ok = ok && (StrLen(&out) == 6);- In
Write.c:2638:
StrAppendFmt(&out, "{05}", (i32)42);
ok = ok && (ZstrCompare(StrBegin(&out), "00042") == 0);
StrDeinit(&out);- In
Write.c:2666:
StrAppendFmt(&out, "{08}", (i32)-7);
ok = ok && (ZstrCompare(StrBegin(&out), "-0000007") == 0);
ok = ok && (StrLen(&out) == 8);- In
Write.c:2691:
StrAppendFmt(&out, "{016x}", (u32)0xFF);
ok = ok && (ZstrCompare(StrBegin(&out), "00000000000000ff") == 0);
ok = ok && (StrLen(&out) == 16);- In
Write.c:2718:
Str out;
success = success && float_try_to_decimal_str(&out, &val, 3, true, alloc_base);
success = success && (ZstrCompare(StrBegin(&out), "12.000") == 0);
StrDeinit(&out);- In
Write.c:2740:
Str out;
success = success && float_try_to_decimal_str(&out, &val, 0, true, alloc_base);
success = success && (ZstrCompare(StrBegin(&out), "12") == 0);
StrDeinit(&out);- In
Write.c:2763:
Str out;
success = success && float_try_to_decimal_str(&out, &val, 3, true, alloc_base);
success = success && (ZstrCompare(StrBegin(&out), "1.500") == 0);
StrDeinit(&out);- In
Write.c:2785:
Str out;
success = success && float_try_to_decimal_str(&out, &val, 0, true, alloc_base);
success = success && (ZstrCompare(StrBegin(&out), "1") == 0);
StrDeinit(&out);- In
Write.c:2807:
Str out;
success = success && float_try_to_decimal_str(&out, &val, 1, true, alloc_base);
success = success && (ZstrCompare(StrBegin(&out), "1.2") == 0);
StrDeinit(&out);- In
Write.c:2828:
f64 v = 1.5;
StrAppendFmt(&output, "{}", v);
ok = ok && (ZstrCompare(StrBegin(&output), "1.500000") == 0);
StrDeinit(&output);- In
Write.c:2848:
f64 v = 1.5;
StrAppendFmt(&output, "{e}", v);
ok = ok && (ZstrCompare(StrBegin(&output), "1.500000e+00") == 0);
StrDeinit(&output);- In
Write.c:2866:
f64 v = 1.5;
StrAppendFmt(&output, "{E}", v);
ok = ok && (ZstrCompare(StrBegin(&output), "1.500000E+00") == 0);
StrDeinit(&output);- In
Write.c:2888:
f64 v = 1.5;
StrAppendFmt(&output, "{12}", v);
ok = ok && (ZstrCompare(StrBegin(&output), " 1.500000") == 0);
ok = ok && (StrLen(&output) == 12);- In
Write.c:2913:
f64 v = 1.5;
StrAppendFmt(&output, "{12}", v);
ok = ok && (ZstrCompare(StrBegin(&output), " XYZ1.500000") == 0);
StrDeinit(&output);- In
Write.c:2954:
StrAppendFmt(&out, "{e}", v);
bool ok = (ZstrCompare(StrBegin(&out), "1e+00") == 0);
FloatDeinit(&v);- In
Write.c:2974:
StrAppendFmt(&out, "{e}", v);
bool ok = (ZstrCompare(StrBegin(&out), "1e-03") == 0);
FloatDeinit(&v);- In
Write.c:2993:
StrAppendFmt(&out, "{e}", v);
bool ok = (ZstrCompare(StrBegin(&out), "1e+12") == 0);
FloatDeinit(&v);- In
Write.c:3085:
// Real: lowercase hex "0xff". base->42 mutant fails (not "0xff");
// and_to_or mutant would force caps -> "0xFF".
bool ok = (ZstrCompare(StrBegin(&out), "0xff") == 0);
StrDeinit(&out);- In
Write.c:3099:
StrAppendFmt(&out, "{X}", v);
// Real: uppercase hex "0xFF". ne_to_eq mutant inverts caps -> "0xff".
bool ok = (ZstrCompare(StrBegin(&out), "0xFF") == 0);
StrDeinit(&out);- In
Write.c:3112:
i64 v = 5; // 0b101
StrAppendFmt(&out, "{b}", v);
bool ok = (ZstrCompare(StrBegin(&out), "0b101") == 0);
StrDeinit(&out);- In
Write.c:3125:
i64 v = 8; // 0o10
StrAppendFmt(&out, "{o}", v);
bool ok = (ZstrCompare(StrBegin(&out), "0o10") == 0);
StrDeinit(&out);- In
Write.c:3139:
i64 v = -42;
StrAppendFmt(&out, "{}", v);
bool ok = (ZstrCompare(StrBegin(&out), "-42") == 0);
StrDeinit(&out);- In
Write.c:3152:
i64 v = 42;
StrAppendFmt(&out, "X{5}", v);
bool ok = (ZstrCompare(StrBegin(&out), " X42") == 0);
StrDeinit(&out);- In
Write.c:3168:
StrAppendFmt(&out, "X{05}", v);
// start_len=1, content "42" len 2, width 5 -> three '0' fills: "X00042".
bool ok = (ZstrCompare(StrBegin(&out), "X00042") == 0);
StrDeinit(&out);- In
Write.c:3233:
StrAppendFmt(&output, "{c}", a);
success = (ZstrCompare(StrBegin(&output), "A") == 0);
IntDeinit(&a);- In
Write.c:3252:
StrAppendFmt(&output, "{c}", a);
success = (ZstrCompare(StrBegin(&output), "z") == 0);
IntDeinit(&a);- In
Write.c:3278:
StrAppendFmt(&output, "ab");
StrAppendFmt(&output, "{>6}", seven);
success = (ZstrCompare(StrBegin(&output), " ab7") == 0);
IntDeinit(&seven);- In
Write.c:3316:
u8 v = 200;
bool ok = StrAppendFmt(&out, "{1r}", v);
ok = ok && (ZstrCompare(StrBegin(&out), "200") == 0);
StrDeinit(&out);- In
Write.c:3336:
u16 v = 258;
bool ok = StrAppendFmt(&out, "{2r}", v);
ok = ok && (ZstrCompare(StrBegin(&out), "258") == 0);
StrDeinit(&out);- In
Write.c:3356:
u32 v = 65538;
bool ok = StrAppendFmt(&out, "{4r}", v);
ok = ok && (ZstrCompare(StrBegin(&out), "65538") == 0);
StrDeinit(&out);- In
Write.c:3376:
u64 v = 4294967298ULL;
bool ok = StrAppendFmt(&out, "{8r}", v);
ok = ok && (ZstrCompare(StrBegin(&out), "4294967298") == 0);
StrDeinit(&out);- In
Write.c:3395:
i64 v = 4294967298LL;
bool ok = StrAppendFmt(&out, "{8r}", v);
ok = ok && (ZstrCompare(StrBegin(&out), "4294967298") == 0);
StrDeinit(&out);- In
Write.c:3442:
// the "X:" prefix rides along after the spaces: " X:255" (len 10).
StrAppendFmt(&out, "{8}", v);
ok = ok && (ZstrCompare(StrBegin(&out), " X:255") == 0);
StrDeinit(&out);- In
Write.c:3458:
u64 v = 7;
StrAppendFmt(&out, "{5}", v); // " 7"
ok = ok && (ZstrCompare(StrBegin(&out), " 7") == 0);
StrClear(&out);- In
Write.c:3463:
// Left-align variant so a dropped pad is unambiguous.
StrAppendFmt(&out, "{<5}", v); // "7 "
ok = ok && (ZstrCompare(StrBegin(&out), "7 ") == 0);
StrDeinit(&out);- In
Write.c:3481:
u64 v = 42;
StrAppendFmt(&out, "{05}", v); // zero-pad width 5 -> "00042"
ok = ok && (ZstrCompare(StrBegin(&out), "p00042") == 0);
StrDeinit(&out);- In
Write.c:3636:
StrAppendFmt(&out, "{e}", v);
bool ok = ZstrCompare(StrBegin(&out), "1.234567e+04") == 0;
FloatDeinit(&v);- In
Write.c:3655:
StrAppendFmt(&out, "{.2e}", v);
bool ok = ZstrCompare(StrBegin(&out), "1.23e+04") == 0;
FloatDeinit(&v);- In
Write.c:3681:
StrAppendFmt(&out, "XX");
StrAppendFmt(&out, "{>5}", v);
bool ok = ZstrCompare(StrBegin(&out), " XX1.2") == 0 && StrLen(&out) == 7;
FloatDeinit(&v);- In
Write.c:3721:
StrAppendFmt(&out, "XX{>5}", bv);
bool ok = (StrLen(&out) == 7) && (ZstrCompare(StrBegin(&out), " XX1") == 0);
BitVecDeinit(&bv);- In
Write.c:3756:
bool r = StrPatchFmt(&o, 0, "AB{");
bool ok = (r == false) && (ZstrCompare(StrBegin(&o), "-----") == 0);
StrDeinit(&o);- In
Write.c:3772:
bool r = StrPatchFmt(&o, StrLen(&o), ""); // offset == length, empty render
bool ok = (r == true) && (ZstrCompare(StrBegin(&o), "hello") == 0);
StrDeinit(&o);- In
Write.c:3788:
bool r = StrPatchFmt(&o, 0, "12345"); // renders exactly 5 chars
bool ok = (r == true) && (ZstrCompare(StrBegin(&o), "12345") == 0);
StrDeinit(&o);- In
Write.c:3826:
Str oct_text = IntToOctStr(&oct);
bool ok = (ZstrCompare(StrBegin(&oct_text), "7") == 0);
StrDeinit(&oct_text);- In
Write.c:3845:
StrAppendFmt(&output, "{s}", ZstrIO(name, alloc_base));
bool ok = (ZstrCompare(StrBegin(&output), "hello") == 0);
StrDeinit(&output);- In
Write.c:3882:
StrAppendFmt(&output, "{c}", v);
bool ok = (StrLen(&output) == 4) && (ZstrCompare(StrBegin(&output), "BCDE") == 0);
StrDeinit(&output);- In
Write.c:3968:
StrPushBackR(&src, 0x1A);
StrAppendFmt(&out, "{c}", src);
ok = ok && (ZstrCompare(StrBegin(&out), "\\x1a") == 0);
StrClear(&out);
StrClear(&src);- In
Write.c:3976:
StrPushBackR(&src, 0xA1);
StrAppendFmt(&out, "{c}", src);
ok = ok && (ZstrCompare(StrBegin(&out), "\\xa1") == 0);
StrDeinit(&src);- In
Write.c:4002:
Float f = FloatFromStr("1.2", alloc_base);
StrAppendFmt(&out, "{.5}", f);
ok = ok && (ZstrCompare(StrBegin(&out), "1.20000") == 0);
StrClear(&out);- In
Write.c:4007:
Float g = FloatFromStr("3.14", alloc_base);
StrAppendFmt(&out, "{.6}", g);
ok = ok && (ZstrCompare(StrBegin(&out), "3.140000") == 0);
FloatDeinit(&f);- In
Write.c:4032:
u32 v = 255;
StrAppendFmt(&out, "{03}", v);
ok = ok && (ZstrCompare(StrBegin(&out), "255") == 0);
StrClear(&out);- In
Write.c:4037:
// Sanity: width one wider really does pad (guards against a no-op pad).
StrAppendFmt(&out, "{04}", v);
ok = ok && (ZstrCompare(StrBegin(&out), "0255") == 0);
StrDeinit(&out);- In
Write.c:4058:
Zstr s = "abc";
StrAppendFmt(&out, "{3}", s);
ok = ok && (ZstrCompare(StrBegin(&out), "abc") == 0);
StrClear(&out);- In
Write.c:4063:
// Left/center at the exact boundary likewise add nothing.
StrAppendFmt(&out, "{<3}", s);
ok = ok && (ZstrCompare(StrBegin(&out), "abc") == 0);
StrClear(&out);- In
Write.c:4067:
StrAppendFmt(&out, "{^3}", s);
ok = ok && (ZstrCompare(StrBegin(&out), "abc") == 0);
StrClear(&out);- In
Write.c:4072:
// Sanity: width 4 does pad (one space, right-aligned default).
StrAppendFmt(&out, "{4}", s);
ok = ok && (ZstrCompare(StrBegin(&out), " abc") == 0);
StrDeinit(&out);- In
Write.c:4144:
Str s = StrInitFromZstr("hello", &alloc);
StrAppendFmt(&out, "{}", s); // width defaults to 0 -> no padding
ok = ok && (ZstrCompare(StrBegin(&out), "hello") == 0);
StrDeinit(&s);- In
Write.c:4168:
f64 v = 3.14;
StrAppendFmt(&out, "{}", v); // default precision 6
ok = ok && (ZstrCompare(StrBegin(&out), "3.140000") == 0);
StrClear(&out);- In
Write.c:4172:
StrAppendFmt(&out, "{.2}", v); // explicit precision 2
ok = ok && (ZstrCompare(StrBegin(&out), "3.14") == 0);
StrDeinit(&out);- In
Write.c:4659:
StrAppendFmt(&out, "{05}", (u32)7);
ok = ok && (ZstrCompare(StrBegin(&out), "00007") == 0);
StrDeinit(&out);- In
Write.c:4679:
StrAppendFmt(&out, "{007}", (u32)3);
ok = ok && (ZstrCompare(StrBegin(&out), "0000003") == 0);
StrDeinit(&out);- In
Write.c:4696:
StrAppendFmt(&out, "{09}", (u32)3);
ok = ok && (ZstrCompare(StrBegin(&out), "000000003") == 0);
StrDeinit(&out);- In
Write.c:4718:
StrAppendFmt(&out, "{9}", (u32)3);
ok = ok && (ZstrCompare(StrBegin(&out), " 3") == 0);
ok = ok && (StrLen(&out) == 9);- In
Write.c:4745:
bool rc = StrAppendFmt(&out, "{.9s}", s);
ok = ok && rc;
ok = ok && (ZstrCompare(StrBegin(&out), "Hello") == 0);
StrDeinit(&out);- In
Write.c:4809:
u32 v = 7;
StrAppendFmt(&out, "{05}", v);
bool ok = (ZstrCompare(StrBegin(&out), "00007") == 0);
StrDeinit(&out);
DefaultAllocatorDeinit(&alloc);- In
Write.c:4823:
Zstr s = "ab";
StrAppendFmt(&out, "{4}", s);
bool ok = (ZstrCompare(StrBegin(&out), " ab") == 0);
StrClear(&out);
// Two-digit width exercises the width loop (151) more than once.
- In
Write.c:4827:
// Two-digit width exercises the width loop (151) more than once.
StrAppendFmt(&out, "{12}", s);
ok = ok && (ZstrCompare(StrBegin(&out), " ab") == 0);
StrDeinit(&out);
DefaultAllocatorDeinit(&alloc);- In
Write.c:4842:
f64 v = 3.14159;
StrAppendFmt(&out, "{.2}", v);
bool ok = (ZstrCompare(StrBegin(&out), "3.14") == 0);
StrClear(&out);
// multi-digit precision exercises the precision loop body (165).
- In
Write.c:4846:
// multi-digit precision exercises the precision loop body (165).
StrAppendFmt(&out, "{.4}", v);
ok = ok && (ZstrCompare(StrBegin(&out), "3.1416") == 0);
StrDeinit(&out);
DefaultAllocatorDeinit(&alloc);- In
Write.c:4861:
bool rc = StrAppendFmt(&out, "{.}", v);
// Real: false; output keeps only the prior "literal" (append stopped).
bool ok = (rc == false) && (ZstrCompare(StrBegin(&out), "literal") == 0);
StrDeinit(&out);
DefaultAllocatorDeinit(&alloc);- In
Write.c:4877:
i32 v = -7;
StrAppendFmt(&out, "{05}", v);
bool ok = (ZstrCompare(StrBegin(&out), "-0007") == 0);
StrDeinit(&out);
DefaultAllocatorDeinit(&alloc);- In
Write.c:4894:
u32 v = 123;
StrAppendFmt(&out, "{03}", v);
bool ok = (ZstrCompare(StrBegin(&out), "123") == 0);
StrClear(&out);
StrAppendFmt(&out, "{05}", v);- In
Write.c:4897:
StrClear(&out);
StrAppendFmt(&out, "{05}", v);
ok = ok && (ZstrCompare(StrBegin(&out), "00123") == 0);
StrDeinit(&out);
DefaultAllocatorDeinit(&alloc);- In
Write.c:4910:
Zstr s = "abc";
StrAppendFmt(&out, "{3}", s);
bool ok = (ZstrCompare(StrBegin(&out), "abc") == 0);
StrClear(&out);
StrAppendFmt(&out, "{5}", s);- In
Write.c:4913:
StrClear(&out);
StrAppendFmt(&out, "{5}", s);
ok = ok && (ZstrCompare(StrBegin(&out), " abc") == 0);
StrDeinit(&out);
DefaultAllocatorDeinit(&alloc);- In
Write.c:4925:
Str out = StrInit(&alloc);
StrAppendFmt(&out, "a{{b");
bool ok = (ZstrCompare(StrBegin(&out), "a{b") == 0);
StrDeinit(&out);
DefaultAllocatorDeinit(&alloc);- In
Write.c:4936:
Str out = StrInit(&alloc);
StrAppendFmt(&out, "a}}b");
bool ok = (ZstrCompare(StrBegin(&out), "a}b") == 0);
StrDeinit(&out);
DefaultAllocatorDeinit(&alloc);- In
Write.c:4949:
u32 v = 0xAB;
StrAppendFmt(&out, "{x}", v);
bool ok = (ZstrCompare(StrBegin(&out), "0xab") == 0);
StrDeinit(&out);
DefaultAllocatorDeinit(&alloc);- In
Write.c:4965:
u16 v = 0x1234; // 4660
bool rc = StrAppendFmt(&out, "{<2r}", v);
bool ok = rc && (ZstrCompare(StrBegin(&out), "4660") == 0);
StrDeinit(&out);
DefaultAllocatorDeinit(&alloc);- In
Write.c:4978:
u64 v = 0x0102030405060708ULL; // 72623859790382856
bool rc = StrAppendFmt(&out, "{>8r}", v);
bool ok = rc && (ZstrCompare(StrBegin(&out), "72623859790382856") == 0);
StrDeinit(&out);
DefaultAllocatorDeinit(&alloc);- In
Write.c:5000:
Str back = StrInit(&alloc);
FileRead(&r, &back);
ok = ok && (ZstrCompare(StrBegin(&back), "n=42\n") == 0);
StrDeinit(&back);
FileClose(&r);- In
Write.c:5031:
Str back = StrInit(&alloc);
FileRead(&r, &back);
ok = ok && (ZstrCompare(StrBegin(&back), "X") == 0);
StrDeinit(&back);
FileClose(&r);- In
Write.c:5070:
StrPushBackR(&s, (char)0x4F); // multi-digit so StrLen(&hex)!=1 path
StrAppendFmt(&out, "{x}", s);
bool ok = (ZstrCompare(StrBegin(&out), "0x01 0x4f") == 0);
StrDeinit(&s);
return ok && dbg_no_leak(&dbg, &out);- In
Write.c:5082:
StrPushBackR(&s, (char)0x05);
StrAppendFmt(&out, "{x}", s);
bool ok = (ZstrCompare(StrBegin(&out), "0x05") == 0);
StrDeinit(&s);
return ok && dbg_no_leak(&dbg, &out);- In
Write.c:5092:
Zstr s = "\x01\x4f";
StrAppendFmt(&out, "{x}", s);
bool ok = (ZstrCompare(StrBegin(&out), "0x01 0x4f") == 0);
return ok && dbg_no_leak(&dbg, &out);
}- In
Write.c:5100:
Zstr s = "\x05";
StrAppendFmt(&out, "{x}", s);
bool ok = (ZstrCompare(StrBegin(&out), "0x05") == 0);
return ok && dbg_no_leak(&dbg, &out);
}- In
Write.c:5111:
Str s = StrInitFromZstr("hi", &alloc);
StrAppendFmt(&out, "{}", s); // width 0 default
bool ok = (ZstrCompare(StrBegin(&out), "hi") == 0);
StrClear(&out);
StrAppendFmt(&out, "{5}", s);- In
Write.c:5114:
StrClear(&out);
StrAppendFmt(&out, "{5}", s);
ok = ok && (ZstrCompare(StrBegin(&out), " hi") == 0);
StrDeinit(&s);
StrDeinit(&out);- In
Write.c:5126:
Zstr s = "hi";
StrAppendFmt(&out, "{}", s);
bool ok = (ZstrCompare(StrBegin(&out), "hi") == 0);
StrClear(&out);
StrAppendFmt(&out, "{5}", s);- In
Write.c:5129:
StrClear(&out);
StrAppendFmt(&out, "{5}", s);
ok = ok && (ZstrCompare(StrBegin(&out), " hi") == 0);
StrDeinit(&out);
DefaultAllocatorDeinit(&alloc);- In
Write.c:5143:
u64 v = 1234567890ULL;
StrAppendFmt(&out, "{}", v);
bool ok = (ZstrCompare(StrBegin(&out), "1234567890") == 0);
return ok && dbg_no_leak(&dbg, &out);
}- In
Write.c:5151:
i64 v = -1234567890LL;
StrAppendFmt(&out, "{}", v);
bool ok = (ZstrCompare(StrBegin(&out), "-1234567890") == 0);
return ok && dbg_no_leak(&dbg, &out);
}- In
Write.c:5161:
u64 v = 42;
StrAppendFmt(&out, "{}", v);
bool ok = (ZstrCompare(StrBegin(&out), "42") == 0);
StrClear(&out);
StrAppendFmt(&out, "{6}", v);- In
Write.c:5164:
StrClear(&out);
StrAppendFmt(&out, "{6}", v);
ok = ok && (ZstrCompare(StrBegin(&out), " 42") == 0);
StrDeinit(&out);
DefaultAllocatorDeinit(&alloc);- In
Write.c:5175:
i64 v = -42;
StrAppendFmt(&out, "{}", v);
bool ok = (ZstrCompare(StrBegin(&out), "-42") == 0);
StrClear(&out);
StrAppendFmt(&out, "{6}", v);- In
Write.c:5178:
StrClear(&out);
StrAppendFmt(&out, "{6}", v);
ok = ok && (ZstrCompare(StrBegin(&out), " -42") == 0);
StrDeinit(&out);
DefaultAllocatorDeinit(&alloc);- In
Write.c:5195:
MemCopy(&v, &bits, sizeof(v));
StrAppendFmt(&out, "{c}", v);
bool ok = (ZstrCompare(StrBegin(&out), "ABCDEFGH") == 0);
StrDeinit(&out);
DefaultAllocatorDeinit(&alloc);- In
Write.c:5207:
f64 ninf = -F64_INFINITY;
StrAppendFmt(&out, "{}", ninf);
bool ok = (ZstrCompare(StrBegin(&out), "-inf") == 0);
StrClear(&out);
f64 pinf = F64_INFINITY;- In
Write.c:5211:
f64 pinf = F64_INFINITY;
StrAppendFmt(&out, "{}", pinf);
ok = ok && (ZstrCompare(StrBegin(&out), "inf") == 0);
StrDeinit(&out);
DefaultAllocatorDeinit(&alloc);- In
Write.c:5226:
f64 v = 1.5;
StrAppendFmt(&out, "{}", v);
bool ok = (ZstrCompare(StrBegin(&out), "1.500000") == 0);
StrClear(&out);
// explicit precision 2 to contrast.
- In
Write.c:5230:
// explicit precision 2 to contrast.
StrAppendFmt(&out, "{.2}", v);
ok = ok && (ZstrCompare(StrBegin(&out), "1.50") == 0);
StrDeinit(&out);
DefaultAllocatorDeinit(&alloc);- In
Write.c:5241:
f64 v = 2.71828;
StrAppendFmt(&out, "{}", v);
bool ok = (ZstrCompare(StrBegin(&out), "2.718280") == 0);
return ok && dbg_no_leak(&dbg, &out);
}- In
Write.c:5251:
f64 v = 1.5;
StrAppendFmt(&out, "{.1}", v);
bool ok = (ZstrCompare(StrBegin(&out), "1.5") == 0);
StrClear(&out);
StrAppendFmt(&out, "{6.1}", v);- In
Write.c:5254:
StrClear(&out);
StrAppendFmt(&out, "{6.1}", v);
ok = ok && (ZstrCompare(StrBegin(&out), " 1.5") == 0);
StrDeinit(&out);
DefaultAllocatorDeinit(&alloc);- In
Write.c:5268:
Float v = FloatFromStr("12345.67", ab);
StrAppendFmt(&out, "{e}", v);
bool ok = (ZstrCompare(StrBegin(&out), "1.234567e+04") == 0);
StrClear(&out);
Float w = FloatFromStr("0.001234", ab);- In
Write.c:5272:
Float w = FloatFromStr("0.001234", ab);
StrAppendFmt(&out, "{e}", w);
ok = ok && (ZstrCompare(StrBegin(&out), "1.234e-03") == 0);
FloatDeinit(&v);
FloatDeinit(&w);- In
Write.c:5292:
Float v = FloatFromStr("1.0", ab);
StrAppendFmt(&out, "{e}", v);
bool ok = (ZstrCompare(StrBegin(&out), "1e+00") == 0);
FloatDeinit(&v);
StrDeinit(&out);- In
Write.c:5307:
Float v = FloatFromStr("2.0", ab);
StrAppendFmt(&out, "{e}", v);
bool ok = (ZstrCompare(StrBegin(&out), "2e+00") == 0);
FloatDeinit(&v);
StrDeinit(&out);- In
Write.c:5321:
Float v = FloatFromStr("1234567890.012345", &dbg.base);
StrAppendFmt(&out, "{}", v);
bool ok = (ZstrCompare(StrBegin(&out), "1234567890.012345") == 0);
FloatDeinit(&v);
return ok && dbg_no_leak(&dbg, &out);- In
Write.c:5333:
Float v = FloatFromStr("3.14159", ab);
StrAppendFmt(&out, "{.2}", v);
bool ok = (ZstrCompare(StrBegin(&out), "3.14") == 0);
StrClear(&out);
// precision longer than frac pads with zeros.
- In
Write.c:5337:
// precision longer than frac pads with zeros.
StrAppendFmt(&out, "{.8}", v);
ok = ok && (ZstrCompare(StrBegin(&out), "3.14159000") == 0);
FloatDeinit(&v);
StrDeinit(&out);- In
Write.c:5352:
Float v = FloatFromStr("5", ab);
StrAppendFmt(&out, "{.3}", v);
bool ok = (ZstrCompare(StrBegin(&out), "5.000") == 0);
FloatDeinit(&v);
StrDeinit(&out);- In
Write.c:5363:
Float v = FloatFromStr("12345.67", &dbg.base);
StrAppendFmt(&out, "{e}", v);
bool ok = (ZstrCompare(StrBegin(&out), "1.234567e+04") == 0);
FloatDeinit(&v);
return ok && dbg_no_leak(&dbg, &out);- In
Write.c:5376:
Float v = FloatFromStr("1.5", ab);
StrAppendFmt(&out, "{}", v);
bool ok = (ZstrCompare(StrBegin(&out), "1.5") == 0);
StrClear(&out);
StrAppendFmt(&out, "{6}", v);- In
Write.c:5379:
StrClear(&out);
StrAppendFmt(&out, "{6}", v);
ok = ok && (ZstrCompare(StrBegin(&out), " 1.5") == 0);
FloatDeinit(&v);
StrDeinit(&out);- In
Write.c:5396:
StrAppendFmt(&out, "AB");
StrAppendFmt(&out, "{>6}", v);
bool ok = (ZstrCompare(StrBegin(&out), " AB1.5") == 0);
FloatDeinit(&v);
StrDeinit(&out);- In
Write.c:5410:
BitVec bv = BitVecFromStr("10110", &dbg.base);
StrAppendFmt(&out, "{}", bv);
bool ok = (ZstrCompare(StrBegin(&out), "10110") == 0);
BitVecDeinit(&bv);
return ok && dbg_no_leak(&dbg, &out);- In
Write.c:5422:
BitVec bv = BitVecFromStr("101", ab);
StrAppendFmt(&out, "{}", bv);
bool ok = (ZstrCompare(StrBegin(&out), "101") == 0);
StrClear(&out);
StrAppendFmt(&out, "{6}", bv);- In
Write.c:5425:
StrClear(&out);
StrAppendFmt(&out, "{6}", bv);
ok = ok && (ZstrCompare(StrBegin(&out), " 101") == 0);
BitVecDeinit(&bv);
StrDeinit(&out);- In
Write.c:5439:
Int v = IntFromStr("123456789012345678901234567890", &dbg.base);
StrAppendFmt(&out, "{}", v);
bool ok = (ZstrCompare(StrBegin(&out), "123456789012345678901234567890") == 0);
IntDeinit(&v);
return ok && dbg_no_leak(&dbg, &out);- In
Write.c:5451:
Int v = IntFrom(42, ab);
StrAppendFmt(&out, "{}", v);
bool ok = (ZstrCompare(StrBegin(&out), "42") == 0);
StrClear(&out);
StrAppendFmt(&out, "{6}", v);- In
Write.c:5454:
StrClear(&out);
StrAppendFmt(&out, "{6}", v);
ok = ok && (ZstrCompare(StrBegin(&out), " 42") == 0);
IntDeinit(&v);
StrDeinit(&out);- In
Read.c:372:
z = "Allocator-backed";
StrReadFmt(z, "{s}", ZstrIO(zs, alloc_base));
success = success && (ZstrCompare(zs, "Allocator-backed") == 0);
z = "\"Allocator-backed replacement\"";- In
Read.c:376:
z = "\"Allocator-backed replacement\"";
StrReadFmt(z, "{s}", ZstrIO(zs, alloc_base));
success = success && (ZstrCompare(zs, "Allocator-backed replacement") == 0);
zstr_deinit(&zs, alloc_base);
}- In
Read.c:850:
StrReadFmt(z, "{}", bv1);
Str result1 = BitVecToStr(&bv1);
success = success && (ZstrCompare(StrBegin(&result1), "10110") == 0);
WriteFmt(
"Test 1 - Binary: {}, Success: {}\n",- In
Read.c:854:
"Test 1 - Binary: {}, Success: {}\n",
result1,
(ZstrCompare(StrBegin(&result1), "10110") == 0) ? "true" : "false"
);
StrDeinit(&result1);- In
Read.c:879:
StrReadFmt(z, "{}", bv4);
Str result4 = BitVecToStr(&bv4);
success = success && (ZstrCompare(StrBegin(&result4), "1101") == 0);
WriteFmt(
"Test 4 - Whitespace: {}, Success: {}\n",- In
Read.c:883:
"Test 4 - Whitespace: {}, Success: {}\n",
result4,
(ZstrCompare(StrBegin(&result4), "1101") == 0) ? "true" : "false"
);
StrDeinit(&result4);- In
Read.c:892:
StrReadFmt(z, "{}", bv5);
Str result5 = BitVecToStr(&bv5);
success = success && (ZstrCompare(StrBegin(&result5), "0") == 0);
WriteFmt(
"Test 5 - Zero: {}, Success: {}\n",- In
Read.c:896:
"Test 5 - Zero: {}, Success: {}\n",
result5,
(ZstrCompare(StrBegin(&result5), "0") == 0) ? "true" : "false"
);
StrDeinit(&result5);- In
Read.c:928:
StrReadFmt(z, "{}", dec);
dec_text = IntToStr(&dec);
success = success && (ZstrCompare(StrBegin(&dec_text), "123456789012345678901234567890") == 0);
z = "deadbeefcafebabe1234";- In
Read.c:933:
StrReadFmt(z, "{x}", hex);
hex_text = IntToHexStr(&hex);
success = success && (ZstrCompare(StrBegin(&hex_text), "deadbeefcafebabe1234") == 0);
z = "10100011";- In
Read.c:938:
StrReadFmt(z, "{b}", bin);
bin_text = IntToBinary(&bin);
success = success && (ZstrCompare(StrBegin(&bin_text), "10100011") == 0);
z = "755";- In
Read.c:943:
StrReadFmt(z, "{o}", oct);
oct_text = IntToOctStr(&oct);
success = success && (ZstrCompare(StrBegin(&oct_text), "755") == 0);
StrDeinit(&dec_text);- In
Read.c:978:
StrReadFmt(z, "{}", dec);
dec_text = FloatToStr(&dec);
success = success && (ZstrCompare(StrBegin(&dec_text), "1234567890.012345") == 0);
z = "1.234567e+04";- In
Read.c:983:
StrReadFmt(z, "{e}", sci);
sci_text = FloatToStr(&sci);
success = success && (ZstrCompare(StrBegin(&sci_text), "12345.67") == 0);
z = "-0.00125";- In
Read.c:988:
StrReadFmt(z, "{}", neg);
neg_text = FloatToStr(&neg);
success = success && (ZstrCompare(StrBegin(&neg_text), "-0.00125") == 0);
StrDeinit(&dec_text);- In
Read.c:1436:
bool ok = StrAppendFmt(&out, "}}");
ok = ok && (ZstrCompare(StrBegin(&out), "}") == 0);
StrDeinit(&out);- In
Read.c:1490:
Zstr next = _read_ZstrAlloc(input, &fmt, &arg);
bool ok = (next != NULL) && out && (ZstrCompare(out, input) == 0);
if (out) {- In
Read.c:1513:
Zstr next = _read_ZstrAlloc(input, NULL, &arg);
bool ok = (next != NULL) && out && (ZstrCompare(out, input) == 0);
if (out) {- In
Read.c:1568:
StrAppendFmt(&output, "{c}", v);
bool ok = (ZstrCompare(StrBegin(&output), "\\x1a\\xe0") == 0);
StrDeinit(&output);- In
Read.c:1858:
Zstr b = "\x12";
StrAppendFmt(&out, "{c}", b);
ok = ok && (ZstrCompare(StrBegin(&out), "\\x12") == 0);
StrDeinit(&out);- In
Read.c:1876:
Zstr b = "\x90";
StrAppendFmt(&out, "{c}", b);
ok = ok && (ZstrCompare(StrBegin(&out), "\\x90") == 0);
StrDeinit(&out);- In
Read.c:1897:
Zstr b = "\xab";
StrAppendFmt(&out, "{c}", b);
ok = ok && (ZstrCompare(StrBegin(&out), "\\xab") == 0);
StrDeinit(&out);- In
Read.c:1917:
Zstr b = "\xcd";
StrAppendFmt(&out, "{c}", b);
ok = ok && (ZstrCompare(StrBegin(&out), "\\xcd") == 0);
StrDeinit(&out);- In
Read.c:1937:
Zstr b = "\xab";
StrAppendFmt(&out, "{A}", b);
ok = ok && (ZstrCompare(StrBegin(&out), "\\xAB") == 0);
StrDeinit(&out);- In
Read.c:1955:
Zstr b = "\xcd";
StrAppendFmt(&out, "{A}", b);
ok = ok && (ZstrCompare(StrBegin(&out), "\\xCD") == 0);
StrDeinit(&out);- In
Read.c:1974:
Zstr lo_letter = "\x1b";
StrAppendFmt(&out, "{c}", lo_letter);
ok = ok && (ZstrCompare(StrBegin(&out), "\\x1b") == 0);
StrClear(&out);- In
Read.c:1979:
Zstr hi_letter = "\xb1";
StrAppendFmt(&out, "{c}", hi_letter);
ok = ok && (ZstrCompare(StrBegin(&out), "\\xb1") == 0);
StrDeinit(&out);- In
Read.c:2118:
StrReadFmt(in, "{}", f);
Str t = FloatToStr(&f);
bool ok = (ZstrCompare(StrBegin(&t), expect) == 0);
StrDeinit(&t);
FloatDeinit(&f);- In
Read.c:2500:
// Unquoted, non-{s} read takes the whole input (whitespace only ends an
// is_string field), so s is the full "hello world".
bool ok = (out != NULL) && s && (ZstrCompare(s, "hello world") == 0);
if (s)
AllocatorFree(&dbg.base, s);- In
Read.c:2569:
StrReadFmt(z, "{}", v);
Str t = IntToStr(&v);
bool ok = (ZstrCompare(StrBegin(&t), "12345") == 0);
StrDeinit(&t);
IntDeinit(&v);- In
Read.c:2584:
StrReadFmt(z, "{}", v);
Str t = IntToStr(&v);
bool ok = (ZstrCompare(StrBegin(&t), "99") == 0);
StrDeinit(&t);
IntDeinit(&v);- In
Read.c:2600:
StrReadFmt(z, "{x}", v);
Str t = IntToStr(&v);
bool ok = (ZstrCompare(StrBegin(&t), "255") == 0);
StrDeinit(&t);
IntDeinit(&v);- In
Read.c:2618:
// NULL; v unchanged (still 777).
Str t = IntToStr(&v);
bool ok = (out == NULL) && (ZstrCompare(StrBegin(&t), "777") == 0);
StrDeinit(&t);
IntDeinit(&v);- In
Read.c:2636:
StrReadFmt(z, "{}", f);
Str t = FloatToStr(&f);
bool ok = (ZstrCompare(StrBegin(&t), "3.14159") == 0);
StrDeinit(&t);
FloatDeinit(&f);- In
Read.c:2653:
Zstr out = str_read_fmt(z, "{}", (TypeSpecificIO[]) {TO_TYPE_SPECIFIC_IO(Float, &f)}, 1);
Str t = FloatToStr(&f);
bool ok = (out == NULL) && (ZstrCompare(StrBegin(&t), "42") == 0);
StrDeinit(&t);
FloatDeinit(&f);- In
Ops.c:72:
// Test StrFind (Str * key) with match at end
Zstr found1 = StrFind(&haystack, &needle1);
bool result = (found1 != NULL && ZstrCompare(found1, "World") == 0);
// Test StrFind (Str * key) with match at beginning
- In
Ops.c:76:
// Test StrFind (Str * key) with match at beginning
Zstr found2 = StrFind(&haystack, &needle2);
result = result && (found2 != NULL && ZstrCompare(found2, "Hello World") == 0);
// Test StrFind (Str * key) with no match
- In
Ops.c:84:
// Test StrFind (Zstr key)
Zstr found4 = StrFind(&haystack, "World");
result = result && (found4 != NULL && ZstrCompare(found4, "World") == 0);
// Test StrFind (Cstr key, key_len)
- In
Ops.c:172:
Str s1 = StrInitFromZstr("Hello World", &alloc);
StrReplace(&s1, "World", "Universe", 1);
bool result = (ZstrCompare(StrBegin(&s1), "Hello Universe") == 0);
// Test multiple replacements
- In
Ops.c:178:
s1 = StrInitFromZstr("Hello Hello Hello", &alloc);
StrReplace(&s1, "Hello", "Hi", 2);
result = result && (ZstrCompare(StrBegin(&s1), "Hi Hi Hello") == 0);
// Test Cstr-form (fixed-length views) - use the full "World" string instead of just "Wo"
- In
Ops.c:184:
s1 = StrInitFromZstr("Hello World", &alloc);
StrReplace(&s1, "World", 5, "Universe", 8, 1);
result = result && (ZstrCompare(StrBegin(&s1), "Hello Universe") == 0);
// Test Str-form
- In
Ops.c:192:
Str replace = StrInitFromZstr("Universe", &alloc);
StrReplace(&s1, &find, &replace, 1);
result = result && (ZstrCompare(StrBegin(&s1), "Hello Universe") == 0);
StrDeinit(&s1);- In
Ops.c:213:
bool result = (VecLen(&split) == 3);
if (VecLen(&split) >= 3) {
result = result && (ZstrCompare(StrBegin(VecPtrAt(&split, 0)), "Hello") == 0);
result = result && (ZstrCompare(StrBegin(VecPtrAt(&split, 1)), "World") == 0);
result = result && (ZstrCompare(StrBegin(VecPtrAt(&split, 2)), "Test") == 0);- In
Ops.c:214:
if (VecLen(&split) >= 3) {
result = result && (ZstrCompare(StrBegin(VecPtrAt(&split, 0)), "Hello") == 0);
result = result && (ZstrCompare(StrBegin(VecPtrAt(&split, 1)), "World") == 0);
result = result && (ZstrCompare(StrBegin(VecPtrAt(&split, 2)), "Test") == 0);
}- In
Ops.c:215:
result = result && (ZstrCompare(StrBegin(VecPtrAt(&split, 0)), "Hello") == 0);
result = result && (ZstrCompare(StrBegin(VecPtrAt(&split, 1)), "World") == 0);
result = result && (ZstrCompare(StrBegin(VecPtrAt(&split, 2)), "Test") == 0);
}- In
Ops.c:231:
char buffer1[10] = {0};
MemCopy(buffer1, iter1->data, StrIterLength(iter1));
result = result && (ZstrCompare(buffer1, "Hello") == 0);
StrIter *iter2 = VecPtrAt(&iters, 1);- In
Ops.c:236:
char buffer2[10] = {0};
MemCopy(buffer2, iter2->data, StrIterLength(iter2));
result = result && (ZstrCompare(buffer2, "World") == 0);
StrIter *iter3 = VecPtrAt(&iters, 2);- In
Ops.c:241:
char buffer3[10] = {0};
MemCopy(buffer3, iter3->data, StrIterLength(iter3));
result = result && (ZstrCompare(buffer3, "Test") == 0);
}- In
Ops.c:259:
Str s1 = StrInitFromZstr(" Hello ", &alloc);
Str stripped = StrLStrip(&s1, NULL);
bool result = (ZstrCompare(StrBegin(&stripped), "Hello ") == 0);
StrDeinit(&stripped);- In
Ops.c:264:
// Test StrRStrip
stripped = StrRStrip(&s1, NULL);
result = result && (ZstrCompare(StrBegin(&stripped), " Hello") == 0);
StrDeinit(&stripped);- In
Ops.c:269:
// Test StrStrip
stripped = StrStrip(&s1, NULL);
result = result && (ZstrCompare(StrBegin(&stripped), "Hello") == 0);
StrDeinit(&stripped);- In
Ops.c:277:
stripped = StrLStrip(&s1, "*");
result = result && (ZstrCompare(StrBegin(&stripped), "Hello***") == 0);
StrDeinit(&stripped);- In
Ops.c:281:
stripped = StrRStrip(&s1, "*");
result = result && (ZstrCompare(StrBegin(&stripped), "***Hello") == 0);
StrDeinit(&stripped);- In
Ops.c:285:
stripped = StrStrip(&s1, "*");
result = result && (ZstrCompare(StrBegin(&stripped), "Hello") == 0);
StrDeinit(&stripped);- In
Ops.c:417:
Str s = StrInitFromZstr("x", &alloc);
Str stripped = StrStrip(&s, "*");
bool result = (StrLen(&stripped) == 1) && (ZstrCompare(StrBegin(&stripped), "x") == 0);
StrDeinit(&stripped);- In
Memory.c:164:
// Check that the string was reversed
bool result = (ZstrCompare(StrBegin(&s), "olleH") == 0);
// Test with an even-length string
- In
Memory.c:174:
// Check that the string was reversed
result = result && (ZstrCompare(StrBegin(&s), "dcba") == 0);
// Test with a single-character string
- In
Memory.c:184:
// Check that the string is unchanged
result = result && (ZstrCompare(StrBegin(&s), "a") == 0);
// Test with an empty string
- In
Init.c:77:
// Check that it's initialized correctly
bool result = (StrLen(&s) == ZstrLen(test_str) && ZstrCompare(StrBegin(&s), test_str) == 0);
StrDeinit(&s);- In
Init.c:95:
ValidateStr(&s);
bool result = (StrLen(&s) == ZstrLen(test_str) && ZstrCompare(StrBegin(&s), test_str) == 0);
StrDeinit(&s);- In
Init.c:116:
// Check that dst is initialized correctly
bool result = (StrLen(&dst) == StrLen(&src) && ZstrCompare(StrBegin(&dst), StrBegin(&src)) == 0);
StrDeinit(&src);- In
Init.c:138:
// Check that dst is initialized correctly
bool result = (StrLen(&dst) == StrLen(&src) && ZstrCompare(StrBegin(&dst), StrBegin(&src)) == 0);
StrDeinit(&src);- In
Init.c:159:
// Check that it's initialized correctly
bool result = (ZstrCompare(StrBegin(&s), "Hello, World!") == 0);
StrDeinit(&s);- In
Init.c:179:
ValidateStr(&stack_str);
if (ZstrCompare(StrBegin(&stack_str), "Hello, Stack!") != 0) {
result = false;
}- In
Init.c:211:
// Check that the copy was successful
bool result = (success && StrLen(&dst) == StrLen(&src) && ZstrCompare(StrBegin(&dst), StrBegin(&src)) == 0);
StrDeinit(&src);- In
Init.c:239:
bool result = copied && StrLen(&dup) == StrLen(&src) && StrLen(&dst) == StrLen(&src) &&
ZstrCompare(StrBegin(&dup), StrBegin(&src)) == 0 &&
ZstrCompare(StrBegin(&dst), StrBegin(&src)) == 0 && dup_allocator_matches && dst_allocator_matches;- In
Init.c:240:
bool result = copied && StrLen(&dup) == StrLen(&src) && StrLen(&dst) == StrLen(&src) &&
ZstrCompare(StrBegin(&dup), StrBegin(&src)) == 0 &&
ZstrCompare(StrBegin(&dst), StrBegin(&src)) == 0 && dup_allocator_matches && dst_allocator_matches;
StrDeinit(&src);- In
Insert.c:39:
// Check that the character was inserted correctly
bool result = (ZstrCompare(StrBegin(&s), "He!llo") == 0);
// Insert a character at the beginning
- In
Insert.c:45:
// Check that the character was inserted correctly
result = result && (ZstrCompare(StrBegin(&s), "?He!llo") == 0);
// Insert a character at the end
- In
Insert.c:51:
// Check that the character was inserted correctly
result = result && (ZstrCompare(StrBegin(&s), "?He!llo.") == 0);
StrDeinit(&s);- In
Insert.c:70:
// Check that the string was inserted correctly
bool result = (ZstrCompare(StrBegin(&s), "He Worldllo") == 0);
StrDeinit(&s);- In
Insert.c:90:
// Check that the string was inserted correctly
bool result = (ZstrCompare(StrBegin(&s), "He Worldllo") == 0);
StrDeinit(&s);- In
Insert.c:109:
// Check that the string was inserted correctly
bool result = (ZstrCompare(StrBegin(&s), "He Worldllo") == 0);
StrDeinit(&s);- In
Insert.c:128:
// Check that the string was inserted correctly
bool result = (ZstrCompare(StrBegin(&s), "He Worldllo") == 0);
StrDeinit(&s);- In
Insert.c:147:
// Check that the string was inserted correctly
bool result = (ZstrCompare(StrBegin(&s), "Hello World") == 0);
StrDeinit(&s);- In
Insert.c:166:
// Check that the string was inserted correctly
bool result = (ZstrCompare(StrBegin(&s), "Hello World") == 0);
StrDeinit(&s);- In
Insert.c:185:
// Check that the string was inserted correctly
bool result = (ZstrCompare(StrBegin(&s), "Hello World") == 0);
StrDeinit(&s);- In
Insert.c:204:
// Check that the string was inserted correctly
bool result = (ZstrCompare(StrBegin(&s), "Hello World") == 0);
StrDeinit(&s);- In
Insert.c:228:
// Check that the characters were inserted correctly
bool result = (ZstrCompare(StrBegin(&s), "Hello World") == 0);
StrDeinit(&s);- In
Insert.c:252:
// Check that the characters were inserted correctly
bool result = (ZstrCompare(StrBegin(&s), "Hello World") == 0);
StrDeinit(&s);- In
Insert.c:276:
// Check that the strings were merged correctly
bool result = (ZstrCompare(StrBegin(&s1), "Hello World") == 0);
// Check that s2 was reset - data should be NULL, length should be 0
- In
Insert.c:300:
// Check that the strings were merged correctly
bool result = (ZstrCompare(StrBegin(&s1), "Hello World") == 0);
// Check that s2 was not reset
- In
Insert.c:303:
// Check that s2 was not reset
result = result && (StrLen(&s2) == 6 && ZstrCompare(StrBegin(&s2), " World") == 0);
StrDeinit(&s1);- In
Insert.c:324:
// Check that the strings were merged correctly
bool result = (ZstrCompare(StrBegin(&s1), "Hello World") == 0);
// s2 was zeroed on take per L-form contract
- In
Insert.c:348:
// Check that the string was appended correctly
bool result = (ZstrCompare(StrBegin(&s), "Hello World 2023") == 0);
StrDeinit(&s);- In
Type.c:36:
StrPushBackR(&s, 'o');
bool result = (StrLen(&s) == 5 && ZstrCompare(StrBegin(&s), "Hello") == 0);
StrDeinit(&s);- In
Type.c:67:
Str *str2 = &VecAt(&sv, 1);
result = result && (ZstrCompare(StrBegin(str1), "Hello") == 0);
result = result && (ZstrCompare(StrBegin(str2), "World") == 0);
}- In
Type.c:68:
result = result && (ZstrCompare(StrBegin(str1), "Hello") == 0);
result = result && (ZstrCompare(StrBegin(str2), "World") == 0);
}- In
Remove.c:33:
// Check that the character was popped correctly
bool result = (c == 'o' && ZstrCompare(StrBegin(&s), "Hell") == 0);
// Pop another character without storing it - avoid passing NULL directly
- In
Remove.c:40:
// Check that the character was removed
result = result && (ZstrCompare(StrBegin(&s), "Hel") == 0);
StrDeinit(&s);- In
Remove.c:60:
// Check that the character was popped correctly
bool result = (c == 'H' && ZstrCompare(StrBegin(&s), "ello") == 0);
// Pop another character without storing it - avoid passing NULL directly
- In
Remove.c:67:
// Check that the character was removed
result = result && (ZstrCompare(StrBegin(&s), "llo") == 0);
StrDeinit(&s);- In
Remove.c:87:
// Check that the character was removed correctly
bool result = (c == 'l' && ZstrCompare(StrBegin(&s), "Helo") == 0);
// Remove another character without storing it - avoid passing NULL directly
- In
Remove.c:94:
// Check that the character was removed
result = result && (ZstrCompare(StrBegin(&s), "Hlo") == 0);
StrDeinit(&s);- In
Remove.c:117:
// Check that the characters were removed correctly
bool result = (ZstrCompare(buffer, " Worl") == 0 && ZstrCompare(StrBegin(&s), "Hellod") == 0);
// Remove another range without storing it - use a temporary buffer instead of NULL
- In
Remove.c:124:
// Check that the characters were removed
result = result && (ZstrCompare(StrBegin(&s), "Hell") == 0);
StrDeinit(&s);- In
Remove.c:143:
// Check that the character was deleted
bool result = (ZstrCompare(StrBegin(&s), "Hell") == 0);
// Delete another character
- In
Remove.c:149:
// Check that the character was deleted
result = result && (ZstrCompare(StrBegin(&s), "Hel") == 0);
StrDeinit(&s);- In
Remove.c:168:
// Check that the character was deleted
bool result = (ZstrCompare(StrBegin(&s), "Helo") == 0);
// Delete another character
- In
Remove.c:174:
// Check that the character was deleted
result = result && (ZstrCompare(StrBegin(&s), "Hlo") == 0);
StrDeinit(&s);- In
Remove.c:193:
// Check that the characters were deleted
bool result = (ZstrCompare(StrBegin(&s), "Hello") == 0);
// Delete another range
- In
Remove.c:199:
// Check that the characters were deleted
result = result && (ZstrCompare(StrBegin(&s), "Heo") == 0);
StrDeinit(&s);- In
Convert.c:40:
StrIntFormat config = {.base = 10, .uppercase = false};
StrFromU64(&s, 12345, &config);
bool result = (ZstrCompare(StrBegin(&s), "12345") == 0);
if (!result) {
WriteFmt(" FAIL: Expected '12345', got '{}'\n", s);- In
Convert.c:49:
config = (StrIntFormat) {.base = 16, .uppercase = false, .use_prefix = true};
StrFromU64(&s, 0xABCD, &config);
result = result && (ZstrCompare(StrBegin(&s), "0xabcd") == 0);
if (!result) {
WriteFmt(" FAIL: Expected '0xabcd', got '{}'\n", s);- In
Convert.c:58:
config = (StrIntFormat) {.base = 16, .uppercase = true, .use_prefix = true};
StrFromU64(&s, 0xABCD, &config);
result = result && (ZstrCompare(StrBegin(&s), "0xABCD") == 0);
if (!result) {
WriteFmt(" FAIL: Expected '0xABCD', got '{}'\n", s);- In
Convert.c:67:
config = (StrIntFormat) {.base = 2, .uppercase = false, .use_prefix = true};
StrFromU64(&s, 42, &config);
result = result && (ZstrCompare(StrBegin(&s), "0b101010") == 0);
if (!result) {
WriteFmt(" FAIL: Expected '0b101010', got '{}'\n", s);- In
Convert.c:76:
config = (StrIntFormat) {.base = 8, .uppercase = false, .use_prefix = true};
StrFromU64(&s, 42, &config);
result = result && (ZstrCompare(StrBegin(&s), "0o52") == 0);
if (!result) {
WriteFmt(" FAIL: Expected '0o52', got '{}'\n", s);- In
Convert.c:85:
config = (StrIntFormat) {.base = 10, .uppercase = false};
StrFromU64(&s, 0, &config);
result = result && (ZstrCompare(StrBegin(&s), "0") == 0);
if (!result) {
WriteFmt(" FAIL: Expected '0', got '{}'\n", s);- In
Convert.c:106:
StrIntFormat config = {.base = 10, .uppercase = false};
StrFromI64(&s, 12345, &config);
bool result = (ZstrCompare(StrBegin(&s), "12345") == 0);
if (!result) {
WriteFmt(" FAIL: Expected '12345', got '{}'\n", StrBegin(&s));- In
Convert.c:115:
config = (StrIntFormat) {.base = 10, .uppercase = false};
StrFromI64(&s, -12345, &config);
result = result && (ZstrCompare(StrBegin(&s), "-12345") == 0);
if (!result) {
WriteFmt(" FAIL: Expected '-12345', got '{}'\n", StrBegin(&s));- In
Convert.c:135:
config = (StrIntFormat) {.base = 10, .uppercase = false};
StrFromI64(&s, 0, &config);
result = result && (ZstrCompare(StrBegin(&s), "0") == 0);
if (!result) {
WriteFmt(" FAIL: Expected '0', got '{}'\n", StrBegin(&s));- In
Convert.c:144:
config = (StrIntFormat) {.base = 2, .uppercase = false, .use_prefix = true};
StrFromI64(&s, 42, &config);
result = result && (ZstrCompare(StrBegin(&s), "0b101010") == 0);
if (!result) {
WriteFmt(" FAIL: Expected '0b101010', got '{}'\n", StrBegin(&s));- In
Convert.c:165:
StrFloatFormat config = {.precision = 2, .force_sci = false, .uppercase = false};
StrFromF64(&s, 123.0, &config);
bool result = (ZstrCompare(StrBegin(&s), "123.00") == 0);
if (!result) {
WriteFmt(" FAIL: Expected '123.00', got '{}'\n", StrBegin(&s));- In
Convert.c:174:
config = (StrFloatFormat) {.precision = 3, .force_sci = false, .uppercase = false};
StrFromF64(&s, 123.456, &config);
result = result && (ZstrCompare(StrBegin(&s), "123.456") == 0);
if (!result) {
WriteFmt(" FAIL: Expected '123.456', got '{}'\n", StrBegin(&s));- In
Convert.c:183:
config = (StrFloatFormat) {.precision = 3, .force_sci = false, .uppercase = false};
StrFromF64(&s, -123.456, &config);
result = result && (ZstrCompare(StrBegin(&s), "-123.456") == 0);
// Test scientific notation (forced)
- In
Convert.c:189:
config = (StrFloatFormat) {.precision = 3, .force_sci = true, .uppercase = false};
StrFromF64(&s, 123.456, &config);
result = result && (ZstrCompare(StrBegin(&s), "1.235e+02") == 0);
// Test scientific notation (uppercase)
- In
Convert.c:195:
config = (StrFloatFormat) {.precision = 3, .force_sci = true, .uppercase = true};
StrFromF64(&s, 123.456, &config);
result = result && (ZstrCompare(StrBegin(&s), "1.235E+02") == 0);
// Test very small number (auto scientific notation)
- In
Convert.c:201:
config = (StrFloatFormat) {.precision = 3, .force_sci = false, .uppercase = false};
StrFromF64(&s, 0.0000123, &config);
result = result && (ZstrCompare(StrBegin(&s), "1.230e-05") == 0);
// Test very large number (auto scientific notation)
- In
Convert.c:207:
config = (StrFloatFormat) {.precision = 2, .force_sci = false, .uppercase = false};
StrFromF64(&s, 1234567890123.0, &config);
result = result && (ZstrCompare(StrBegin(&s), "1.23e+12") == 0);
// Test zero
- In
Convert.c:213:
config = (StrFloatFormat) {.precision = 2, .force_sci = false, .uppercase = false};
StrFromF64(&s, 0.0, &config);
result = result && (ZstrCompare(StrBegin(&s), "0.00") == 0);
// Test infinity
- In
Convert.c:219:
config = (StrFloatFormat) {.precision = 2, .force_sci = false, .uppercase = false};
StrFromF64(&s, F64_INFINITY, &config);
result = result && (ZstrCompare(StrBegin(&s), "inf") == 0);
// Test negative infinity
- In
Convert.c:225:
config = (StrFloatFormat) {.precision = 2, .force_sci = false, .uppercase = false};
StrFromF64(&s, -F64_INFINITY, &config);
result = result && (ZstrCompare(StrBegin(&s), "-inf") == 0);
// Test NaN
- In
Convert.c:231:
config = (StrFloatFormat) {.precision = 2, .force_sci = false, .uppercase = false};
StrFromF64(&s, F64_NAN, &config);
result = result && (ZstrCompare(StrBegin(&s), "nan") == 0);
StrDeinit(&s);- In
Convert.c:1329:
StrFromF64(&s, F64_NAN, &config);
bool result = (StrLen(&s) == 3) && (ZstrCompare(StrBegin(&s), "nan") == 0);
if (!result)
WriteFmt(" FAIL: expected len 3 \"nan\", got len {} \"{}\"\n", StrLen(&s), StrBegin(&s));- In
Convert.c:1348:
StrFromF64(&s, F64_INFINITY, &config);
bool result = (StrLen(&s) == 3) && (ZstrCompare(StrBegin(&s), "inf") == 0);
if (!result)
WriteFmt(" FAIL: expected len 3 \"inf\", got len {} \"{}\"\n", StrLen(&s), StrBegin(&s));- In
Convert.c:1368:
StrFromF64(&s, 0.0001, &config);
bool result = (ZstrCompare(StrBegin(&s), "0.000100") == 0);
if (!result)
WriteFmt(" FAIL: expected \"0.000100\", got \"{}\"\n", StrBegin(&s));- In
Convert.c:1388:
StrFromF64(&s, 1e7, &config);
bool result = (ZstrCompare(StrBegin(&s), "1.00e+07") == 0);
if (!result)
WriteFmt(" FAIL: expected \"1.00e+07\", got \"{}\"\n", StrBegin(&s));- In
Convert.c:1408:
StrFromF64(&s, 5.0, &config);
bool result = (ZstrCompare(StrBegin(&s), "5e+00") == 0);
if (!result)
WriteFmt(" FAIL: expected \"5e+00\", got \"{}\"\n", StrBegin(&s));- In
Convert.c:1427:
StrFromF64(&s, 5.0, &config);
bool result = (ZstrCompare(StrBegin(&s), "5.00e+00") == 0);
if (!result)
WriteFmt(" FAIL: expected \"5.00e+00\", got \"{}\"\n", StrBegin(&s));- In
Convert.c:1448:
Str *r = StrFromF64(&s, 123.456, &config);
bool result = (r == &s) && (ZstrCompare(StrBegin(&s), "1.23e+02") == 0);
if (!result)
WriteFmt(" FAIL: expected handle + \"1.23e+02\", got null={} \"{}\"\n", (r == NULL), StrBegin(&s));- In
Convert.c:1468:
Str *r = StrFromF64(&s, 123.0, &config);
bool result = (r == &s) && (ZstrCompare(StrBegin(&s), "123.00") == 0);
if (!result)
WriteFmt(" FAIL: expected handle + \"123.00\", got null={} \"{}\"\n", (r == NULL), StrBegin(&s));- In
Convert.c:1488:
StrFromF64(&s, 123.0, &config);
bool result = (ZstrCompare(StrBegin(&s), "123") == 0);
if (!result)
WriteFmt(" FAIL: expected \"123\", got \"{}\"\n", StrBegin(&s));- In
Convert.c:1508:
StrFromF64(&s, 123.456, &config);
bool result = (ZstrCompare(StrBegin(&s), "123.456") == 0);
if (!result)
WriteFmt(" FAIL: expected \"123.456\", got \"{}\"\n", StrBegin(&s));- In
Convert.c:1529:
StrFromF64(&s, 0.1235, &config);
bool result = (ZstrCompare(StrBegin(&s), "0.124") == 0);
if (!result)
WriteFmt(" FAIL: expected \"0.124\", got \"{}\"\n", StrBegin(&s));- In
Convert.c:1867:
StrIntFormat config = {.base = 10, .uppercase = false};
StrFromI64(&s, INT64_MIN, &config);
bool result = (ZstrCompare(StrBegin(&s), "-9223372036854775808") == 0);
StrDeinit(&s);- In
Convert.c:1887:
StrFloatFormat config = {.precision = 1, .force_sci = false, .uppercase = false};
StrFromF64(&s, 2.25, &config);
bool result = (ZstrCompare(StrBegin(&s), "2.3") == 0);
if (!result) {
WriteFmt(" FAIL: Expected '2.3', got '{}'\n", StrBegin(&s));- In
Convert.c:1907:
StrFloatFormat config = {.precision = 1, .force_sci = false, .uppercase = false};
StrFromF64(&s, 2.25, &config);
bool result = (ZstrCompare(StrBegin(&s), "2.3") == 0);
if (!result) {
WriteFmt(" FAIL: Expected '2.3', got '{}'\n", StrBegin(&s));- In
Convert.c:1957:
Str *ret = StrFromU64(&s, 12345, &config);
bool result = (ret == &s) && (ZstrCompare(StrBegin(&s), "12345") == 0);
if (!result) {
WriteFmt(" FAIL: expected &s and '12345', got ret={} '{}'\n", (ret != NULL), s);- In
Foreach.c:48:
// The result should be "H0e1l2l3o4"
bool success = (ZstrCompare(StrBegin(&result), "H0e1l2l3o4") == 0);
StrDeinit(&s);- In
Foreach.c:72:
}
bool success = (ZstrCompare(StrBegin(&result), "o4l3l2e1H0") == 0);
WriteFmt(" (Index 0 was processed)\n");- In
Foreach.c:102:
// The result should be "H0e1l2l3o4"
bool success = (ZstrCompare(StrBegin(&result), "H0e1l2l3o4") == 0);
// The original string should now be "HELLO" (all uppercase)
- In
Foreach.c:105:
// The original string should now be "HELLO" (all uppercase)
success = success && (ZstrCompare(StrBegin(&s), "HELLO") == 0);
StrDeinit(&s);- In
Foreach.c:135:
bool success = false;
success = (ZstrCompare(StrBegin(&result), "o4l3l2e1H0") == 0);
success = success && (ZstrCompare(StrBegin(&s), "HELLO") == 0); // All uppercase
WriteFmt(" (Index 0 was processed)\n");- In
Foreach.c:136:
bool success = false;
success = (ZstrCompare(StrBegin(&result), "o4l3l2e1H0") == 0);
success = success && (ZstrCompare(StrBegin(&s), "HELLO") == 0); // All uppercase
WriteFmt(" (Index 0 was processed)\n");- In
Foreach.c:161:
// The result should be "Hello"
bool success = (ZstrCompare(StrBegin(&result), "Hello") == 0);
StrDeinit(&s);- In
Foreach.c:190:
bool success = false;
if (char_count == StrLen(&s)) {
success = (ZstrCompare(StrBegin(&result), "olleH") == 0);
WriteFmt(" (All characters were processed)\n");
} else {- In
Foreach.c:193:
WriteFmt(" (All characters were processed)\n");
} else {
success = (ZstrCompare(StrBegin(&result), "olle") == 0);
WriteFmt(" (First character was NOT processed - bug in macro)\n");
}- In
Foreach.c:224:
// The result should be "Hello" (original values before modification)
bool success = (ZstrCompare(StrBegin(&result), "Hello") == 0);
// The original string should now be "HELLO" (all uppercase)
- In
Foreach.c:227:
// The original string should now be "HELLO" (all uppercase)
success = success && (ZstrCompare(StrBegin(&s), "HELLO") == 0);
StrDeinit(&s);- In
Foreach.c:262:
bool success = false;
if (char_count == StrLen(&s)) {
success = (ZstrCompare(StrBegin(&result), "olleH") == 0);
success = success && (ZstrCompare(StrBegin(&s), "HELLO") == 0); // All uppercase
WriteFmt(" (All characters were processed)\n");- In
Foreach.c:263:
if (char_count == StrLen(&s)) {
success = (ZstrCompare(StrBegin(&result), "olleH") == 0);
success = success && (ZstrCompare(StrBegin(&s), "HELLO") == 0); // All uppercase
WriteFmt(" (All characters were processed)\n");
} else {- In
Foreach.c:266:
WriteFmt(" (All characters were processed)\n");
} else {
success = (ZstrCompare(StrBegin(&result), "olle") == 0);
success = success && (ZstrCompare(StrBegin(&s), "HELLo") == 0); // All uppercase except first char
WriteFmt(" (First character was NOT processed - bug in macro)\n");- In
Foreach.c:267:
} else {
success = (ZstrCompare(StrBegin(&result), "olle") == 0);
success = success && (ZstrCompare(StrBegin(&s), "HELLo") == 0); // All uppercase except first char
WriteFmt(" (First character was NOT processed - bug in macro)\n");
}- In
Foreach.c:293:
// The result should be "W6o7r8l9d10" (characters from index 6-10 with their indices)
bool success = (ZstrCompare(StrBegin(&result), "W6o7r8l9d10") == 0);
// Test with empty range
- In
Foreach.c:328:
// The result should be "Hello" (first 5 characters)
bool success = (ZstrCompare(StrBegin(&result), "Hello") == 0);
// Test with range at the end of the string
- In
Foreach.c:338:
// The end_result should be "World" (last 5 characters)
success = success && (ZstrCompare(StrBegin(&end_result), "World") == 0);
StrDeinit(&s);- In
Foreach.c:368:
// The result should be "W6o7r8l9d10" (characters from index 6-10 with their indices)
bool success = (ZstrCompare(StrBegin(&result), "W6o7r8l9d10") == 0);
// The original string should now have "WORLD" in uppercase
- In
Foreach.c:371:
// The original string should now have "WORLD" in uppercase
success = success && (ZstrCompare(StrBegin(&s), "Hello WORLD") == 0);
StrDeinit(&s);- In
Foreach.c:400:
// The result should be "Hello" (first 5 characters)
bool success = (ZstrCompare(StrBegin(&result), "Hello") == 0);
// The original string should now have "HELLO" in uppercase
- In
Foreach.c:403:
// The original string should now have "HELLO" in uppercase
success = success && (ZstrCompare(StrBegin(&s), "HELLO World") == 0);
StrDeinit(&s);- In
Ops.c:64:
result = result && (MapValueCountForKey(&map, "alpha") == 2);
stored_value = MapGetFirstPtr(&map, "alpha");
result = result && stored_value && (*stored_value != value) && (ZstrCompare(*stored_value, "first") == 0);
MapForeachValueForKey(&map, "alpha", entry_value) {
if ((ZstrCompare(entry_value, "first") == 0) || (ZstrCompare(entry_value, "second") == 0)) {- In
Ops.c:66:
result = result && stored_value && (*stored_value != value) && (ZstrCompare(*stored_value, "first") == 0);
MapForeachValueForKey(&map, "alpha", entry_value) {
if ((ZstrCompare(entry_value, "first") == 0) || (ZstrCompare(entry_value, "second") == 0)) {
value_count += 1;
}- In
Ops.c:103:
(MapPolicy(&map).should_rehash == MapPolicyQuadratic.should_rehash);
result = result && (MapValueCountForKey(&map, "red") == 2);
result = result && MapGetFirstPtr(&map, "red") && (ZstrCompare(*MapGetFirstPtr(&map, "red"), "apple") == 0);
result = result && MapGetFirstPtr(&map, "yellow") && (ZstrCompare(*MapGetFirstPtr(&map, "yellow"), "banana") == 0);
result = result && MapGetFirstPtr(&map, "green") && (ZstrCompare(*MapGetFirstPtr(&map, "green"), "pear") == 0);- In
Ops.c:104:
result = result && (MapValueCountForKey(&map, "red") == 2);
result = result && MapGetFirstPtr(&map, "red") && (ZstrCompare(*MapGetFirstPtr(&map, "red"), "apple") == 0);
result = result && MapGetFirstPtr(&map, "yellow") && (ZstrCompare(*MapGetFirstPtr(&map, "yellow"), "banana") == 0);
result = result && MapGetFirstPtr(&map, "green") && (ZstrCompare(*MapGetFirstPtr(&map, "green"), "pear") == 0);
MapForeachValueForKey(&map, "red", red_value) {- In
Ops.c:105:
result = result && MapGetFirstPtr(&map, "red") && (ZstrCompare(*MapGetFirstPtr(&map, "red"), "apple") == 0);
result = result && MapGetFirstPtr(&map, "yellow") && (ZstrCompare(*MapGetFirstPtr(&map, "yellow"), "banana") == 0);
result = result && MapGetFirstPtr(&map, "green") && (ZstrCompare(*MapGetFirstPtr(&map, "green"), "pear") == 0);
MapForeachValueForKey(&map, "red", red_value) {
if ((ZstrCompare(red_value, "apple") == 0) || (ZstrCompare(red_value, "cherry") == 0)) {- In
Ops.c:107:
result = result && MapGetFirstPtr(&map, "green") && (ZstrCompare(*MapGetFirstPtr(&map, "green"), "pear") == 0);
MapForeachValueForKey(&map, "red", red_value) {
if ((ZstrCompare(red_value, "apple") == 0) || (ZstrCompare(red_value, "cherry") == 0)) {
red_count += 1;
}- In
Init.c:238:
MapInsertR(&map, "alpha", "first");
result = result && (MapPairCount(&map) == 1);
result = result && MapGetFirstPtr(&map, "alpha") && (ZstrCompare(*MapGetFirstPtr(&map, "alpha"), "first") == 0);
MapDeinit(&map);- In
Type.c:108:
custom_policy.max_probe_count = 0;
bool result = ZstrCompare(MapPolicy(&map).name, "custom-linear") == 0 &&
MapPolicy(&map).should_rehash == custom_should_rehash_snapshot &&
MapPolicy(&map).next_capacity == custom_next_capacity &&- In
Type.c:148:
bool result = MapKeyHash(&map) == i32_hash && MapKeyCompare(&map) == i32_compare &&
MapValueCompare(&map) == i32_compare && ZstrCompare(MapPolicy(&map).name, "vcmp-policy") == 0 &&
MapPolicy(&map).should_rehash == custom_should_rehash_snapshot &&
MapPolicy(&map).next_capacity == custom_next_capacity &&- In
PdbCache.c:321:
u32 offset = 0;
bool ok = PdbCacheResolve(&cache, (Zstr)pe_path, module_base, ip, &name, &offset);
ok = ok && name && ZstrCompare(name, "winproc") == 0 && offset == 0;
// Second resolution should hit the cache (not strictly verifiable
- In
PdbCache.c:329:
offset = 0;
ok = ok && PdbCacheResolve(&cache, (Zstr)pe_path, module_base, ip2, &name, &offset);
ok = ok && name && ZstrCompare(name, "winproc") == 0 && offset == 0x10;
PdbCacheDeinit(&cache);- In
PdbCache.c:381:
u32 off = 0;
ok = PdbCacheResolve(&cache, pe_name, mbase, mbase + 0x1100, &name, &off);
ok = ok && name && ZstrCompare(name, "winproc") == 0 && off == 0;
PdbCacheDeinit(&cache);
}- In
PdbCache.c:502:
size after = DebugAllocatorLiveCount(&alloc);
ok = ra && rb && rb2 && name2 && ZstrCompare(name2, "winproc") == 0 && after == mid;
PdbCacheDeinit(&cache);- In
PdbCache.c:587:
// ip exactly at module_base -> RVA 0 -> resolves under real `<`.
ok = PdbCacheResolve(&cache, (Zstr)pe_path, mbase, mbase, &name, &off);
ok = ok && name && ZstrCompare(name, "winzero") == 0 && off == 0;
PdbCacheDeinit(&cache);
}- In
PdbCache.c:620:
u32 off = 0;
ok = PdbCacheResolve(&cache, (Zstr)pe_path, mbase, mbase + 0xFFFFFFFFull, &name, &off);
ok = ok && name && ZstrCompare(name, "winmax") == 0 && off == 0;
PdbCacheDeinit(&cache);
}- In
PdbCache.c:692:
u32 off = 0;
ok = PdbCacheResolve(&cache, (Zstr)pe_path, mbase, mbase + 0x1100, &name, &off);
ok = ok && name && ZstrCompare(name, "winproc") == 0 && off == 0;
PdbCacheDeinit(&cache);
}- In
PdbCache.c:768:
bool ra = PdbCacheResolve(&cache, (Zstr)a_pe, mbase, mbase + 0x1100, &na, &off);
bool rb = PdbCacheResolve(&cache, (Zstr)b_pe, mbase, mbase + 0x1100, &nb, &off);
ok = ra && rb && na && nb && ZstrCompare(na, "aproc") == 0 && ZstrCompare(nb, "bproc") == 0;
PdbCacheDeinit(&cache);
}- In
SysDns.c:81:
}
Str s = SocketAddrFormat(ad, a);
bool ok = (StrLen(&s) > 0) && ZstrCompare(StrBegin(&s), expect) == 0;
StrDeinit(&s);
return ok;- In
SysDns.c:91:
}
Str s = SocketAddrFormat(ad, a);
bool ok = (StrLen(&s) > 0) && ZstrCompare(StrBegin(&s), expect) == 0;
StrDeinit(&s);
return ok;- In
SysDns.c:118:
static const HostsEntry *find_host(HostsTable *t, Zstr name) {
VecForeachPtr(t, e) {
if (StrLen(&e->name) > 0 && ZstrCompare(StrBegin(&e->name), name) == 0) {
return e;
}- In
SysDns.c:135:
}
Str s = SocketAddrFormat(VecPtrAt(&r->nameservers, i), a);
bool ok = (StrLen(&s) > 0) && ZstrCompare(StrBegin(&s), expect) == 0;
StrDeinit(&s);
return ok;- In
SysDns.c:223:
if (ok) {
Str s = SocketAddrFormat(VecPtrAt(&out, 0), a);
ok = (StrLen(&s) > 0) && ZstrCompare(StrBegin(&s), "203.0.113.7:9999") == 0;
StrDeinit(&s);
}- In
SysDns.c:247:
if (ok) {
Str s = SocketAddrFormat(VecPtrAt(&out, 0), a);
ok = (StrLen(&s) > 0) && ZstrCompare(StrBegin(&s), "[::1]:443") == 0;
StrDeinit(&s);
}- In
SysDns.c:300:
if (ok) {
Str s = SocketAddrFormat(&one, a);
ok = (StrLen(&s) > 0) && ZstrCompare(StrBegin(&s), "127.0.0.1:80") == 0;
StrDeinit(&s);
}- In
SysDns.c:362:
const HostsEntry *e = find_host(&r.hosts, "localhost");
bool ok = VecLen(&r.hosts) == 1 && host_v4_is(e, 127, 0, 0, 1) && ZstrCompare(StrBegin(&e->name), "localhost") == 0;
drop_temp(&path);- In
SysDns.c:448:
const HostsEntry *e = find_host(&r.hosts, "namex");
bool ok = VecLen(&r.hosts) == 1 && host_v4_is(e, 10, 0, 0, 2) && ZstrCompare(StrBegin(&e->name), "namex") == 0;
drop_temp(&path);- In
SysDns.c:508:
const HostsEntry *e = find_host(&r.hosts, "@az[`m");
bool ok = VecLen(&r.hosts) == 1 && host_v4_is(e, 10, 1, 1, 2) && ZstrCompare(StrBegin(&e->name), "@az[`m") == 0;
drop_temp(&path);- In
Socket.c:103:
}
Str rendered = SocketAddrFormat(&addr, alloc_base);
ok = ok && StrLen(&rendered) > 0 && ZstrCompare(StrBegin(&rendered), "127.0.0.1:8080") == 0;
StrDeinit(&rendered);
}- In
Socket.c:114:
}
Str rendered = SocketAddrFormat(&addr, alloc_base);
ok = ok && StrLen(&rendered) > 0 && ZstrCompare(StrBegin(&rendered), "[::1]:8080") == 0;
StrDeinit(&rendered);
}- In
Socket.c:647:
if (ok) {
Str r = SocketAddrFormat(&addr, a);
ok = StrLen(&r) > 0 && ZstrCompare(StrBegin(&r), expect) == 0;
StrDeinit(&r);
}- In
Socket.c:786:
Str s = SocketAddrFormat(&addr, a);
ok = ok && StrLen(&s) > 0 && ZstrCompare(StrBegin(&s), "1.2.3.4:80") == 0;
StrDeinit(&s);- In
Socket.c:803:
Str s = SocketAddrFormat(&addr, a);
ok = ok && StrLen(&s) > 0 && ZstrCompare(StrBegin(&s), "10.0.0.1:4660") == 0;
StrDeinit(&s);- In
Socket.c:832:
Str s = SocketAddrFormat(&addr, a);
ok = ok && StrLen(&s) > 0 && ZstrCompare(StrBegin(&s), "[2001:db8::1]:443") == 0;
StrDeinit(&s);- In
Socket.c:849:
Str s = SocketAddrFormat(&addr, a);
ok = ok && StrLen(&s) > 0 && ZstrCompare(StrBegin(&s), "[::1]:8080") == 0;
StrDeinit(&s);- In
Socket.c:935:
Str s = SocketAddrFormat(&local, a);
ok = ok && StrLen(&s) > 0 && ZstrCompare(StrBegin(&s), "127.0.0.1:4660") == 0;
StrDeinit(&s);- In
Socket.c:974:
ok = ok && ZstrCompareN(rendered, "127.0.0.1:", 10u) == 0;
// a real ephemeral port is non-zero: last char is not ":0\0"
ok = ok && ZstrCompare(rendered, "127.0.0.1:0") != 0;
}
StrDeinit(&s);- In
Socket.c:1267:
// must start with the loopback host and a colon, then a non-"0" port.
ok = ok && local.family == SOCKET_FAMILY_INET;
ok = ok && ZstrCompare(StrBegin(&rendered), "127.0.0.1:0") != 0;
// host portion must be exactly the loopback address.
Zstr r = StrBegin(&rendered);- In
Socket.c:1484:
if (p) {
Str r = SocketAddrFormat(&addr, a);
ok = ok && ZstrCompare(StrBegin(&r), "127.0.0.1:65535") == 0;
StrDeinit(&r);
}- In
Socket.c:1496:
if (p) {
Str r = SocketAddrFormat(&addr, a);
ok = ok && ZstrCompare(StrBegin(&r), "127.0.0.1:0") == 0;
StrDeinit(&r);
}- In
Socket.c:1508:
if (p) {
Str r = SocketAddrFormat(&addr, a);
ok = ok && ZstrCompare(StrBegin(&r), "1.2.3.4:4660") == 0;
StrDeinit(&r);
}- In
Socket.c:1548:
if (p) {
Str r = SocketAddrFormat(&addr, a);
ok = ok && ZstrCompare(StrBegin(&r), "1.2.3.4:4660") == 0;
StrDeinit(&r);
}- In
Socket.c:1589:
if (p) {
Str r = SocketAddrFormat(&addr, a);
ok = ok && ZstrCompare(StrBegin(&r), "[::1]:4660") == 0;
StrDeinit(&r);
}- In
Socket.c:1616:
if (ok) {
Str r = SocketAddrFormat(&addr, a);
ok = StrLen(&r) > 0 && ZstrCompare(StrBegin(&r), expect) == 0;
StrDeinit(&r);
}- In
MachoCache.c:198:
u32 offset = 0;
bool ok = MachoCacheResolve(&cache, bin_path, slide, runtime_ip, &name, &offset);
ok = ok && name && ZstrCompare(name, "real_main_proc") == 0 && offset == 0x10;
MachoCacheDeinit(&cache);- In
MachoCache.c:235:
u32 offset = 0;
bool ok = MachoCacheResolve(&cache, bin_path, slide, runtime_ip, &name, &offset);
ok = ok && name && ZstrCompare(name, "dsym_only_fn") == 0 && offset == 0x8;
MachoCacheDeinit(&cache);- In
MachoCache.c:627:
const u64 runtime_ip = 0x100000100ull + 0x10 + slide;
bool resolved = MachoCacheResolve(&cache, bin_path, slide, runtime_ip, &name, &offset);
ok = ok && resolved && name && ZstrCompare(name, "real_main_proc") == 0 && offset == 0x10;
// Cache now holds allocations; live count must have grown.
- In
MachoCache.c:721:
u32 offset = 0;
bool resolved = MachoCacheResolve(&cache, bin_path, 0, 0x100000208ull, &name, &offset);
ok = ok && resolved && name && ZstrCompare(name, "dsym_only_fn") == 0 && offset == 0x8;
ok = ok && DebugAllocatorLiveCount(&dbg) > baseline;- In
MachoCache.c:805:
// file-relative VA low+0x20 -> 0x20 into the function.
bool resolved = MachoCacheResolve(&cache, bin_path, 0, low + 0x20, &name, &offset);
ok = ok && resolved && name && ZstrCompare(name, fn_name) == 0 && offset == 0x20;
ok = ok && DebugAllocatorLiveCount(&dbg) > baseline;- In
MachoCache.c:846:
const u64 eq = 0x9000;
ok = ok && MachoCacheResolve(&cache, bin_path, eq, eq, &name, &off);
ok = ok && name && ZstrCompare(name, "fn_at_zero") == 0 && off == 0;
MachoCacheDeinit(&cache);- In
MachoCache.c:874:
// Str overload -> macho_cache_resolve_str -> macho_cache_resolve_zstr.
ok = ok && MachoCacheResolve(&cache, &mod, 0, 0x100000110ull, &name, &off);
ok = ok && name && ZstrCompare(name, "str_fn") == 0 && off == 0x10;
// Negative delegation: an address far outside any symbol must come
u32 offset = 0;
bool resolved = MachoCacheResolve(&cache, bin_path, 0, low + 0x20, &name, &offset);
ok = ok && resolved && name && ZstrCompare(name, fn_name) == 0 && offset == 0x20;
MachoCacheDeinit(&cache); u32 off1 = 0;
ok = ok && MachoCacheResolve(&cache, bin_path, 0, low + 0x10, &name1, &off1);
ok = ok && name1 && ZstrCompare(name1, fn_name) == 0 && off1 == 0x10;
// Second resolve hits the cached entry: dsym already open, dwarf already
u32 off2 = 0;
ok = ok && MachoCacheResolve(&cache, bin_path, 0, low + 0x30, &name2, &off2);
ok = ok && name2 && ZstrCompare(name2, fn_name) == 0 && off2 == 0x30;
ok = ok && VecLen(&cache.entries) == 1; u32 offset = 0;
bool resolved = MachoCacheResolve(&cache, bin_path, 0, low + 0x14, &name, &offset);
ok = ok && resolved && name && ZstrCompare(name, fn_name) == 0 && offset == 0x14;
ok = ok && DebugAllocatorLiveCount(&dbg) > baseline; // Both module paths are the same backing file.
ok = ok && ra.module_path && rb.module_path;
ok = ok && ZstrCompare(ra.module_path, rb.module_path) == 0;
SymbolResolverDeinit(&res); const ProcMapEntry *m = VecPtrAt(&maps.entries, i);
if (m->path && m->path[0] == '/' && (m->perms & PROC_MAP_PERM_EXEC) &&
ZstrCompare(m->path, self_path) != 0) {
*out_addr = m->start;
got = true;
ok = ok && live2 == live1; // no re-open
ok = ok && ZstrCompare(ra.module_path, rb.module_path) == 0; // same module file
SymbolResolverDeinit(&res);
ok = ok && live2 == live1; // fallback hit, no re-open
ok = ok && ZstrCompare(rc.module_path, rd.module_path) == 0; // same module file
SymbolResolverDeinit(&res); size live2 = DebugAllocatorLiveCount(&alloc);
ok = ok && ZstrCompare(ro.module_path, ra.module_path) != 0; // distinct module
ok = ok && live2 > live1; // second module was opened
ok = ok && live2 == live1; // hit on entry[1], no re-open
ok = ok && ZstrCompare(r1.module_path, r2.module_path) == 0; // same module
SymbolResolverDeinit(&res); ResolvedSymbol ro;
ok = ok && SymbolResolverResolve(&res, (void *)other, &ro) && ro.module_path;
ok = ok && ZstrCompare(ra.module_path, ro.module_path) != 0; // two distinct cache entries
SymbolResolverDeinit(&res);- In
Bias.c:37:
for (u64 i = 0; i < VecLen(&maps.entries); ++i) {
const ProcMapEntry *m = VecPtrAt(&maps.entries, i);
if (m->path && ZstrCompare(m->path, path) == 0 && (m->perms & PROC_MAP_PERM_WRITE) && addr >= m->start &&
addr < m->end) {
*map_start = m->start;- In
Pe.c:495:
ok = pe.machine == PE_MACHINE_X86_64 && pe.is_pe32_plus && pe.image_base == 0x140000000ull;
ok = ok && VecLen(&pe.sections) == 1;
ok = ok && ZstrCompare(VecPtrAt(&pe.sections, 0)->name, ".debug") == 0;
ok = ok && VecPtrAt(&pe.sections, 0)->virtual_address == SECTION_VA;
ok = ok && pe.codeview.present;- In
Pe.c:500:
ok = ok && pe.codeview.age == 0x2a;
ok = ok && MemCompare(pe.codeview.guid, kGuid, 16) == 0;
ok = ok && pe.codeview.pdb_path && ZstrCompare(pe.codeview.pdb_path, kPdbPath) == 0;
PeDeinit(&pe);- In
Pe.c:867:
ok = ok && MemCompare(pe.codeview.guid, kGuid, 16) == 0;
ok = ok && pe.codeview.age == CV_AGE;
ok = ok && pe.codeview.pdb_path && ZstrCompare(pe.codeview.pdb_path, kPdbPath) == 0;
PeDeinit(&pe);
DefaultAllocatorDeinit(&alloc);- In
Pe.c:960:
return false;
}
bool ok = pe.codeview.present == true && ZstrCompare(pe.codeview.pdb_path, "ABCD") == 0;
PeDeinit(&pe);
DefaultAllocatorDeinit(&alloc);- In
Pe.c:985:
return false;
}
bool ok = pe.codeview.present == true && pe.codeview.age == CV_AGE && ZstrCompare(pe.codeview.pdb_path, "") == 0;
PeDeinit(&pe);
DefaultAllocatorDeinit(&alloc);- In
Pe.c:1280:
bool ok = VecLen(&pe.sections) == 2;
ok = ok && ZstrCompare(VecPtrAt(&pe.sections, 0)->name, ".text") == 0;
ok = ok && ZstrCompare(VecPtrAt(&pe.sections, 1)->name, ".rdata") == 0;
ok = ok && VecPtrAt(&pe.sections, 0)->virtual_address == 0x1000;- In
Pe.c:1281:
bool ok = VecLen(&pe.sections) == 2;
ok = ok && ZstrCompare(VecPtrAt(&pe.sections, 0)->name, ".text") == 0;
ok = ok && ZstrCompare(VecPtrAt(&pe.sections, 1)->name, ".rdata") == 0;
ok = ok && VecPtrAt(&pe.sections, 0)->virtual_address == 0x1000;
ok = ok && VecPtrAt(&pe.sections, 1)->virtual_address == 0x2000;- In
Pe.c:1343:
bool ok = VecLen(&pe.sections) == 1;
ok = ok && ZstrLen(s->name) == 8;
ok = ok && ZstrCompare(s->name, "ABCDEFGH") == 0;
PeDeinit(&pe);
DefaultAllocatorDeinit(&alloc);- In
Pe.c:1669:
if (ok) {
ok = pe.machine == PE_MACHINE_X86_64 && VecLen(&pe.sections) == 1 &&
ZstrCompare(VecPtrAt(&pe.sections, 0)->name, ".text") == 0;
PeDeinit(&pe);
}- In
Dns.c:163:
DnsRecord *r0 = VecPtrAt(&resp.answers, 0);
match = r0->type == DNS_TYPE_A && r0->ttl == 300 && r0->ipv4[0] == 93 && r0->ipv4[1] == 184 &&
r0->ipv4[2] == 216 && r0->ipv4[3] == 34 && ZstrCompare(StrBegin(&r0->name), "example.com") == 0;
}
if (match) {- In
Dns.c:296:
if (match) {
DnsRecord *r = VecPtrAt(&resp.answers, 0);
match = r->type == DNS_TYPE_CNAME && ZstrCompare(StrBegin(&r->target), "example.com") == 0;
}- In
Dns.c:568:
DnsRecord *r = VecPtrAt(&resp.answers, 0);
match = r->type == DNS_TYPE_A && r->ttl == 300 && r->ipv4[0] == 0x0a && r->ipv4[1] == 0x0b &&
r->ipv4[2] == 0x0c && r->ipv4[3] == 0x0d && ZstrCompare(StrBegin(&r->name), "www.example.com") == 0;
}- In
Dns.c:742:
if (match) {
DnsRecord *r = VecPtrAt(&resp.answers, 0);
match = r->type == DNS_TYPE_A && ZstrCompare(StrBegin(&r->name), "zz") == 0;
}- In
Dns.c:810:
DnsRecord *r = VecPtrAt(&resp.answers, 0);
match =
r->type == DNS_TYPE_A && r->ttl == 2 && ZstrCompare(StrBegin(&r->name), "abc.de") == 0 && r->ipv4[0] == 9;
}- In
Dns.c:1085:
match = r->type == DNS_TYPE_A && r->rclass == 1 && r->ttl == 0x01020304u && r->ipv4[0] == 8 &&
r->ipv4[1] == 8 && r->ipv4[2] == 4 && r->ipv4[3] == 4 && r->ipv6[0] == 0 &&
ZstrCompare(StrBegin(&r->name), "a") == 0;
// rdata raw stash must equal the 4 IP bytes.
match = match && BufLength(&r->rdata) == 4 && BufData(&r->rdata)[0] == 8 && BufData(&r->rdata)[1] == 8 &&- In
Dns.c:1308:
DnsRecord *r0 = VecPtrAt(&resp.answers, 0);
DnsRecord *r1 = VecPtrAt(&resp.answers, 1);
match = ZstrCompare(StrBegin(&r0->name), "x") == 0 && r0->ttl == 1 && r0->ipv4[0] == 1 && r0->ipv4[3] == 4 &&
ZstrCompare(StrBegin(&r1->name), "y") == 0 && r1->ttl == 2 && r1->ipv4[0] == 5 && r1->ipv4[3] == 8;
}- In
Dns.c:1309:
DnsRecord *r1 = VecPtrAt(&resp.answers, 1);
match = ZstrCompare(StrBegin(&r0->name), "x") == 0 && r0->ttl == 1 && r0->ipv4[0] == 1 && r0->ipv4[3] == 4 &&
ZstrCompare(StrBegin(&r1->name), "y") == 0 && r1->ttl == 2 && r1->ipv4[0] == 5 && r1->ipv4[3] == 8;
}- In
Dns.c:1405:
DnsRecord *ns = VecPtrAt(&resp.authority, 0);
DnsRecord *ar = VecPtrAt(&resp.additional, 0);
match = ZstrCompare(StrBegin(&an->name), "an") == 0 && an->ipv4[0] == 11 &&
ZstrCompare(StrBegin(&ns->name), "ns") == 0 && ns->ipv4[0] == 22 &&
ZstrCompare(StrBegin(&ar->name), "ad") == 0 && ar->ipv4[0] == 33;- In
Dns.c:1406:
DnsRecord *ar = VecPtrAt(&resp.additional, 0);
match = ZstrCompare(StrBegin(&an->name), "an") == 0 && an->ipv4[0] == 11 &&
ZstrCompare(StrBegin(&ns->name), "ns") == 0 && ns->ipv4[0] == 22 &&
ZstrCompare(StrBegin(&ar->name), "ad") == 0 && ar->ipv4[0] == 33;
}- In
Dns.c:1407:
match = ZstrCompare(StrBegin(&an->name), "an") == 0 && an->ipv4[0] == 11 &&
ZstrCompare(StrBegin(&ns->name), "ns") == 0 && ns->ipv4[0] == 22 &&
ZstrCompare(StrBegin(&ar->name), "ad") == 0 && ar->ipv4[0] == 33;
}- In
Dns.c:1470:
if (match) {
DnsRecord *r = VecPtrAt(&resp.answers, 0);
match = ZstrCompare(StrBegin(&r->name), "q") == 0 && r->ipv4[0] == 9 && r->ttl == 5;
}- In
Dns.c:1522:
if (match) {
DnsRecord *r = VecPtrAt(&resp.answers, 0);
match = r->type == DNS_TYPE_CNAME && ZstrCompare(StrBegin(&r->target), "to") == 0;
}- In
Dns.c:2049:
if (match) {
DnsRecord *r = VecPtrAt(&resp.answers, 0);
match = r->type == DNS_TYPE_A && r->ttl == 7 && ZstrCompare(StrBegin(&r->name), "zz") == 0;
}- In
Pdb.c:299:
if (ok) {
const PdbFunction *f = VecPtrAt(&pdb.functions, 0);
ok = ok && f->rva == 0x1100 && f->name && ZstrCompare(f->name, "my_function") == 0;
}- In
Pdb.c:305:
if (ok) {
const PdbFunction *f = PdbResolveRva(&pdb, 0x1100);
ok = f && ZstrCompare(f->name, "my_function") == 0;
}- In
Pdb.c:449:
const PdbFunction *f1 = VecPtrAt(&pdb.functions, 1);
const PdbFunction *f2 = VecPtrAt(&pdb.functions, 2);
ok = ok && f0->rva == 0x1100 && ZstrCompare(f0->name, "fn_alpha") == 0;
ok = ok && f1->rva == 0x1200 && ZstrCompare(f1->name, "fn_beta") == 0;
ok = ok && f2->rva == 0x1300 && ZstrCompare(f2->name, "fn_gamma") == 0;- In
Pdb.c:450:
const PdbFunction *f2 = VecPtrAt(&pdb.functions, 2);
ok = ok && f0->rva == 0x1100 && ZstrCompare(f0->name, "fn_alpha") == 0;
ok = ok && f1->rva == 0x1200 && ZstrCompare(f1->name, "fn_beta") == 0;
ok = ok && f2->rva == 0x1300 && ZstrCompare(f2->name, "fn_gamma") == 0;
}- In
Pdb.c:451:
ok = ok && f0->rva == 0x1100 && ZstrCompare(f0->name, "fn_alpha") == 0;
ok = ok && f1->rva == 0x1200 && ZstrCompare(f1->name, "fn_beta") == 0;
ok = ok && f2->rva == 0x1300 && ZstrCompare(f2->name, "fn_gamma") == 0;
}- In
Pdb.c:459:
const PdbFunction *b = PdbResolveRva(&pdb, 0x1200);
const PdbFunction *c = PdbResolveRva(&pdb, 0x1300);
ok = ok && a && ZstrCompare(a->name, "fn_alpha") == 0;
ok = ok && b && ZstrCompare(b->name, "fn_beta") == 0;
ok = ok && c && ZstrCompare(c->name, "fn_gamma") == 0;- In
Pdb.c:460:
const PdbFunction *c = PdbResolveRva(&pdb, 0x1300);
ok = ok && a && ZstrCompare(a->name, "fn_alpha") == 0;
ok = ok && b && ZstrCompare(b->name, "fn_beta") == 0;
ok = ok && c && ZstrCompare(c->name, "fn_gamma") == 0;
}- In
Pdb.c:461:
ok = ok && a && ZstrCompare(a->name, "fn_alpha") == 0;
ok = ok && b && ZstrCompare(b->name, "fn_beta") == 0;
ok = ok && c && ZstrCompare(c->name, "fn_gamma") == 0;
}- In
Pdb.c:470:
const PdbFunction *mid_a = PdbResolveRva(&pdb, 0x11FF); // inside alpha
const PdbFunction *mid_b = PdbResolveRva(&pdb, 0x12AB); // inside beta
ok = ok && mid_a && ZstrCompare(mid_a->name, "fn_alpha") == 0;
ok = ok && mid_b && ZstrCompare(mid_b->name, "fn_beta") == 0;
}- In
Pdb.c:471:
const PdbFunction *mid_b = PdbResolveRva(&pdb, 0x12AB); // inside beta
ok = ok && mid_a && ZstrCompare(mid_a->name, "fn_alpha") == 0;
ok = ok && mid_b && ZstrCompare(mid_b->name, "fn_beta") == 0;
}- In
Pdb.c:1688:
const PdbFunction *f2 = VecPtrAt(&pdb.functions, 2);
const PdbFunction *f3 = VecPtrAt(&pdb.functions, 3);
ok = ok && f0->rva == 0x1100 && ZstrCompare(f0->name, "fn_one") == 0;
ok = ok && f1->rva == 0x1200 && ZstrCompare(f1->name, "fn_two") == 0;
ok = ok && f2->rva == 0x1300 && ZstrCompare(f2->name, "fn_three") == 0;- In
Pdb.c:1689:
const PdbFunction *f3 = VecPtrAt(&pdb.functions, 3);
ok = ok && f0->rva == 0x1100 && ZstrCompare(f0->name, "fn_one") == 0;
ok = ok && f1->rva == 0x1200 && ZstrCompare(f1->name, "fn_two") == 0;
ok = ok && f2->rva == 0x1300 && ZstrCompare(f2->name, "fn_three") == 0;
ok = ok && f3->rva == 0x5100 && ZstrCompare(f3->name, "fn_four") == 0;- In
Pdb.c:1690:
ok = ok && f0->rva == 0x1100 && ZstrCompare(f0->name, "fn_one") == 0;
ok = ok && f1->rva == 0x1200 && ZstrCompare(f1->name, "fn_two") == 0;
ok = ok && f2->rva == 0x1300 && ZstrCompare(f2->name, "fn_three") == 0;
ok = ok && f3->rva == 0x5100 && ZstrCompare(f3->name, "fn_four") == 0;
}- In
Pdb.c:1691:
ok = ok && f1->rva == 0x1200 && ZstrCompare(f1->name, "fn_two") == 0;
ok = ok && f2->rva == 0x1300 && ZstrCompare(f2->name, "fn_three") == 0;
ok = ok && f3->rva == 0x5100 && ZstrCompare(f3->name, "fn_four") == 0;
}- In
Pdb.c:1698:
for (size i = 0; i < VecLen(&pdb.functions); ++i) {
const PdbFunction *f = VecPtrAt(&pdb.functions, i);
if (ZstrCompare(f->name, "data_sym") == 0) {
ok = false;
break;- In
Pdb.c:1747:
const PdbFunction *f0 = VecPtrAt(&pdb.functions, 0);
const PdbFunction *f1 = VecPtrAt(&pdb.functions, 1);
ok = ok && f0->rva == 0x1040 && ZstrCompare(f0->name, "in_text") == 0;
ok = ok && f1->rva == 0x8010 && ZstrCompare(f1->name, "in_rdata") == 0;
}- In
Pdb.c:1748:
const PdbFunction *f1 = VecPtrAt(&pdb.functions, 1);
ok = ok && f0->rva == 0x1040 && ZstrCompare(f0->name, "in_text") == 0;
ok = ok && f1->rva == 0x8010 && ZstrCompare(f1->name, "in_rdata") == 0;
}- In
Pdb.c:1755:
if (ok) {
const PdbFunction *r = PdbResolveRva(&pdb, 0x8010);
ok = r && ZstrCompare(r->name, "in_rdata") == 0;
}
if (ok) {- In
Pdb.c:1759:
if (ok) {
const PdbFunction *t = PdbResolveRva(&pdb, 0x1040);
ok = t && ZstrCompare(t->name, "in_text") == 0;
}- In
Pdb.c:1804:
const PdbFunction *f0 = VecPtrAt(&pdb.functions, 0);
const PdbFunction *f1 = VecPtrAt(&pdb.functions, 1);
ok = ok && f0->rva == 0x1100 && ZstrCompare(f0->name, "valid_fn") == 0;
ok = ok && f1->rva == 0x1200 && ZstrCompare(f1->name, "valid_fn2") == 0;
}- In
Pdb.c:1805:
const PdbFunction *f1 = VecPtrAt(&pdb.functions, 1);
ok = ok && f0->rva == 0x1100 && ZstrCompare(f0->name, "valid_fn") == 0;
ok = ok && f1->rva == 0x1200 && ZstrCompare(f1->name, "valid_fn2") == 0;
}
if (ok) {- In
Pdb.c:1810:
for (size i = 0; i < VecLen(&pdb.functions); ++i) {
const PdbFunction *f = VecPtrAt(&pdb.functions, i);
if (ZstrCompare(f->name, "bad_seg_fn") == 0) {
ok = false;
break;- In
Pdb.c:1870:
if (ok) {
const PdbFunction *mid = PdbResolveRva(&pdb, 0x12FF);
ok = mid && ZstrCompare(mid->name, "fn_a") == 0;
}
if (ok) {- In
Pdb.c:1874:
if (ok) {
const PdbFunction *atb = PdbResolveRva(&pdb, 0x1300);
ok = atb && ZstrCompare(atb->name, "fn_b") == 0;
}
// Trailing function: any rva >= its start resolves to it.
- In
Pdb.c:1879:
if (ok) {
const PdbFunction *tail = PdbResolveRva(&pdb, 0x9999);
ok = tail && ZstrCompare(tail->name, "fn_c") == 0;
}- In
Pdb.c:1941:
const PdbFunction *first = VecPtrAt(&pdb.functions, 0);
const PdbFunction *last = VecPtrAt(&pdb.functions, 4);
ok = ok && first->rva == 0x1100 && ZstrCompare(first->name, "a") == 0;
ok = ok && last->rva == 0x1500 && ZstrCompare(last->name, "e") == 0;
}- In
Pdb.c:1942:
const PdbFunction *last = VecPtrAt(&pdb.functions, 4);
ok = ok && first->rva == 0x1100 && ZstrCompare(first->name, "a") == 0;
ok = ok && last->rva == 0x1500 && ZstrCompare(last->name, "e") == 0;
}- In
Pdb.c:1989:
const PdbFunction *f0 = VecPtrAt(&pdb.functions, 0);
const PdbFunction *f1 = VecPtrAt(&pdb.functions, 1);
ok = ok && f0->rva == 0x1100 && ZstrCompare(f0->name, "fn_keep") == 0;
ok = ok && f1->rva == 0x1300 && ZstrCompare(f1->name, "fn_keep2") == 0;
}- In
Pdb.c:1990:
const PdbFunction *f1 = VecPtrAt(&pdb.functions, 1);
ok = ok && f0->rva == 0x1100 && ZstrCompare(f0->name, "fn_keep") == 0;
ok = ok && f1->rva == 0x1300 && ZstrCompare(f1->name, "fn_keep2") == 0;
}
// No all-'A' garbage name leaked in from the unterminated record.
- In
Pdb.c:1996:
for (size i = 0; i < VecLen(&pdb.functions); ++i) {
const PdbFunction *f = VecPtrAt(&pdb.functions, i);
if (ZstrCompare(f->name, "AAAAAAAA") == 0) {
ok = false;
break;- In
Pdb.c:2046:
const PdbFunction *f0 = VecPtrAt(&pdb.functions, 0);
const PdbFunction *f1 = VecPtrAt(&pdb.functions, 1);
ok = ok && f0->rva == 0x2050u && ZstrCompare(f0->name, "fn_low") == 0;
ok = ok && f1->rva == 0xFFFFFFFFu && ZstrCompare(f1->name, "fn_max") == 0;
}- In
Pdb.c:2047:
const PdbFunction *f1 = VecPtrAt(&pdb.functions, 1);
ok = ok && f0->rva == 0x2050u && ZstrCompare(f0->name, "fn_low") == 0;
ok = ok && f1->rva == 0xFFFFFFFFu && ZstrCompare(f1->name, "fn_max") == 0;
}
if (ok) {- In
Pdb.c:2052:
for (size i = 0; i < VecLen(&pdb.functions); ++i) {
const PdbFunction *f = VecPtrAt(&pdb.functions, i);
if (ZstrCompare(f->name, "fn_ovf") == 0) {
ok = false;
break;- In
Pdb.c:2062:
if (ok) {
const PdbFunction *r = PdbResolveRva(&pdb, 0x2050);
ok = r && ZstrCompare(r->name, "fn_low") == 0;
}- In
Pdb.c:2240:
const PdbFunction *f0 = VecPtrAt(&pdb.functions, 0); // rva 0x2000
const PdbFunction *f1 = VecPtrAt(&pdb.functions, 1); // rva 0x3000
ok = ok && f0->rva == 0x2000 && ZstrCompare(f0->name, "second_block_function") == 0;
ok = ok && f1->rva == 0x3000 && ZstrCompare(f1->name, "straddling_boundary_function") == 0;
}- In
Pdb.c:2241:
const PdbFunction *f1 = VecPtrAt(&pdb.functions, 1); // rva 0x3000
ok = ok && f0->rva == 0x2000 && ZstrCompare(f0->name, "second_block_function") == 0;
ok = ok && f1->rva == 0x3000 && ZstrCompare(f1->name, "straddling_boundary_function") == 0;
}- In
Pdb.c:2248:
if (ok) {
const PdbFunction *f = PdbResolveRva(&pdb, 0x3000);
ok = f && ZstrCompare(f->name, "straddling_boundary_function") == 0;
}- In
Pdb.c:2520:
const PdbFunction *first = PdbResolveRva(&pdb, 0x2000);
ok = first && ZstrCompare(first->name, "second_block_function") == 0;
ok = ok && PdbResolveRva(&pdb, 0x1FFF) == NULL; // below first
// Interior of the second-block function resolves to it (greatest
- In
Pdb.c:2526:
if (ok) {
const PdbFunction *mid = PdbResolveRva(&pdb, 0x2500);
ok = mid && ZstrCompare(mid->name, "second_block_function") == 0;
}- In
Pdb.c:2692:
if (ok) {
const PdbFunction *f = VecPtrAt(&pdb.functions, 0);
ok = f->rva == 0x6010 && ZstrCompare(f->name, "sixth") == 0;
}
PdbDeinit(&pdb);- In
Pdb.c:2757:
if (ok) {
const PdbFunction *f = VecPtrAt(&pdb.functions, 0);
ok = f->rva == 0x1040 && ZstrCompare(f->name, "good") == 0;
}
PdbDeinit(&pdb);- In
Pdb.c:2820:
if (ok) {
const PdbFunction *f = VecPtrAt(&pdb.functions, 0);
ok = f->rva == 0x1010 && ZstrCompare(f->name, "named_fn") == 0;
}
PdbDeinit(&pdb);- In
Pdb.c:3040:
if (ok) {
const PdbFunction *f = VecPtrAt(&pdb.functions, 0);
ok = f->rva == 0x1100 && ZstrCompare(f->name, "deepblk") == 0;
}
PdbDeinit(&pdb);- In
Pdb.c:3080:
if (ok) {
const PdbFunction *f = VecPtrAt(&pdb.functions, 0);
ok = f->rva == 0x1100 && ZstrCompare(f->name, "deepfn") == 0;
}
if (opened)- In
Pdb.c:3121:
if (ok) {
const PdbFunction *f = VecPtrAt(&pdb.functions, 0);
ok = f->rva == 0x1100 && ZstrCompare(f->name, "fn") == 0;
}
if (opened)- In
ProcMaps.c:440:
ok = e->start == 0x1000ULL && e->end == 0x2000ULL && e->file_offset == 0xdeadULL &&
e->perms == (u32)(PROC_MAP_PERM_READ | PROC_MAP_PERM_EXEC | PROC_MAP_PERM_PRIVATE) &&
ZstrCompare(e->path, "/x/y") == 0;
}- In
ProcMaps.c:553:
if (ok) {
const ProcMapEntry *e = VecPtrAt(&m.entries, 0);
ok = e->start == 0x3000ULL && e->end == 0x4000ULL && ZstrCompare(e->path, "/good") == 0;
}- In
ProcMaps.c:616:
const ProcMapEntry *e = ProcMapsFindByAddr(&m, 0xdeadbeef050ULL);
ok = e != NULL && e->start == 0xdeadbeef000ULL && e->end == 0xdeadbeef100ULL &&
ZstrCompare(e->path, "/late") == 0;
ProcMapsDeinit(&m);
}- In
Http.c:28:
bool ok = (next != raw) && (req.method == HTTP_REQUEST_METHOD_GET) && (StrLen(&req.url) == 11) &&
(ZstrCompare(StrBegin(&req.url), "/index.html") == 0) && (VecLen(&req.headers) == 2) &&
(ZstrCompare(next, "body-bytes") == 0);- In
Http.c:29:
bool ok = (next != raw) && (req.method == HTTP_REQUEST_METHOD_GET) && (StrLen(&req.url) == 11) &&
(ZstrCompare(StrBegin(&req.url), "/index.html") == 0) && (VecLen(&req.headers) == 2) &&
(ZstrCompare(next, "body-bytes") == 0);
HttpHeader *host = HttpHeadersFind(&req.headers, "Host");- In
Http.c:32:
HttpHeader *host = HttpHeadersFind(&req.headers, "Host");
ok = ok && host && ZstrCompare(StrBegin(&host->value), "example.com") == 0;
HttpRequestDeinit(&req);- In
Http.c:227:
ok = ok && (res != NULL) && (response.status_code == HTTP_RESPONSE_CODE_OK) &&
(response.content_type == HTTP_CONTENT_TYPE_TEXT_PLAIN) && (StrLen(&response.body) == ZstrLen(payload)) &&
(ZstrCompare(StrBegin(&response.body), payload) == 0);
FileRemove(StrBegin(&path));- In
MachO.c:361:
ok = ok && m.has_uuid && MemCompare(m.uuid, kUuid, 16) == 0;
ok = ok && VecLen(&m.segments) == 1;
ok = ok && ZstrCompare(VecPtrAt(&m.segments, 0)->name, "__TEXT") == 0;
ok = ok && VecLen(&m.sections) == 1;
ok = ok && ZstrCompare(VecPtrAt(&m.sections, 0)->section, "__text") == 0;- In
MachO.c:363:
ok = ok && ZstrCompare(VecPtrAt(&m.segments, 0)->name, "__TEXT") == 0;
ok = ok && VecLen(&m.sections) == 1;
ok = ok && ZstrCompare(VecPtrAt(&m.sections, 0)->section, "__text") == 0;
ok = ok && ZstrCompare(VecPtrAt(&m.sections, 0)->segment, "__TEXT") == 0;
ok = ok && VecLen(&m.symbols) == 1;- In
MachO.c:364:
ok = ok && VecLen(&m.sections) == 1;
ok = ok && ZstrCompare(VecPtrAt(&m.sections, 0)->section, "__text") == 0;
ok = ok && ZstrCompare(VecPtrAt(&m.sections, 0)->segment, "__TEXT") == 0;
ok = ok && VecLen(&m.symbols) == 1;
ok = ok && VecPtrAt(&m.symbols, 0)->name && ZstrCompare(VecPtrAt(&m.symbols, 0)->name, "my_function") == 0;- In
MachO.c:366:
ok = ok && ZstrCompare(VecPtrAt(&m.sections, 0)->segment, "__TEXT") == 0;
ok = ok && VecLen(&m.symbols) == 1;
ok = ok && VecPtrAt(&m.symbols, 0)->name && ZstrCompare(VecPtrAt(&m.symbols, 0)->name, "my_function") == 0;
ok = ok && VecPtrAt(&m.symbols, 0)->value == 0x100000010ull;- In
MachO.c:388:
// Address at the function start.
const MachoSymbol *s = MachoResolveAddress(&m, 0x100000010ull);
bool ok = s && s->name && ZstrCompare(s->name, "my_function") == 0;
// Address just past the start, still inside the function body.
- In
MachO.c:392:
// Address just past the start, still inside the function body.
s = MachoResolveAddress(&m, 0x100000020ull);
ok = ok && s && ZstrCompare(s->name, "my_function") == 0;
// Address below the symbol value: no match.
- In
MachO.c:658:
ok = ok && VecLen(&m.symbols) == 1;
if (VecLen(&m.symbols) == 1)
ok = ok && ZstrCompare(VecPtrAt(&m.symbols, 0)->name, "fn_a") == 0;
if (ok)
MachoDeinit(&m);- In
MachO.c:717:
const MachoSymbol *s0 = VecPtrAt(&m.symbols, 0);
const MachoSymbol *s1 = VecPtrAt(&m.symbols, 1);
ok = ok && ZstrCompare(s0->name, "alpha") == 0 && s0->value == 0x100000010ull && s0->type == 0x0F &&
s0->section_index == 1;
ok = ok && ZstrCompare(s1->name, "beta") == 0 && s1->value == 0x100000040ull && s1->type == 0x24 &&- In
MachO.c:719:
ok = ok && ZstrCompare(s0->name, "alpha") == 0 && s0->value == 0x100000010ull && s0->type == 0x0F &&
s0->section_index == 1;
ok = ok && ZstrCompare(s1->name, "beta") == 0 && s1->value == 0x100000040ull && s1->type == 0x24 &&
s1->section_index == 2;
}- In
MachO.c:775:
Macho m;
bool ok = open_blob(&m, b, BUF, &alloc); // real: accepts
ok = ok && VecLen(&m.symbols) == 1 && ZstrCompare(VecPtrAt(&m.symbols, 0)->name, "fit") == 0;
if (ok)
MachoDeinit(&m);- In
MachO.c:802:
Macho m;
bool ok = open_blob(&m, b, BUF, &alloc);
ok = ok && VecLen(&m.symbols) == 1 && ZstrCompare(VecPtrAt(&m.symbols, 0)->name, "edge") == 0;
if (ok)
MachoDeinit(&m);- In
MachO.c:1165:
bool ok = MachoOpenFromMemoryCopy(&m, buf, sizeof(buf), base);
ok = ok && VecLen(&m.segments) == 1 && VecLen(&m.sections) == 0;
ok = ok && ZstrCompare(VecPtrAt(&m.segments, 0)->name, "__TEXT") == 0;
ok = ok && VecPtrAt(&m.segments, 0)->vmaddr == 0x1000;
if (ok)- In
MachO.c:1197:
bool ok = MachoOpenFromMemoryCopy(&m, buf, sizeof(buf), base);
ok = ok && VecLen(&m.segments) == 1;
ok = ok && ZstrCompare(VecPtrAt(&m.segments, 0)->name, "ABCDEFGHIJKLMNOP") == 0;
if (ok)
MachoDeinit(&m);- In
MachO.c:1259:
bool ok = MachoOpenFromMemoryCopy(&m, buf, sizeof(buf), base);
ok = ok && VecLen(&m.sections) == 1;
ok = ok && ZstrCompare(VecPtrAt(&m.sections, 0)->section, "abcdefghijklmnop") == 0;
ok = ok && ZstrCompare(VecPtrAt(&m.sections, 0)->segment, "QRSTUVWXYZ012345") == 0;
if (ok)- In
MachO.c:1260:
ok = ok && VecLen(&m.sections) == 1;
ok = ok && ZstrCompare(VecPtrAt(&m.sections, 0)->section, "abcdefghijklmnop") == 0;
ok = ok && ZstrCompare(VecPtrAt(&m.sections, 0)->segment, "QRSTUVWXYZ012345") == 0;
if (ok)
MachoDeinit(&m);- In
Elf.c:372:
for (u64 i = 0; i < VecLen(&elf.symbols); ++i) {
const ElfSymbol *s = VecPtrAt(&elf.symbols, i);
if (s->name && ZstrCompare(s->name, "my_func") == 0) {
found_func = s->value == FUNC_VADDR && s->size == FUNC_SIZE && s->type == ELF_SYMBOL_TYPE_FUNC &&
s->bind == ELF_SYMBOL_BIND_GLOBAL && s->section_index == SEC_TEXT;- In
Elf.c:427:
// Exactly at the symbol start.
const ElfSymbol *s = ElfResolveAddress(&elf, FUNC_VADDR);
bool ok = s && s->name && ZstrCompare(s->name, "my_func") == 0;
// Inside the body.
- In
Elf.c:431:
// Inside the body.
s = ElfResolveAddress(&elf, FUNC_VADDR + FUNC_SIZE / 2);
ok = ok && s && ZstrCompare(s->name, "my_func") == 0;
// Last covered byte.
- In
Elf.c:435:
// Last covered byte.
s = ElfResolveAddress(&elf, FUNC_VADDR + FUNC_SIZE - 1);
ok = ok && s && ZstrCompare(s->name, "my_func") == 0;
// Just past the end -> no match.
- In
Elf.c:719:
MemCompare(elf.build_id, kBuildId, BUILD_ID_LEN) == 0;
ok = ok && elf.debuglink_name != NULL && ZstrCompare(elf.debuglink_name, "foo.debug") == 0 &&
elf.debuglink_crc == DEBUGLINK_CRC;- In
Elf.c:758:
const ElfSection *last = VecPtrAt(&elf.sections, N_SECTIONS - 1);
ok = ok && first->name && first->name[0] == '\0' && first->type == ELF_SECTION_TYPE_NULL;
ok = ok && last->name && ZstrCompare(last->name, ".strtab") == 0 && last->type == ELF_SECTION_TYPE_STRTAB &&
last->offset == STRTAB_OFF && last->size == STRTAB_SZ;- In
Elf.c:1113:
const ElfSection *s1 = VecPtrAt(&elf.sections, 1);
bool ok = VecLen(&elf.sections) == 2 && s1->name != NULL && ZstrCompare(s1->name, "XYZ") == 0;
ElfDeinit(&elf);- In
Elf.c:1137:
const ElfSection *sym = ElfFindSection(&elf, ".symtab");
bool ok =
s != NULL && ZstrCompare(s->name, ".strtab") == 0 && sym != NULL && ZstrCompare(sym->name, ".symtab") == 0;
ElfDeinit(&elf);- In
Elf.c:1707:
const ElfSymbol *b = VecPtrAt(&elf.symbols, 3);
const ElfSymbol *l = VecPtrAt(&elf.symbols, 4);
bool ok = a->name && ZstrCompare(a->name, "alpha") == 0 && b->name && ZstrCompare(b->name, "beta") == 0 &&
l->name && ZstrCompare(l->name, "local") == 0;
ElfDeinit(&elf);- In
Elf.c:1708:
const ElfSymbol *l = VecPtrAt(&elf.symbols, 4);
bool ok = a->name && ZstrCompare(a->name, "alpha") == 0 && b->name && ZstrCompare(b->name, "beta") == 0 &&
l->name && ZstrCompare(l->name, "local") == 0;
ElfDeinit(&elf);
DefaultAllocatorDeinit(&alloc);- In
Elf.c:1743:
if (ok) {
const ElfSymbol *d = VecPtrAt(&elf.dynamic_symbols, 1);
ok = d->name && ZstrCompare(d->name, "dyn_sym") == 0 && d->value == SF_DYN_VADDR;
}
ElfDeinit(&elf);- In
Elf.c:1782:
s = ElfResolveAddress(&elf, SF_ALPHA_VADDR); // exact start
ok = ok && s && s->name && ZstrCompare(s->name, "alpha") == 0;
s = ElfResolveAddress(&elf, SF_ALPHA_VADDR + SF_ALPHA_SIZE - 1); // last byte
ok = ok && s && s->name && ZstrCompare(s->name, "alpha") == 0;- In
Elf.c:1784:
ok = ok && s && s->name && ZstrCompare(s->name, "alpha") == 0;
s = ElfResolveAddress(&elf, SF_ALPHA_VADDR + SF_ALPHA_SIZE - 1); // last byte
ok = ok && s && s->name && ZstrCompare(s->name, "alpha") == 0;
s = ElfResolveAddress(&elf, SF_ALPHA_VADDR + SF_ALPHA_SIZE); // just past
ok = ok && (s == NULL || ZstrCompare(s->name, "alpha") != 0);- In
Elf.c:1786:
ok = ok && s && s->name && ZstrCompare(s->name, "alpha") == 0;
s = ElfResolveAddress(&elf, SF_ALPHA_VADDR + SF_ALPHA_SIZE); // just past
ok = ok && (s == NULL || ZstrCompare(s->name, "alpha") != 0);
ElfDeinit(&elf);- In
Elf.c:1804:
const ElfSymbol *hit = ElfResolveAddress(&elf, SF_BETA_VADDR);
const ElfSymbol *miss = ElfResolveAddress(&elf, SF_BETA_VADDR + 1);
bool ok = hit && hit->name && ZstrCompare(hit->name, "beta") == 0 && miss == NULL;
ElfDeinit(&elf);
DefaultAllocatorDeinit(&alloc);- In
Elf.c:1822:
}
const ElfSymbol *s = ElfResolveAddress(&elf, SF_BETA_VADDR);
bool ok = s && s->name && ZstrCompare(s->name, "beta") == 0 && s->bind == ELF_SYMBOL_BIND_GLOBAL;
ElfDeinit(&elf);
DefaultAllocatorDeinit(&alloc);- In
Elf.c:1843:
// NOT displace it because local is not GLOBAL.
const ElfSymbol *s = ElfResolveAddress(&elf, SF_ALPHA_VADDR + 4);
bool ok = s && s->name && ZstrCompare(s->name, "alpha") == 0 && s->bind == ELF_SYMBOL_BIND_GLOBAL;
ElfDeinit(&elf);
DefaultAllocatorDeinit(&alloc);- In
Elf.c:2076:
return false;
}
bool ok = elf.debuglink_name != NULL && ZstrCompare(elf.debuglink_name, "abc.debug") == 0 &&
elf.debuglink_crc == 0x0a0b0c0du;
ElfDeinit(&elf);- In
Elf.c:2287:
bool ok = elf.build_id != NULL && elf.build_id_size == BUILD_ID_LEN &&
MemCompare(elf.build_id, kBuildId, BUILD_ID_LEN) == 0;
ok = ok && elf.debuglink_name != NULL && ZstrCompare(elf.debuglink_name, "foo.debug") == 0 &&
elf.debuglink_crc == DEBUGLINK_CRC;
ElfDeinit(&elf);- In
Dwarf.c:291:
// Inside the range -> the known name comes back.
const DwarfFunction *f = DwarfFunctionsResolve(&fns, 0x4000);
ok = ok && f && f->name && ZstrCompare(f->name, "widget_init") == 0;
f = DwarfFunctionsResolve(&fns, 0x4000 + 0x3f); // last byte in range
ok = ok && f && f->name && ZstrCompare(f->name, "widget_init") == 0;- In
Dwarf.c:293:
ok = ok && f && f->name && ZstrCompare(f->name, "widget_init") == 0;
f = DwarfFunctionsResolve(&fns, 0x4000 + 0x3f); // last byte in range
ok = ok && f && f->name && ZstrCompare(f->name, "widget_init") == 0;
// Below low_pc and at/above high_pc -> no match.
ok = ok && DwarfFunctionsResolve(&fns, 0x3fff) == NULL;- In
Dwarf.c:2480:
const DwarfLineEntry *e = DwarfLinesResolve(&lines, 0x2000);
ok = ok && e && e->file && ZstrCompare(e->file, "source.c") == 0 && e->line == 10;
e = DwarfLinesResolve(&lines, 0x2008);- In
Dwarf.c:2483:
e = DwarfLinesResolve(&lines, 0x2008);
ok = ok && e && e->file && ZstrCompare(e->file, "source.c") == 0 && e->line == 20;
DwarfLinesDeinit(&lines);- In
Dwarf.c:2650:
// CuStrings vectors never allocate and the leak is unobservable).
const DwarfLineEntry *e = DwarfLinesResolve(&lines, 0x2000);
ok = ok && e && e->file && ZstrCompare(e->file, "source.c") == 0;
DwarfLinesDeinit(&lines);
}- In
Dwarf.c:2696:
// is a distinct live allocation the deinit has to release.
const DwarfLineEntry *e = DwarfLinesResolve(&lines, 0x2000);
ok = ok && e && e->file && ZstrCompare(e->file, "source.c") == 0;
// After the build there must be live allocations to release.
ok = ok && (DebugAllocatorLiveCount(&dbg) > before);
Last updated on