StrBegin
Description
Pointer to the first character of the string. Equivalent to str->data.
Parameters
| Name | Direction | Description |
|---|---|---|
str |
in | String to query. |
Usage example (Cross-references)
Usage examples (Cross-references)
- In
File.h:82:
_Generic( \
(path), \
Str *: file_open((Zstr)StrBegin((Str *)(path)), (mode)), \
Zstr: file_open((Zstr)(path), (mode)), \
char *: file_open((Zstr)(path), (mode)) \
- In
File.h:207:
Buf *: _Generic( \
(path), \
Str *: file_read_and_close_to_buf((Zstr)StrBegin((Str *)(path)), (Buf *)(out)), \
Zstr: file_read_and_close_to_buf((Zstr)(path), (Buf *)(out)), \
char *: file_read_and_close_to_buf((Zstr)(path), (Buf *)(out)) \
- In
File.h:213:
Str *: _Generic( \
(path), \
Str *: file_read_and_close_to_str((Zstr)StrBegin((Str *)(path)), (Str *)(out)), \
Zstr: file_read_and_close_to_str((Zstr)(path), (Str *)(out)), \
char *: file_read_and_close_to_str((Zstr)(path), (Str *)(out)) \
- In
File.h:258:
Buf *: _Generic( \
(path), \
Str *: file_write_and_close_from_buf((Zstr)StrBegin((Str *)(path)), (const Buf *)(container)), \
Zstr: file_write_and_close_from_buf((Zstr)(path), (const Buf *)(container)), \
char *: file_write_and_close_from_buf((Zstr)(path), (const Buf *)(container)) \
- In
File.h:264:
Str *: _Generic( \
(path), \
Str *: file_write_and_close_from_str((Zstr)StrBegin((Str *)(path)), (const Str *)(container)), \
Zstr: file_write_and_close_from_str((Zstr)(path), (const Str *)(container)), \
char *: file_write_and_close_from_str((Zstr)(path), (const Str *)(container)) \
- In
File.h:272:
_Generic( \
(path), \
Str *: file_write_and_close_from_bytes((Zstr)StrBegin((Str *)(path)), (buf), (n)), \
Zstr: file_write_and_close_from_bytes((Zstr)(path), (buf), (n)), \
char *: file_write_and_close_from_bytes((Zstr)(path), (buf), (n)) \
- In
Log.h:45:
Str UNPL(m) = StrInit(&UNPL(log_alloc)); \
StrAppendFmt(&UNPL(m), __VA_ARGS__); \
LogWrite(LOG_MESSAGE_TYPE_FATAL, __func__, __LINE__, StrBegin(&UNPL(m))); \
StrDeinit(&UNPL(m)); \
HeapAllocatorDeinit(&UNPL(log_alloc)); \
- In
Log.h:69:
Str UNPL(m) = StrInit(&UNPL(log_alloc)); \
StrAppendFmt(&UNPL(m), __VA_ARGS__); \
LogWrite(LOG_MESSAGE_TYPE_ERROR, __func__, __LINE__, StrBegin(&UNPL(m))); \
StrDeinit(&UNPL(m)); \
HeapAllocatorDeinit(&UNPL(log_alloc)); \
- In
Log.h:92:
Str UNPL(m) = StrInit(&UNPL(log_alloc)); \
StrAppendFmt(&UNPL(m), __VA_ARGS__); \
LogWrite(LOG_MESSAGE_TYPE_INFO, __func__, __LINE__, StrBegin(&UNPL(m))); \
StrDeinit(&UNPL(m)); \
HeapAllocatorDeinit(&UNPL(log_alloc)); \
- In
Log.h:131:
StrAppendFmt(&UNPL(m), " : {}", UNPL(syserr)); \
} \
LogWrite(LOG_MESSAGE_TYPE_FATAL, __func__, __LINE__, StrBegin(&UNPL(m))); \
StrDeinit(&UNPL(m)); \
HeapAllocatorDeinit(&UNPL(log_alloc)); \
- In
Log.h:160:
StrAppendFmt(&UNPL(m), " : {}", UNPL(syserr)); \
} \
LogWrite(LOG_MESSAGE_TYPE_ERROR, __func__, __LINE__, StrBegin(&UNPL(m))); \
StrDeinit(&UNPL(m)); \
HeapAllocatorDeinit(&UNPL(log_alloc)); \
- In
Log.h:188:
StrAppendFmt(&UNPL(m), " : {}", UNPL(syserr)); \
} \
LogWrite(LOG_MESSAGE_TYPE_INFO, __func__, __LINE__, StrBegin(&UNPL(m))); \
StrDeinit(&UNPL(m)); \
HeapAllocatorDeinit(&UNPL(log_alloc)); \
- In
Init.h:145:
///
#define StrInitFromStr(...) OVERLOAD(StrInitFromStr, __VA_ARGS__)
#define StrInitFromStr_1(str) StrInitFromCstr_2(StrBegin(str), StrLen(str))
#define StrInitFromStr_2(str, a) StrInitFromCstr_3(StrBegin(str), StrLen(str), (a))- In
Init.h:146:
#define StrInitFromStr(...) OVERLOAD(StrInitFromStr, __VA_ARGS__)
#define StrInitFromStr_1(str) StrInitFromCstr_2(StrBegin(str), StrLen(str))
#define StrInitFromStr_2(str, a) StrInitFromCstr_3(StrBegin(str), StrLen(str), (a))
///
- In
Dir.h:119:
_Generic( \
(path), \
Str *: dir_get_contents((Zstr)StrBegin((Str *)(path)), MisraScope), \
Zstr: dir_get_contents((Zstr)(path), MisraScope), \
char *: dir_get_contents((Zstr)(path), MisraScope) \
- In
Dir.h:126:
_Generic( \
(path), \
Str *: dir_get_contents((Zstr)StrBegin((Str *)(path)), ALLOCATOR_OF(alloc)), \
Zstr: dir_get_contents((Zstr)(path), ALLOCATOR_OF(alloc)), \
char *: dir_get_contents((Zstr)(path), ALLOCATOR_OF(alloc)) \
- In
Dir.h:145:
_Generic( \
(path), \
Str *: file_get_size((Zstr)StrBegin((Str *)(path))), \
Zstr: file_get_size((Zstr)(path)), \
char *: file_get_size((Zstr)(path)) \
- In
Dir.h:173:
_Generic( \
(path), \
Str *: file_remove((Zstr)StrBegin((Str *)(path))), \
Zstr: file_remove((Zstr)(path)), \
char *: file_remove((Zstr)(path)) \
- In
Dir.h:196:
_Generic( \
(path), \
Str *: dir_remove((Zstr)StrBegin((Str *)(path))), \
Zstr: dir_remove((Zstr)(path)), \
char *: dir_remove((Zstr)(path)) \
- In
Dir.h:219:
_Generic( \
(path), \
Str *: dir_create((Zstr)StrBegin((Str *)(path))), \
Zstr: dir_create((Zstr)(path)), \
char *: dir_create((Zstr)(path)) \
- In
Dir.h:241:
_Generic( \
(path), \
Str *: dir_create_all((Zstr)StrBegin((Str *)(path))), \
Zstr: dir_create_all((Zstr)(path)), \
char *: dir_create_all((Zstr)(path)) \
- In
Dir.h:262:
_Generic( \
(path), \
Str *: dir_remove_all((Zstr)StrBegin((Str *)(path))), \
Zstr: dir_remove_all((Zstr)(path)), \
char *: dir_remove_all((Zstr)(path)) \
- In
Proc.h:288:
Str UNPL(buf) = StrInit(); \
ProcReadFromStdout((p), &UNPL(buf)); \
Zstr UNPL(in) = StrBegin(&UNPL(buf)); \
StrReadFmt(UNPL(in), __VA_ARGS__); \
StrDeinit(&UNPL(buf)); \
- In
Proc.h:315:
Str UNPL(buf) = StrInit(); \
ProcReadFromStderr((p), &UNPL(buf)); \
Zstr UNPL(in) = StrBegin(&UNPL(buf)); \
StrReadFmt(UNPL(in), __VA_ARGS__); \
StrDeinit(&UNPL(buf)); \
- In
Pdb.h:134:
_Generic( \
(path), \
Str *: pdb_open((out), (Zstr)StrBegin((Str *)(path)), MisraScope), \
Zstr: pdb_open((out), (Zstr)(path), MisraScope), \
char *: pdb_open((out), (Zstr)(path), MisraScope) \
- In
Pdb.h:141:
_Generic( \
(path), \
Str *: pdb_open((out), (Zstr)StrBegin((Str *)(path)), ALLOCATOR_OF(alloc)), \
Zstr: pdb_open((out), (Zstr)(path), ALLOCATOR_OF(alloc)), \
char *: pdb_open((out), (Zstr)(path), ALLOCATOR_OF(alloc)) \
- In
Elf.h:262:
_Generic( \
(path), \
Str *: elf_open((out), (Zstr)StrBegin((Str *)(path)), MisraScope), \
Zstr: elf_open((out), (Zstr)(path), MisraScope), \
char *: elf_open((out), (Zstr)(path), MisraScope) \
- In
Elf.h:269:
_Generic( \
(path), \
Str *: elf_open((out), (Zstr)StrBegin((Str *)(path)), ALLOCATOR_OF(alloc)), \
Zstr: elf_open((out), (Zstr)(path), ALLOCATOR_OF(alloc)), \
char *: elf_open((out), (Zstr)(path), ALLOCATOR_OF(alloc)) \
- In
Pe.h:139:
_Generic( \
(path), \
Str *: pe_open((out), (Zstr)StrBegin((Str *)(path)), MisraScope), \
Zstr: pe_open((out), (Zstr)(path), MisraScope), \
char *: pe_open((out), (Zstr)(path), MisraScope) \
- In
Pe.h:146:
_Generic( \
(path), \
Str *: pe_open((out), (Zstr)StrBegin((Str *)(path)), ALLOCATOR_OF(alloc)), \
Zstr: pe_open((out), (Zstr)(path), ALLOCATOR_OF(alloc)), \
char *: pe_open((out), (Zstr)(path), ALLOCATOR_OF(alloc)) \
- In
JSON.h:925:
const Str *UNPL(jw_s) = &(s); \
u64 UNPL(jw_len) = StrLen(UNPL(jw_s)); \
StrAppendFmt(&(j), "\"{}\"", UNPL(jw_len) ? (Zstr)StrBegin(UNPL(jw_s)) : (Zstr) ""); \
} while (0)- In
MachO.h:160:
_Generic( \
(path), \
Str *: macho_open((out), (Zstr)StrBegin((Str *)(path)), MisraScope), \
Zstr: macho_open((out), (Zstr)(path), MisraScope), \
char *: macho_open((out), (Zstr)(path), MisraScope) \
- In
MachO.h:167:
_Generic( \
(path), \
Str *: macho_open((out), (Zstr)StrBegin((Str *)(path)), ALLOCATOR_OF(alloc)), \
Zstr: macho_open((out), (Zstr)(path), ALLOCATOR_OF(alloc)), \
char *: macho_open((out), (Zstr)(path), ALLOCATOR_OF(alloc)) \
- In
MachO.h:238:
macho_find_section( \
(self), \
_Generic((segment), Str *: (Zstr)StrBegin((Str *)(segment)), Zstr: (Zstr)(segment), char *: (Zstr)(segment)), \
_Generic((section), Str *: (Zstr)StrBegin((Str *)(section)), Zstr: (Zstr)(section), char *: (Zstr)(section)) \
)- In
MachO.h:239:
(self), \
_Generic((segment), Str *: (Zstr)StrBegin((Str *)(segment)), Zstr: (Zstr)(segment), char *: (Zstr)(segment)), \
_Generic((section), Str *: (Zstr)StrBegin((Str *)(section)), Zstr: (Zstr)(section), char *: (Zstr)(section)) \
)- In
ProcMaps.h:103:
(src), \
File *: proc_maps_load_from_file((out), (File *)(src), MisraScope), \
Str *: proc_maps_load_from_bytes((out), (const u8 *)StrBegin((Str *)(src)), StrLen((Str *)(src)), MisraScope), \
Buf *: proc_maps_load_from_bytes((out), BufData((Buf *)(src)), BufLength((Buf *)(src)), MisraScope) \
)- In
ProcMaps.h:112:
Str *: proc_maps_load_from_bytes( \
(out), \
(const u8 *)StrBegin((Str *)(src)), \
StrLen((Str *)(src)), \
ALLOCATOR_OF(alloc) \
- In
VecStr.c:28:
// empty fresh Str.
Str copy = (StrLen(src) == 0) ? StrInit((Allocator *)alloc) :
StrInitFromCstr(StrBegin(src), StrLen(src), (Allocator *)alloc);
*(Str *)dst_ptr = copy;
return true;- In
Log.c:58:
File out = (type == LOG_MESSAGE_TYPE_INFO) ? FileFromFd(1) : FileFromFd(2);
(void)FileWrite(&out, StrBegin(&full), StrLen(&full));
#if FEATURE_SYS_BACKTRACE && (!defined(LOG_NO_BACKTRACE) || !LOG_NO_BACKTRACE)- In
Log.c:71:
// boundary; pass at the call site, no intermediate variable.
FormatStackTrace(&trace, frames, n, ALLOCATOR_OF(&h));
(void)FileWrite(&out, StrBegin(&trace), StrLen(&trace));
StrDeinit(&trace);
}- In
ArgParse.c:500:
break;
}
char *data = StrBegin(&flagbuf);
MemCopy(data, tok, n);
data[n] = '\0';- In
ArgParse.c:587:
bool iter_ok = false;
StrInitStack(buf, 3) {
char *data = StrBegin(&buf);
data[0] = '-';
data[1] = *p;- In
ArgParse.c:684:
} decision = BUNDLE_REJECT;
StrInitStack(two, 3) {
char *data = StrBegin(&two);
data[0] = '-';
data[1] = tok[1];- In
Io.c:511:
ok = false;
} else if (StrLen(&tmp)) {
MemCopy(StrBegin(o) + offset, StrBegin(&tmp), StrLen(&tmp));
}
}- In
Io.c:543:
}
if (ok && StrLen(&out) > 0 && FileWrite(stream, StrBegin(&out), StrLen(&out)) != (i64)StrLen(&out)) {
LOG_ERROR("Failed to write formatted output");
ok = false;- In
Io.c:620:
bool spec_ok = false;
StrInitStack(spec_buf, 32) {
char *data = StrBegin(&spec_buf);
MemCopy(data, start, spec_len);
data[spec_len] = '\0';- In
Io.c:1118:
ok = false;
} else if (StrLen(&tmp)) {
MemCopy(BufData(out) + offset, StrBegin(&tmp), StrLen(&tmp));
}
}- In
Io.c:1149:
StrPushBackR(&buffer, buf_byte);
}
str_read_fmt(StrBegin(&buffer), fmtstr, argv, argc);
} else {
// Remember the start position so we can rewind after a parse
- In
Io.c:1167:
if (file_len > 0) {
StrReserve(&buffer, (u64)file_len);
i64 got = FileRead(file, StrBegin(&buffer), (u64)file_len);
if (got < 0) {
LOG_ERROR("FileRead failed during f_read_fmt");- In
Io.c:1178:
if (StrLen(&buffer)) {
Zstr new_pos = str_read_fmt(StrBegin(&buffer), fmtstr, argv, argc);
if (!new_pos) {
LOG_ERROR("Parse failed, rolling back...");- In
Io.c:1184:
} else {
// Advance the channel position past the bytes we consumed.
i64 consumed = (i64)(new_pos - StrBegin(&buffer));
(void)FileSeek(file, cur_pos + consumed, FILE_SEEK_SET);
}- In
Io.c:1327:
bool ok = true;
StrInitStack(digits, 32) {
char *data = StrBegin(&digits);
u32 digit_count = 0;- In
Io.c:1382:
{
Zstr body = StrBegin(&canonical);
Zstr dot = NULL;
u64 prefix = 0;- In
Io.c:1389:
result = StrInit(alloc);
if (StrBegin(&canonical)[0] == '-') {
if (!StrPushBackR(&result, '-')) {
goto fail;- In
Io.c:1508:
exponent = value->exponent + (i64)StrLen(&digits) - 1;
if (!StrPushBackR(&result, StrBegin(&digits)[0])) {
goto fail;
}- In
Io.c:1519:
for (u64 i = 0; i < frac_digits; i++) {
if (i + 1 < StrLen(&digits)) {
if (!StrPushBackR(&result, StrBegin(&digits)[i + 1])) {
goto fail;
}- In
Io.c:1811:
if (fmt_info->flags & FMT_FLAG_CHAR) {
if (!write_char_internal(o, fmt_info->flags, (Zstr)StrBegin(s), len)) {
return false;
}- In
Io.c:2508:
// the slice is handed to the typed `StrToU64` / `StrToI64` parser.
static bool is_valid_numeric_string(const Str *str, bool allow_float) {
if (!str || !StrBegin(str))
return false;- In
Io.c:2512:
size len = StrLen(str);
const char *data = StrBegin(str);
if (len == 0)- In
Io.c:2805:
// a malformed integer; the parser proper would accept the leading
// '0' and silently lose the prefix, so reject early.
if (StrLen(&temp) == 2 && StrBegin(&temp)[0] == '0' &&
(StrBegin(&temp)[1] == 'x' || StrBegin(&temp)[1] == 'X' || StrBegin(&temp)[1] == 'b' ||
StrBegin(&temp)[1] == 'B' || StrBegin(&temp)[1] == 'o' || StrBegin(&temp)[1] == 'O')) {- In
Io.c:2806:
// '0' and silently lose the prefix, so reject early.
if (StrLen(&temp) == 2 && StrBegin(&temp)[0] == '0' &&
(StrBegin(&temp)[1] == 'x' || StrBegin(&temp)[1] == 'X' || StrBegin(&temp)[1] == 'b' ||
StrBegin(&temp)[1] == 'B' || StrBegin(&temp)[1] == 'o' || StrBegin(&temp)[1] == 'O')) {
LOG_ERROR("Incomplete number format");- In
Io.c:2807:
if (StrLen(&temp) == 2 && StrBegin(&temp)[0] == '0' &&
(StrBegin(&temp)[1] == 'x' || StrBegin(&temp)[1] == 'X' || StrBegin(&temp)[1] == 'b' ||
StrBegin(&temp)[1] == 'B' || StrBegin(&temp)[1] == 'o' || StrBegin(&temp)[1] == 'O')) {
LOG_ERROR("Incomplete number format");
StrDeinit(&temp);- In
Io.c:2912:
Str temp = StrInitFromCstr(start, pos, &scratch); \
\
if (StrLen(&temp) == 2 && StrBegin(&temp)[0] == '0' && \
(StrBegin(&temp)[1] == 'x' || StrBegin(&temp)[1] == 'X' || StrBegin(&temp)[1] == 'b' || \
StrBegin(&temp)[1] == 'B' || StrBegin(&temp)[1] == 'o' || StrBegin(&temp)[1] == 'O')) { \
- In
Io.c:2913:
\
if (StrLen(&temp) == 2 && StrBegin(&temp)[0] == '0' && \
(StrBegin(&temp)[1] == 'x' || StrBegin(&temp)[1] == 'X' || StrBegin(&temp)[1] == 'b' || \
StrBegin(&temp)[1] == 'B' || StrBegin(&temp)[1] == 'o' || StrBegin(&temp)[1] == 'O')) { \
LOG_ERROR("Incomplete number format"); \
- In
Io.c:2914:
if (StrLen(&temp) == 2 && StrBegin(&temp)[0] == '0' && \
(StrBegin(&temp)[1] == 'x' || StrBegin(&temp)[1] == 'X' || StrBegin(&temp)[1] == 'b' || \
StrBegin(&temp)[1] == 'B' || StrBegin(&temp)[1] == 'o' || StrBegin(&temp)[1] == 'O')) { \
LOG_ERROR("Incomplete number format"); \
StrDeinit(&temp); \
- In
Io.c:3021:
// the caller owns and may mutate the returned buffer. ZstrDupN's Zstr
// return is just the project-wide convention for fresh allocations.
result = (char *)ZstrDupN(StrBegin(&temp), StrLen(&temp), allocator_ptr);
if (!result) {
LOG_ERROR("Failed to allocate memory for string");- In
Io.c:3301:
);
*bv = BitVecFromStr(StrBegin(&bin_str), BitVecAllocator(bv));
StrDeinit(&bin_str);- In
Io.c:3380:
Str temp = StrInitFromCstr(start, StrIterIndex(&si) - StrIterIndex(&saved), IntAllocator(value));
Int parsed = IntInit(IntAllocator(value));
bool ok = IntTryFromStrRadix(&parsed, StrBegin(&temp), radix);
if (!ok) {- In
Io.c:3444:
StrDeinit(&temp);
temp = StrInitFromCstr(start, token_len, FloatAllocator(value));
if (!FloatTryFromStr(&parsed, StrBegin(&temp))) {
StrDeinit(&temp);
FloatDeinit(&parsed);- In
Str.c:193:
min = StrLen(a) < StrLen(b) ? StrLen(a) : StrLen(b);
cmp = MemCompare(StrBegin(a), StrBegin(b), min);
if (cmp != 0) {- In
Str.c:215:
i32 str_cmp_zstr(const Str *s, Zstr other) {
ValidateStr(s);
return ZstrCompare(StrBegin(s), other);
}- In
Str.c:220:
i32 str_cmp_cstr(const Str *s, Zstr other, size other_len) {
ValidateStr(s);
return ZstrCompareN(StrBegin(s), other, other_len);
}- In
Str.c:226:
ValidateStr(s);
ValidateStr(other);
return ZstrCompareIgnoreCase(StrBegin(s), StrBegin(other));
}- In
Str.c:231:
i32 str_cmp_zstr_ignore_case(const Str *s, Zstr other) {
ValidateStr(s);
return ZstrCompareIgnoreCase(StrBegin(s), other);
}- In
Str.c:236:
i32 str_cmp_cstr_ignore_case(const Str *s, Zstr other, size other_len) {
ValidateStr(s);
return ZstrCompareNIgnoreCase(StrBegin(s), other, other_len);
}- In
Str.c:241:
Zstr str_find_cstr(const Str *s, Zstr key, size key_len) {
ValidateStr(s);
return ZstrFindSubstringN(StrBegin(s), key, key_len);
}- In
Str.c:246:
Zstr str_find_zstr(const Str *s, Zstr key) {
ValidateStr(s);
return ZstrFindSubstring(StrBegin(s), key);
}- In
Str.c:252:
ValidateStr(s);
ValidateStr(key);
return ZstrFindSubstringN(StrBegin(s), StrBegin(key), StrLen(key));
}- In
Str.c:597:
bool ok = true;
StrInitStack(buffer, 65) {
char *data = StrBegin(&buffer);
size pos = 0;- In
Str.c:778:
bool ok = true;
StrInitStack(exp_buf, 8) {
char *data = StrBegin(&exp_buf);
size exp_pos = 0;
while (exp > 0) {- In
Str.c:809:
bool ok = true;
StrInitStack(int_buf, 32) {
char *data = StrBegin(&int_buf);
size int_pos = 0;
while (int_part > 0) {- In
Int.c:672:
}
return int_try_from_str_radix_impl(out, StrBegin(decimal), StrLen(decimal), start, 10, true);
}- In
Int.c:730:
}
return int_try_from_str_radix_impl(out, StrBegin(digits), StrLen(digits), start, radix, true);
}- In
Int.c:896:
}
return int_try_from_str_radix_impl(out, StrBegin(binary), StrLen(binary), start, 2, true);
}- In
Int.c:945:
}
return int_try_from_str_radix_impl(out, StrBegin(octal), StrLen(octal), start, 8, true);
}- In
Int.c:982:
}
return int_try_from_str_radix_impl(out, StrBegin(hex), StrLen(hex), 0, 16, false);
}- In
Float.c:619:
LOG_FATAL("Invalid arguments");
}
return float_try_from_str_impl(out, StrBegin(text), StrLen(text));
}- In
BitVec.c:1917:
bool result = false;
if (ZstrFindSubstring(StrBegin(&bv_str), pattern) != NULL) {
result = true;
}- In
BitVec.c:1934:
bool result = false;
if (ZstrFindSubstringN(StrBegin(&bv_str), StrBegin(pattern), StrLen(pattern)) != NULL) {
result = true;
}- In
Dir.c:83:
break;
}
char *data = StrBegin(&search_path);
MemCopy(data, path, path_len);
data[path_len] = '\\';- In
Dir.c:479:
i8 ok = 1;
StrInitStack(buf, 4096) {
char *data = StrBegin(&buf);
MemCopy(data, path, n);
data[n] = 0;- In
Dir.c:547:
for (size i = 0; i < VecLen(&dc); ++i) {
DirEntry *e = VecPtrAt(&dc, i);
Zstr entry_nm = StrBegin(&e->name);
if (ZstrCompare(entry_nm, ".") == 0 || ZstrCompare(entry_nm, "..") == 0) {
continue; append_build_id_path(&path, main->build_id, main->build_id_size);
StrPushBackMany(&path, ".debug");
if (sys_path_exists(StrBegin(&path)) && ElfOpen(out, &path, alloc)) {
if (sidecar_matches(main, out, /*by_build_id*/ true)) {
StrDeinit(&path); StrPushBackR(&path, '/');
StrPushBackMany(&path, main->debuglink_name);
if (sys_path_exists(StrBegin(&path)) && ElfOpen(out, &path, alloc)) {
if (sidecar_matches(main, out, /*by_build_id*/ false)) {
StrDeinit(&path); StrPushBackMany(&path, "/.debug/");
StrPushBackMany(&path, main->debuglink_name);
if (sys_path_exists(StrBegin(&path)) && ElfOpen(out, &path, alloc)) {
if (sidecar_matches(main, out, /*by_build_id*/ false)) {
StrDeinit(&path); StrPushBackR(&path, '/');
StrPushBackMany(&path, main->debuglink_name);
if (sys_path_exists(StrBegin(&path)) && ElfOpen(out, &path, alloc)) {
if (sidecar_matches(main, out, /*by_build_id*/ false)) {
StrDeinit(&path);- In
PdbCache.c:38:
*out_path = StrInit(StrAllocator(out_path));
StrPushBackMany(out_path, cv->pdb_path);
if (sys_path_exists(StrBegin(out_path)))
return true;- In
PdbCache.c:51:
StrPushBackR(out_path, '/');
StrPushBackMany(out_path, pdb_base);
if (sys_path_exists(StrBegin(out_path)))
return true;- In
PdbCache.c:70:
Str pdb_path = StrInit(alloc);
if (!find_pdb(&entry->pe, StrBegin(&entry->module_path), &pdb_path)) {
StrDeinit(&pdb_path);
return false;- 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
PdbCache.c:178:
return false;
}
return pdb_cache_resolve_zstr(self, StrBegin(module_path), module_base, runtime_ip, out_name, out_offset);
}- In
Dns.c:108:
bool ok = true;
StrInitStack(chunk, 4096) {
char *data = StrBegin(&chunk);
for (;;) {
i64 n = FileRead(&f, data, 4096);- In
Dns.c:189:
StrInitStack(ip_buf, 64) {
StrPushBackMany(&ip_buf, (Zstr)StrIterDataAt(&si, ip_start), ip_len);
got_v4 = parse_ipv4(StrBegin(&ip_buf), v4);
if (!got_v4) {
got_v6 = parse_ipv6(StrBegin(&ip_buf), v6);- In
Dns.c:191:
got_v4 = parse_ipv4(StrBegin(&ip_buf), v4);
if (!got_v4) {
got_v6 = parse_ipv6(StrBegin(&ip_buf), v6);
}
}- In
Dns.c:218:
HostsEntry e = {0};
e.name = StrInitFromCstr((Zstr)StrIterDataAt(&si, nm_start), nm_len, alloc);
ascii_lower((u8 *)StrBegin(&e.name), StrLen(&e.name));
if (got_v4) {
MemCopy(e.ip, v4, 4);- In
Dns.c:289:
u8 v4[4] = {0};
u8 v6[16] = {0};
if (parse_ipv4(StrBegin(&ip_buf), v4)) {
SocketAddr a = sockaddr_v4(v4, 53);
VecPushBackR(out, a);- In
Dns.c:292:
SocketAddr a = sockaddr_v4(v4, 53);
VecPushBackR(out, a);
} else if (parse_ipv6(StrBegin(&ip_buf), v6)) {
SocketAddr a = sockaddr_v6(v6, 53);
VecPushBackR(out, a);- In
Dns.c:345:
Str buf = StrInit(self->allocator);
StrPushBackMany(&buf, path, len);
bool ok = dns_add_path(self, StrBegin(&buf), do_hosts, do_resolv);
StrDeinit(&buf);
return ok;- In
Dns.c:353:
if (!self || !path)
return false;
return dns_add_path(self, StrBegin(path), true, true);
}- In
Dns.c:363:
if (!self || !path)
return false;
return dns_add_path(self, StrBegin(path), true, false);
}- In
Dns.c:373:
if (!self || !path)
return false;
return dns_add_path(self, StrBegin(path), false, true);
}- In
Dns.c:580:
// is a valid Zstr for the matchers / DNS query below.
normalize_hostname(hostname, &norm);
Zstr nq = StrBegin(&norm);
// 1. /etc/hosts fast path.
- 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
Dns.c:685:
StrInitStack(host, 256) {
StrPushBackMany(&host, spec, colon_at);
ok = dns_resolve_5_zstr(self, StrBegin(&host), port, kind, out);
}
return ok;- In
Dns.c:694:
return false;
}
return dns_resolve_5_zstr(self, StrBegin(hostname), port, kind, out);
}- In
Dns.c:701:
return false;
}
return dns_resolve_4_vec_zstr(self, StrBegin(spec), kind, out);
}- In
Dns.c:722:
return false;
}
return dns_resolve_4_one_zstr(self, StrBegin(spec), kind, out);
}- In
Backtrace.c:225:
if (pdb_cache_ok) {
StrInitStack(module_path, MAX_PATH) {
char *data = StrBegin(&module_path);
u64 module_base = 0;
if (win_module_for_ip(frames[i].ip, data, MAX_PATH, &module_base)) {- In
Socket.c:154:
bool iter_ok = true;
StrInitStack(tmp, 4) {
char *data = StrBegin(&tmp);
i32 n = 0;
if (v == 0) {- In
Socket.c:187:
bool ok = true;
StrInitStack(tmp, 4) {
char *data = StrBegin(&tmp);
i32 n = 0;
if (v == 0) {- In
Socket.c:395:
bool ok = false;
StrInitStack(host, 256) {
char *host_data = StrBegin(&host);
Zstr port_str = NULL;
if (!split_host_port(spec, host_data, 256, &port_str)) {- In
Socket.c:455:
// semantics for non-degenerate input. The empty-spec edge case is
// already handled by the zstr arm (returns false on no colon).
return socket_addr_parse_zstr(out, StrBegin(spec), kind);
}- In
Socket.c:465:
StrInitStack(host, 48) {
char *host_data = StrBegin(&host);
u16 port = 0;
if (addr->family == SOCKET_FAMILY_INET) {- 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
MachoCache.c:84:
Str path = StrInit(alloc);
if (!compose_dsym_path(StrBegin(&e->module_path), &path)) {
StrDeinit(&path);
return false;- In
MachoCache.c:88:
return false;
}
if (!sys_path_exists(StrBegin(&path)) || !MachoOpen(&e->dsym, &path, alloc)) {
StrDeinit(&path);
return false;- In
MachoCache.c:215:
return false;
}
return macho_cache_resolve_zstr(self, StrBegin(module_path), slide, runtime_ip, out_name, out_offset);
}- In
Proc.c:231:
}
if (!CreateProcessA(NULL, StrBegin(&cmdline), NULL, NULL, TRUE, 0, NULL, NULL, &si, &pi)) {
LOG_ERROR("CreateProcessA() failed (GetLastError={})", (i32)GetLastError());
StrDeinit(&cmdline);- In
Proc.c:471:
#if PLATFORM_UNIX
return direct_sys3(MISRA_SYS_write, (long)(proc->_stdin_fd), (long)(u64)(StrBegin(buf)), (long)(StrLen(buf)));
#else
DWORD written = 0;- In
Proc.c:474:
#else
DWORD written = 0;
if (!WriteFile(proc->_hStdinWrite, StrBegin(buf), StrLen(buf), &written, NULL))
return -1;
return (int)written;- In
Proc.c:500:
while (true) {
ssize_t n = direct_sys3(MISRA_SYS_read, (long)(rfd), (long)(u64)(StrBegin(&tmpbuf)), (long)(1023));
if (n > 0) {
StrResize(&tmpbuf, (size)n);- In
Proc.c:539:
DWORD bytes_read = 0;
if (!ReadFile(rhandle, StrBegin(&tmpbuf), 1023, &bytes_read, NULL)) {
LOG_ERROR("ReadFile failed (GetLastError={})", (i32)GetLastError());
total_read = -1;- In
Proc.c:648:
bool got = false;
StrInitStack(buffer, MAX_PATH) {
DWORD len = GetModuleFileNameA(NULL, StrBegin(&buffer), MAX_PATH);
if (len == 0 || len >= MAX_PATH) {
LOG_ERROR("Failed to get executable path or buffer too small");- In
Proc.c:665:
bool got = false;
StrInitStack(buffer, 4096) {
char *data = StrBegin(&buffer);
ssize_t len = proc_readlink("/proc/self/exe", data, 4095);
if (len >= 0) {- In
Pe.c:592:
if (!self || !name)
return NULL;
return pe_find_section_zstr(self, StrBegin(name));
}- In
DwarfInfo.c:614:
.low_pc = pf->low_pc,
.high_pc = pf->high_pc,
.name = StrBegin(&out->string_pool) + pf->name_offset_in_pool,
};
if (!VecPushBackR(&out->entries, f)) {- In
Dns.c:88:
// Str values are NUL-terminated by construction; encode_qname scans
// to '\0', so forward the Str's data view directly.
return dns_build_query_zstr(out, id, StrBegin(name), type);
}- In
KvConfig.c:51:
}
parsed = ZstrToI64(StrBegin(value), &endptr);
if (!endptr || endptr == StrBegin(value) || *endptr != '\0') {- In
KvConfig.c:53:
parsed = ZstrToI64(StrBegin(value), &endptr);
if (!endptr || endptr == StrBegin(value) || *endptr != '\0') {
return false;
}- In
KvConfig.c:69:
}
parsed = ZstrToF64(StrBegin(value), &endptr);
if (!endptr || endptr == StrBegin(value) || *endptr != '\0') {- In
KvConfig.c:71:
parsed = ZstrToF64(StrBegin(value), &endptr);
if (!endptr || endptr == StrBegin(value) || *endptr != '\0') {
return false;
}- In
KvConfig.c:362:
}
return StrInitFromCstr(StrBegin(value), StrLen(value), MapAllocator(cfg));
}- In
KvConfig.c:372:
}
return StrInitFromCstr(StrBegin(value), StrLen(value), MapAllocator(cfg));
}- In
Pdb.c:669:
.rva = pp->rva,
.size = 0,
.name = StrBegin(&self->name_pool) + pp->name_offset_in_pool,
};
if (i + 1 < VecLen(&pending)) {- In
Http.c:63:
}
VecForeachPtr(headers, header) {
if (0 == ZstrCompare(StrBegin(&header->key), key)) {
return header;
}- In
Http.c:76:
// Str values are NUL-terminated by construction; comparison scans
// to '\0', so forward the .data view.
return http_headers_find_zstr(headers, StrBegin(key));
}- In
Http.c:84:
static HttpRequestMethod http_request_method_from_str(const Str *mstr) {
if (!mstr || !StrBegin(mstr)) {
return HTTP_REQUEST_METHOD_UNKNOWN;
}- In
Http.c:87:
return HTTP_REQUEST_METHOD_UNKNOWN;
}
if (0 == ZstrCompareN(StrBegin(mstr), "GET", 3) && StrLen(mstr) == 3)
return HTTP_REQUEST_METHOD_GET;
if (0 == ZstrCompareN(StrBegin(mstr), "POST", 4) && StrLen(mstr) == 4)- In
Http.c:89:
if (0 == ZstrCompareN(StrBegin(mstr), "GET", 3) && StrLen(mstr) == 3)
return HTTP_REQUEST_METHOD_GET;
if (0 == ZstrCompareN(StrBegin(mstr), "POST", 4) && StrLen(mstr) == 4)
return HTTP_REQUEST_METHOD_POST;
if (0 == ZstrCompareN(StrBegin(mstr), "DELETE", 6) && StrLen(mstr) == 6)- In
Http.c:91:
if (0 == ZstrCompareN(StrBegin(mstr), "POST", 4) && StrLen(mstr) == 4)
return HTTP_REQUEST_METHOD_POST;
if (0 == ZstrCompareN(StrBegin(mstr), "DELETE", 6) && StrLen(mstr) == 6)
return HTTP_REQUEST_METHOD_DELETE;
if (0 == ZstrCompareN(StrBegin(mstr), "PUT", 3) && StrLen(mstr) == 3)- In
Http.c:93:
if (0 == ZstrCompareN(StrBegin(mstr), "DELETE", 6) && StrLen(mstr) == 6)
return HTTP_REQUEST_METHOD_DELETE;
if (0 == ZstrCompareN(StrBegin(mstr), "PUT", 3) && StrLen(mstr) == 3)
return HTTP_REQUEST_METHOD_PUT;
if (0 == ZstrCompareN(StrBegin(mstr), "PATCH", 5) && StrLen(mstr) == 5)- In
Http.c:95:
if (0 == ZstrCompareN(StrBegin(mstr), "PUT", 3) && StrLen(mstr) == 3)
return HTTP_REQUEST_METHOD_PUT;
if (0 == ZstrCompareN(StrBegin(mstr), "PATCH", 5) && StrLen(mstr) == 5)
return HTTP_REQUEST_METHOD_PATCH;
if (0 == ZstrCompareN(StrBegin(mstr), "HEAD", 4) && StrLen(mstr) == 4)- In
Http.c:97:
if (0 == ZstrCompareN(StrBegin(mstr), "PATCH", 5) && StrLen(mstr) == 5)
return HTTP_REQUEST_METHOD_PATCH;
if (0 == ZstrCompareN(StrBegin(mstr), "HEAD", 4) && StrLen(mstr) == 4)
return HTTP_REQUEST_METHOD_HEAD;
if (0 == ZstrCompareN(StrBegin(mstr), "OPTIONS", 7) && StrLen(mstr) == 7)- In
Http.c:99:
if (0 == ZstrCompareN(StrBegin(mstr), "HEAD", 4) && StrLen(mstr) == 4)
return HTTP_REQUEST_METHOD_HEAD;
if (0 == ZstrCompareN(StrBegin(mstr), "OPTIONS", 7) && StrLen(mstr) == 7)
return HTTP_REQUEST_METHOD_OPTIONS;
if (0 == ZstrCompareN(StrBegin(mstr), "CONNECT", 7) && StrLen(mstr) == 7)- In
Http.c:101:
if (0 == ZstrCompareN(StrBegin(mstr), "OPTIONS", 7) && StrLen(mstr) == 7)
return HTTP_REQUEST_METHOD_OPTIONS;
if (0 == ZstrCompareN(StrBegin(mstr), "CONNECT", 7) && StrLen(mstr) == 7)
return HTTP_REQUEST_METHOD_CONNECT;
if (0 == ZstrCompareN(StrBegin(mstr), "TRACE", 5) && StrLen(mstr) == 5)- In
Http.c:103:
if (0 == ZstrCompareN(StrBegin(mstr), "CONNECT", 7) && StrLen(mstr) == 7)
return HTTP_REQUEST_METHOD_CONNECT;
if (0 == ZstrCompareN(StrBegin(mstr), "TRACE", 5) && StrLen(mstr) == 5)
return HTTP_REQUEST_METHOD_TRACE;
return HTTP_REQUEST_METHOD_UNKNOWN;- In
Http.c:126:
}
if (0 != ZstrCompareN(StrBegin(&version), "HTTP/1.1", 8)) {
LOG_ERROR("invalid/unsupported HTTP version");
StrDeinit(&method);- In
Http.c:184:
// parser scans format-by-format with NUL-aware readers, so the
// .data view is sufficient.
return http_request_parse_zstr(req, StrBegin(in));
}- In
Http.c:449:
LOG_FATAL("invalid arguments");
}
return http_respond_with_file_zstr(response, status, content_type, (Zstr)StrBegin(filepath));
}
#endif- In
Http.c:488:
if (StrLen(&response->body)) {
if (!StrPushBackMany(&out, StrBegin(&response->body), StrLen(&response->body))) {
LOG_ERROR("HttpResponseSerialize: failed to append body");
StrDeinit(&out);- In
JSON.c:409:
Zstr end = NULL;
if (is_flt) {
num->f = ZstrToF64(StrBegin(&ns), &end);
} else {
num->i = ZstrToI64(StrBegin(&ns), &end);- In
JSON.c:411:
num->f = ZstrToF64(StrBegin(&ns), &end);
} else {
num->i = ZstrToI64(StrBegin(&ns), &end);
}
if (end == StrBegin(&ns)) {- In
JSON.c:413:
num->i = ZstrToI64(StrBegin(&ns), &end);
}
if (end == StrBegin(&ns)) {
LOG_ERROR("Failed to convert string to number.");
StrDeinit(&ns);- In
Elf.c:600:
if (!self || !name)
return NULL;
return elf_find_section_zstr(self, StrBegin(name));
}- In
Dwarf.c:643:
u64 fo = VecAt(&pending_file_offsets, i);
u64 dofs = VecAt(&pending_dir_offsets, i);
VecPtrAt(&out->entries, i)->file = fo ? (Zstr)(StrBegin(&out->string_pool) + fo) : NULL;
VecPtrAt(&out->entries, i)->dir = dofs ? (Zstr)(StrBegin(&out->string_pool) + dofs) : NULL;
}- In
Dwarf.c:644:
u64 dofs = VecAt(&pending_dir_offsets, i);
VecPtrAt(&out->entries, i)->file = fo ? (Zstr)(StrBegin(&out->string_pool) + fo) : NULL;
VecPtrAt(&out->entries, i)->dir = dofs ? (Zstr)(StrBegin(&out->string_pool) + dofs) : NULL;
}
}- In
Resolve.c:49:
// bracket form on v6 to round-trip through SocketAddrParse.
size n = StrLen(&s);
Zstr p = StrBegin(&s);
if (n >= 2 && p[n - 1] == '0' && p[n - 2] == ':') {
StrMustResize(&s, n - 2);- In
Beam.c:253:
HttpRequest req = HttpRequestInit(scope);
Zstr end = HttpRequestParse(&req, (Zstr)StrBegin(&raw));
if (end == StrBegin(&raw)) {
LOG_INFO("[{}] (unparseable request, {} bytes)", client_addr, (u64)prefix_len);- In
Beam.c:254:
HttpRequest req = HttpRequestInit(scope);
Zstr end = HttpRequestParse(&req, (Zstr)StrBegin(&raw));
if (end == StrBegin(&raw)) {
LOG_INFO("[{}] (unparseable request, {} bytes)", client_addr, (u64)prefix_len);
} else {- In
Beam.c:370:
if ((size)first_n < sizeof(first)) {
first[first_n] = 0;
log_request_summary(StrBegin(&peer_str), first, (size)first_n);
} else {
LOG_INFO("[{}] (request larger than {} bytes, not logging line)", peer_str, (u64)sizeof(first));- 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
AllocDebug.c:128:
bool ok = StrLen(&out) > 0;
ok = ok && (ZstrFindSubstring(StrBegin(&out), "leak:") != NULL);
ok = ok && (ZstrFindSubstring(StrBegin(&out), "24 bytes") != NULL);
ok = ok && (ZstrFindSubstring(StrBegin(&out), "40 bytes") != NULL);- In
AllocDebug.c:129:
bool ok = StrLen(&out) > 0;
ok = ok && (ZstrFindSubstring(StrBegin(&out), "leak:") != NULL);
ok = ok && (ZstrFindSubstring(StrBegin(&out), "24 bytes") != NULL);
ok = ok && (ZstrFindSubstring(StrBegin(&out), "40 bytes") != NULL);- In
AllocDebug.c:130:
ok = ok && (ZstrFindSubstring(StrBegin(&out), "leak:") != NULL);
ok = ok && (ZstrFindSubstring(StrBegin(&out), "24 bytes") != NULL);
ok = ok && (ZstrFindSubstring(StrBegin(&out), "40 bytes") != NULL);
StrDeinit(&out); DebugAllocatorReportLeaks(&dbg, &out);
bool ok = (ZstrFindSubstring(StrBegin(&out), "leak:") != NULL);
// FormatStackTrace renders frame lines beginning with "#0".
ok = ok && (ZstrFindSubstring(StrBegin(&out), "#0") != NULL); bool ok = (ZstrFindSubstring(StrBegin(&out), "leak:") != NULL);
// FormatStackTrace renders frame lines beginning with "#0".
ok = ok && (ZstrFindSubstring(StrBegin(&out), "#0") != NULL);
StrDeinit(&out); DebugAllocatorReportLeaks(&dbg, &out);
ok = ok && (ZstrFindSubstring(StrBegin(&out), "leak:") != NULL);
// Real emits "#0" and "#1"; the `--i` mutant emits only "#0".
ok = ok && (ZstrFindSubstring(StrBegin(&out), "#0 ") != NULL); ok = ok && (ZstrFindSubstring(StrBegin(&out), "leak:") != NULL);
// Real emits "#0" and "#1"; the `--i` mutant emits only "#0".
ok = ok && (ZstrFindSubstring(StrBegin(&out), "#0 ") != NULL);
ok = ok && (ZstrFindSubstring(StrBegin(&out), "#1 ") != NULL); // Real emits "#0" and "#1"; the `--i` mutant emits only "#0".
ok = ok && (ZstrFindSubstring(StrBegin(&out), "#0 ") != NULL);
ok = ok && (ZstrFindSubstring(StrBegin(&out), "#1 ") != NULL);
StrDeinit(&out); StrAppendFmt(&ns, "#{} ", n);
ok = ok && (ZstrFindSubstring(StrBegin(&out), "leak:") != NULL);
// The valid top frame "#(N-1) " is present; the spurious "#N " is not.
ok = ok && (ZstrFindSubstring(StrBegin(&out), StrBegin(&ns)) == NULL); ok = ok && (ZstrFindSubstring(StrBegin(&out), "leak:") != NULL);
// The valid top frame "#(N-1) " is present; the spurious "#N " is not.
ok = ok && (ZstrFindSubstring(StrBegin(&out), StrBegin(&ns)) == NULL);
StrDeinit(&ns);- In
ArgParse.c:261:
ArgRun rc = ArgParseRun(&p, 3, argv);
bool ok = (rc == ARG_RUN_OK) && StrLen(&name) == 5 && StrBegin(&name)[0] == 'a' && StrBegin(&name)[4] == 'e';
ArgParseDeinit(&p);
StrDeinit(&name);- 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:643:
WriteFmt("[a1] help mismatch:\n");
WriteFmt("---- expected ({} bytes) ----\n{}\n", ZstrLen(expected), expected);
WriteFmt("---- actual ({} bytes) ----\n{}\n", StrLen(&out), StrBegin(&out));
}
StrDeinit(&out);- In
ArgParse.c:855:
// opt50 is inside the 64-row window (rendered); opt64 is past it.
bool ok = ZstrFindSubstring(StrBegin(&out), "--opt50") != NULL &&
ZstrFindSubstring(StrBegin(&out), "--opt00") != NULL &&
ZstrFindSubstring(StrBegin(&out), "--opt64") == NULL;- In
ArgParse.c:856:
// opt50 is inside the 64-row window (rendered); opt64 is past it.
bool ok = ZstrFindSubstring(StrBegin(&out), "--opt50") != NULL &&
ZstrFindSubstring(StrBegin(&out), "--opt00") != NULL &&
ZstrFindSubstring(StrBegin(&out), "--opt64") == NULL;
if (!ok) {- In
ArgParse.c:857:
bool ok = ZstrFindSubstring(StrBegin(&out), "--opt50") != NULL &&
ZstrFindSubstring(StrBegin(&out), "--opt00") != NULL &&
ZstrFindSubstring(StrBegin(&out), "--opt64") == NULL;
if (!ok) {
WriteFmt("[a1] render cap: window wrong\n{}\n", StrBegin(&out));- In
ArgParse.c:859:
ZstrFindSubstring(StrBegin(&out), "--opt64") == NULL;
if (!ok) {
WriteFmt("[a1] render cap: window wrong\n{}\n", StrBegin(&out));
}
StrDeinit(&out);- In
ArgParse.c:908:
static bool str_contains(Str *hay, Zstr needle) {
u64 hn = StrLen(hay);
Zstr beg = StrBegin(hay);
u64 nn = ZstrLen(needle);
if (nn == 0)- In
ArgParse.c:1154:
char *argv[] = {(char *)"prog", (char *)"--name", (char *)"bob"};
ArgRun rc = ArgParseRun(&p, 3, argv);
bool ok = (rc == ARG_RUN_OK) && (StrLen(&name) == 3) && (StrBegin(&name)[0] == 'b') && (StrBegin(&name)[2] == 'b');
ArgParseDeinit(&p);
StrDeinit(&name);- In
ArgParse.c:1792:
static bool str_has(Str *hay, Zstr needle) {
u64 hn = StrLen(hay);
Zstr beg = StrBegin(hay);
u64 nn = ZstrLen(needle);
if (nn == 0)- 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
DateTime.c:185:
DateTime b = {0};
Zstr p = StrBegin(&s);
StrReadFmt(p, "{}", b);- In
Init.c:94:
stored_name = GraphNodeDataPtr(&graph, node);
bool result = GraphNodeIdIndex(node_id) == 0 && StrBegin(&name) != NULL && GraphNodeCount(&graph) == 1 &&
ZstrCompare(StrBegin(stored_name), "alpha") == 0 && StrBegin(stored_name) != StrBegin(&name);- 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:118:
stored_name = GraphNodeDataPtr(&graph, node);
bool result = GraphNodeIdIndex(node_id) == 0 && GraphNodeCount(&graph) == 1 && StrBegin(stored_name) != NULL &&
ZstrCompare(StrBegin(stored_name), "alpha") == 0;- 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
Foreach.c:34:
static GraphNodeId city_add_intersection(CityGraph *graph, CityIndex *index, const Str *name, DefaultAllocator *alloc) {
GraphNodeId id = GraphAddNodeR(graph, StrInitFromCstr(StrBegin(name), StrLen(name), alloc));
Str key_copy = StrInitFromCstr(StrBegin(name), StrLen(name), alloc);- In
Foreach.c:36:
GraphNodeId id = GraphAddNodeR(graph, StrInitFromCstr(StrBegin(name), StrLen(name), alloc));
Str key_copy = StrInitFromCstr(StrBegin(name), StrLen(name), alloc);
MapInsertR(index, key_copy, id);
return id;- 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
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:57:
// Check result
bool result = ok && (StrLen(&str) == 4);
result = result && (StrBegin(&str)[0] == '1');
result = result && (StrBegin(&str)[1] == '0');
result = result && (StrBegin(&str)[2] == '1');- In
Convert.c:58:
bool result = ok && (StrLen(&str) == 4);
result = result && (StrBegin(&str)[0] == '1');
result = result && (StrBegin(&str)[1] == '0');
result = result && (StrBegin(&str)[2] == '1');
result = result && (StrBegin(&str)[3] == '1');- In
Convert.c:59:
result = result && (StrBegin(&str)[0] == '1');
result = result && (StrBegin(&str)[1] == '0');
result = result && (StrBegin(&str)[2] == '1');
result = result && (StrBegin(&str)[3] == '1');- In
Convert.c:60:
result = result && (StrBegin(&str)[1] == '0');
result = result && (StrBegin(&str)[2] == '1');
result = result && (StrBegin(&str)[3] == '1');
// Clean up
- 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
Convert.c:658:
for (u64 i = 0; i < StrLen(&large_str); i++) {
bool expected = (i % 3) == 0;
bool actual = (StrBegin(&large_str)[i] == '1');
if (expected != actual) {
pattern_correct = false;- 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:179:
bool ok = StrAppendFmt(&out, "{}", src);
Zstr in = StrBegin(&out);
StrReadFmt(in, "{}", dst);
ok = ok && (dst.x == src.x) && (dst.y == src.y);- In
UserTypes.c:199:
};
bool ok = StrAppendFmt(&out, "{}", b);
ok = ok && (ZstrCompare(StrBegin(&out), "[(0, 0)..(10, 20)]") == 0);
StrDeinit(&out);- In
UserTypes.c:219:
bool ok = StrAppendFmt(&out, "{}", src);
Zstr in = StrBegin(&out);
StrReadFmt(in, "{}", dst);- 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:263:
bool ok = StrAppendFmt(&out, "{}", src);
Zstr in = StrBegin(&out);
StrReadFmt(in, "{}", dst);- 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:422:
StrAppendFmt(&output, "{c}", u16_value);
success = success && (StrLen(&output) == 2 && StrBegin(&output)[0] == 'A' && StrBegin(&output)[1] == 'B');
StrClear(&output);- In
Write.c:426:
StrAppendFmt(&output, "{a}", u16_value);
success = success && (StrLen(&output) == 2 && StrBegin(&output)[0] == 'a' && StrBegin(&output)[1] == 'b');
StrClear(&output);- In
Write.c:430:
StrAppendFmt(&output, "{A}", u16_value);
success = success && (StrLen(&output) == 2 && StrBegin(&output)[0] == 'A' && StrBegin(&output)[1] == 'B');
StrClear(&output);- In
Write.c:436:
StrAppendFmt(&output, "{c}", i16_value);
success = success && (StrLen(&output) == 2 && StrBegin(&output)[0] == 'C' && StrBegin(&output)[1] == 'd');
StrClear(&output);- In
Write.c:440:
StrAppendFmt(&output, "{a}", i16_value);
success = success && (StrLen(&output) == 2 && StrBegin(&output)[0] == 'c' && StrBegin(&output)[1] == 'd');
StrClear(&output);- In
Write.c:444:
StrAppendFmt(&output, "{A}", i16_value);
success = success && (StrLen(&output) == 2 && StrBegin(&output)[0] == 'C' && StrBegin(&output)[1] == 'D');
StrClear(&output);- In
Write.c:450:
StrAppendFmt(&output, "{c}", u32_value);
success = success && (StrLen(&output) == 4 && StrBegin(&output)[0] == 'E' && StrBegin(&output)[1] == 'f' &&
StrBegin(&output)[2] == 'G' && StrBegin(&output)[3] == 'h');
StrClear(&output);- In
Write.c:451:
StrAppendFmt(&output, "{c}", u32_value);
success = success && (StrLen(&output) == 4 && StrBegin(&output)[0] == 'E' && StrBegin(&output)[1] == 'f' &&
StrBegin(&output)[2] == 'G' && StrBegin(&output)[3] == 'h');
StrClear(&output);- In
Write.c:455:
StrAppendFmt(&output, "{a}", u32_value);
success = success && (StrLen(&output) == 4 && StrBegin(&output)[0] == 'e' && StrBegin(&output)[1] == 'f' &&
StrBegin(&output)[2] == 'g' && StrBegin(&output)[3] == 'h');
StrClear(&output);- In
Write.c:456:
StrAppendFmt(&output, "{a}", u32_value);
success = success && (StrLen(&output) == 4 && StrBegin(&output)[0] == 'e' && StrBegin(&output)[1] == 'f' &&
StrBegin(&output)[2] == 'g' && StrBegin(&output)[3] == 'h');
StrClear(&output);- In
Write.c:460:
StrAppendFmt(&output, "{A}", u32_value);
success = success && (StrLen(&output) == 4 && StrBegin(&output)[0] == 'E' && StrBegin(&output)[1] == 'F' &&
StrBegin(&output)[2] == 'G' && StrBegin(&output)[3] == 'H');
StrClear(&output);- In
Write.c:461:
StrAppendFmt(&output, "{A}", u32_value);
success = success && (StrLen(&output) == 4 && StrBegin(&output)[0] == 'E' && StrBegin(&output)[1] == 'F' &&
StrBegin(&output)[2] == 'G' && StrBegin(&output)[3] == 'H');
StrClear(&output);- In
Write.c:467:
StrAppendFmt(&output, "{c}", i32_value);
success = success && (StrLen(&output) == 4 && StrBegin(&output)[0] == 'I' && StrBegin(&output)[1] == 'j' &&
StrBegin(&output)[2] == 'K' && StrBegin(&output)[3] == 'l');
StrClear(&output);- In
Write.c:468:
StrAppendFmt(&output, "{c}", i32_value);
success = success && (StrLen(&output) == 4 && StrBegin(&output)[0] == 'I' && StrBegin(&output)[1] == 'j' &&
StrBegin(&output)[2] == 'K' && StrBegin(&output)[3] == 'l');
StrClear(&output);- In
Write.c:472:
StrAppendFmt(&output, "{a}", i32_value);
success = success && (StrLen(&output) == 4 && StrBegin(&output)[0] == 'i' && StrBegin(&output)[1] == 'j' &&
StrBegin(&output)[2] == 'k' && StrBegin(&output)[3] == 'l');
StrClear(&output);- In
Write.c:473:
StrAppendFmt(&output, "{a}", i32_value);
success = success && (StrLen(&output) == 4 && StrBegin(&output)[0] == 'i' && StrBegin(&output)[1] == 'j' &&
StrBegin(&output)[2] == 'k' && StrBegin(&output)[3] == 'l');
StrClear(&output);- In
Write.c:477:
StrAppendFmt(&output, "{A}", i32_value);
success = success && (StrLen(&output) == 4 && StrBegin(&output)[0] == 'I' && StrBegin(&output)[1] == 'J' &&
StrBegin(&output)[2] == 'K' && StrBegin(&output)[3] == 'L');
StrClear(&output);- In
Write.c:478:
StrAppendFmt(&output, "{A}", i32_value);
success = success && (StrLen(&output) == 4 && StrBegin(&output)[0] == 'I' && StrBegin(&output)[1] == 'J' &&
StrBegin(&output)[2] == 'K' && StrBegin(&output)[3] == 'L');
StrClear(&output);- In
Write.c:485:
StrAppendFmt(&output, "{c}", u64_value);
success = success && (StrLen(&output) == 8 && StrBegin(&output)[0] == 'M' && StrBegin(&output)[1] == 'n' &&
StrBegin(&output)[2] == 'O' && StrBegin(&output)[3] == 'p' && StrBegin(&output)[4] == 'Q' &&
StrBegin(&output)[5] == 'r' && StrBegin(&output)[6] == 'S' && StrBegin(&output)[7] == 't');- In
Write.c:486:
StrAppendFmt(&output, "{c}", u64_value);
success = success && (StrLen(&output) == 8 && StrBegin(&output)[0] == 'M' && StrBegin(&output)[1] == 'n' &&
StrBegin(&output)[2] == 'O' && StrBegin(&output)[3] == 'p' && StrBegin(&output)[4] == 'Q' &&
StrBegin(&output)[5] == 'r' && StrBegin(&output)[6] == 'S' && StrBegin(&output)[7] == 't');
StrClear(&output);- In
Write.c:487:
success = success && (StrLen(&output) == 8 && StrBegin(&output)[0] == 'M' && StrBegin(&output)[1] == 'n' &&
StrBegin(&output)[2] == 'O' && StrBegin(&output)[3] == 'p' && StrBegin(&output)[4] == 'Q' &&
StrBegin(&output)[5] == 'r' && StrBegin(&output)[6] == 'S' && StrBegin(&output)[7] == 't');
StrClear(&output);- In
Write.c:491:
StrAppendFmt(&output, "{a}", u64_value);
success = success && (StrLen(&output) == 8 && StrBegin(&output)[0] == 'm' && StrBegin(&output)[1] == 'n' &&
StrBegin(&output)[2] == 'o' && StrBegin(&output)[3] == 'p' && StrBegin(&output)[4] == 'q' &&
StrBegin(&output)[5] == 'r' && StrBegin(&output)[6] == 's' && StrBegin(&output)[7] == 't');- In
Write.c:492:
StrAppendFmt(&output, "{a}", u64_value);
success = success && (StrLen(&output) == 8 && StrBegin(&output)[0] == 'm' && StrBegin(&output)[1] == 'n' &&
StrBegin(&output)[2] == 'o' && StrBegin(&output)[3] == 'p' && StrBegin(&output)[4] == 'q' &&
StrBegin(&output)[5] == 'r' && StrBegin(&output)[6] == 's' && StrBegin(&output)[7] == 't');
StrClear(&output);- In
Write.c:493:
success = success && (StrLen(&output) == 8 && StrBegin(&output)[0] == 'm' && StrBegin(&output)[1] == 'n' &&
StrBegin(&output)[2] == 'o' && StrBegin(&output)[3] == 'p' && StrBegin(&output)[4] == 'q' &&
StrBegin(&output)[5] == 'r' && StrBegin(&output)[6] == 's' && StrBegin(&output)[7] == 't');
StrClear(&output);- In
Write.c:497:
StrAppendFmt(&output, "{A}", u64_value);
success = success && (StrLen(&output) == 8 && StrBegin(&output)[0] == 'M' && StrBegin(&output)[1] == 'N' &&
StrBegin(&output)[2] == 'O' && StrBegin(&output)[3] == 'P' && StrBegin(&output)[4] == 'Q' &&
StrBegin(&output)[5] == 'R' && StrBegin(&output)[6] == 'S' && StrBegin(&output)[7] == 'T');- In
Write.c:498:
StrAppendFmt(&output, "{A}", u64_value);
success = success && (StrLen(&output) == 8 && StrBegin(&output)[0] == 'M' && StrBegin(&output)[1] == 'N' &&
StrBegin(&output)[2] == 'O' && StrBegin(&output)[3] == 'P' && StrBegin(&output)[4] == 'Q' &&
StrBegin(&output)[5] == 'R' && StrBegin(&output)[6] == 'S' && StrBegin(&output)[7] == 'T');
StrClear(&output);- In
Write.c:499:
success = success && (StrLen(&output) == 8 && StrBegin(&output)[0] == 'M' && StrBegin(&output)[1] == 'N' &&
StrBegin(&output)[2] == 'O' && StrBegin(&output)[3] == 'P' && StrBegin(&output)[4] == 'Q' &&
StrBegin(&output)[5] == 'R' && StrBegin(&output)[6] == 'S' && StrBegin(&output)[7] == 'T');
StrClear(&output);- In
Write.c:506:
StrAppendFmt(&output, "{c}", i64_value);
success = success && (StrLen(&output) == 8 && StrBegin(&output)[0] == 'U' && StrBegin(&output)[1] == 'v' &&
StrBegin(&output)[2] == 'W' && StrBegin(&output)[3] == 'x' && StrBegin(&output)[4] == 'Y' &&
StrBegin(&output)[5] == 'z' && StrBegin(&output)[6] == '1' && StrBegin(&output)[7] == '2');- In
Write.c:507:
StrAppendFmt(&output, "{c}", i64_value);
success = success && (StrLen(&output) == 8 && StrBegin(&output)[0] == 'U' && StrBegin(&output)[1] == 'v' &&
StrBegin(&output)[2] == 'W' && StrBegin(&output)[3] == 'x' && StrBegin(&output)[4] == 'Y' &&
StrBegin(&output)[5] == 'z' && StrBegin(&output)[6] == '1' && StrBegin(&output)[7] == '2');
StrClear(&output);- In
Write.c:508:
success = success && (StrLen(&output) == 8 && StrBegin(&output)[0] == 'U' && StrBegin(&output)[1] == 'v' &&
StrBegin(&output)[2] == 'W' && StrBegin(&output)[3] == 'x' && StrBegin(&output)[4] == 'Y' &&
StrBegin(&output)[5] == 'z' && StrBegin(&output)[6] == '1' && StrBegin(&output)[7] == '2');
StrClear(&output);- In
Write.c:512:
StrAppendFmt(&output, "{a}", i64_value);
success = success && (StrLen(&output) == 8 && StrBegin(&output)[0] == 'u' && StrBegin(&output)[1] == 'v' &&
StrBegin(&output)[2] == 'w' && StrBegin(&output)[3] == 'x' && StrBegin(&output)[4] == 'y' &&
StrBegin(&output)[5] == 'z' && StrBegin(&output)[6] == '1' && StrBegin(&output)[7] == '2');- In
Write.c:513:
StrAppendFmt(&output, "{a}", i64_value);
success = success && (StrLen(&output) == 8 && StrBegin(&output)[0] == 'u' && StrBegin(&output)[1] == 'v' &&
StrBegin(&output)[2] == 'w' && StrBegin(&output)[3] == 'x' && StrBegin(&output)[4] == 'y' &&
StrBegin(&output)[5] == 'z' && StrBegin(&output)[6] == '1' && StrBegin(&output)[7] == '2');
StrClear(&output);- In
Write.c:514:
success = success && (StrLen(&output) == 8 && StrBegin(&output)[0] == 'u' && StrBegin(&output)[1] == 'v' &&
StrBegin(&output)[2] == 'w' && StrBegin(&output)[3] == 'x' && StrBegin(&output)[4] == 'y' &&
StrBegin(&output)[5] == 'z' && StrBegin(&output)[6] == '1' && StrBegin(&output)[7] == '2');
StrClear(&output);- In
Write.c:518:
StrAppendFmt(&output, "{A}", i64_value);
success = success && (StrLen(&output) == 8 && StrBegin(&output)[0] == 'U' && StrBegin(&output)[1] == 'V' &&
StrBegin(&output)[2] == 'W' && StrBegin(&output)[3] == 'X' && StrBegin(&output)[4] == 'Y' &&
StrBegin(&output)[5] == 'Z' && StrBegin(&output)[6] == '1' && StrBegin(&output)[7] == '2');- In
Write.c:519:
StrAppendFmt(&output, "{A}", i64_value);
success = success && (StrLen(&output) == 8 && StrBegin(&output)[0] == 'U' && StrBegin(&output)[1] == 'V' &&
StrBegin(&output)[2] == 'W' && StrBegin(&output)[3] == 'X' && StrBegin(&output)[4] == 'Y' &&
StrBegin(&output)[5] == 'Z' && StrBegin(&output)[6] == '1' && StrBegin(&output)[7] == '2');- In
Write.c:520:
success = success && (StrLen(&output) == 8 && StrBegin(&output)[0] == 'U' && StrBegin(&output)[1] == 'V' &&
StrBegin(&output)[2] == 'W' && StrBegin(&output)[3] == 'X' && StrBegin(&output)[4] == 'Y' &&
StrBegin(&output)[5] == 'Z' && StrBegin(&output)[6] == '1' && StrBegin(&output)[7] == '2');
StrDeinit(&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:685:
StrAppendFmt(&s, "old prefix ");
StrWriteFmt(&s, "fresh {}", LVAL(42));
bool ok = (StrLen(&s) == 8) && (StrBegin(&s)[0] == 'f') && (StrBegin(&s)[StrLen(&s) - 1] == '2');
StrDeinit(&s);
DefaultAllocatorDeinit(&alloc);- In
Write.c:702:
bool ok = StrPatchFmt(&s, 2, "{}", LVAL(1234));
ok = ok && StrLen(&s) == before_length;
ok = ok && StrBegin(&s)[0] == 'A' && StrBegin(&s)[1] == 'A';
ok = ok && StrBegin(&s)[2] == '1' && StrBegin(&s)[3] == '2' && StrBegin(&s)[4] == '3' && StrBegin(&s)[5] == '4';
ok = ok && StrBegin(&s)[6] == 'A' && StrBegin(&s)[7] == 'A';- In
Write.c:703:
ok = ok && StrLen(&s) == before_length;
ok = ok && StrBegin(&s)[0] == 'A' && StrBegin(&s)[1] == 'A';
ok = ok && StrBegin(&s)[2] == '1' && StrBegin(&s)[3] == '2' && StrBegin(&s)[4] == '3' && StrBegin(&s)[5] == '4';
ok = ok && StrBegin(&s)[6] == 'A' && StrBegin(&s)[7] == 'A';- In
Write.c:704:
ok = ok && StrBegin(&s)[0] == 'A' && StrBegin(&s)[1] == 'A';
ok = ok && StrBegin(&s)[2] == '1' && StrBegin(&s)[3] == '2' && StrBegin(&s)[4] == '3' && StrBegin(&s)[5] == '4';
ok = ok && StrBegin(&s)[6] == 'A' && StrBegin(&s)[7] == 'A';
// Patch that would extend past the end must fail.
- In
Write.c:709:
ok = ok && !StrPatchFmt(&s, 6, "{}", LVAL(9999));
ok = ok && StrLen(&s) == before_length;
ok = ok && StrBegin(&s)[6] == 'A' && StrBegin(&s)[7] == 'A';
StrDeinit(&s);- 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:3861:
StrAppendFmt(&output, "{c}", v);
bool ok = (StrLen(&output) == 1) && (StrBegin(&output)[0] == 'Q');
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:4121:
ok = ok && StrPatchFmt(&s, 2, "{}", LVAL(1234));
ok = ok && (StrLen(&s) == before);
ok = ok && StrBegin(&s)[2] == '1' && StrBegin(&s)[5] == '4';
StrDeinit(&s);- 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:4996:
ok = ok && FWriteFmtLn(&f, "n={}", LVAL((i32)42));
FileClose(&f);
File r = FileOpen(StrBegin(&path), "r");
if (FileIsOpen(&r)) {
Str back = StrInit(&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:5027:
ok = ok && FWriteFmt(&f, "X");
FileClose(&f);
File r = FileOpen(StrBegin(&path), "r");
if (FileIsOpen(&r)) {
Str back = StrInit(&alloc);