StrClear
Description
Set the string length to 0 while keeping the allocated capacity, so subsequent writes can reuse the buffer without reallocation. See VecClear for the full SUCCESS/FAILURE contract.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Io.c:485:
return false;
}
StrClear(o);
return str_append_fmt(o, fmt, args, argc);
}- In
ArgParse.c:136:
case ARG_KIND_STR : {
Str *s = (Str *)target;
StrClear(s);
StrPushBackMany(s, value);
return true;- In
Str.c:569:
}
StrClear(str);
if (config->use_prefix) {- In
Str.c:672:
}
StrClear(str);
if (isnan_f64(value)) {- In
KvConfig.c:127:
if (StrLen(key) == 0) {
LOG_ERROR("Expected config key");
StrClear(key);
return saved_si;
}- In
KvConfig.c:162:
if (!StrIterPeek(&si, &c)) {
LOG_ERROR("Unexpected end of quoted config value");
StrClear(value);
return saved_si;
}- In
KvConfig.c:191:
LOG_ERROR("Missing closing quote in config value");
StrClear(value);
return saved_si;
}- In
KvConfig.c:239:
if (!StrIterPeek(&si, &c) || (c != '=' && c != ':')) {
LOG_ERROR("Expected '=' or ':' after config key");
StrClear(key);
StrClear(value);
return saved_si;- In
KvConfig.c:240:
LOG_ERROR("Expected '=' or ':' after config key");
StrClear(key);
StrClear(value);
return saved_si;
}- In
KvConfig.c:248:
if (StrIterIndex(&si) == StrIterIndex(&saved_si)) {
StrClear(key);
StrClear(value);
return saved_si;- In
KvConfig.c:249:
if (StrIterIndex(&si) == StrIterIndex(&saved_si)) {
StrClear(key);
StrClear(value);
return saved_si;
}- In
KvConfig.c:262:
} else if (c != '\n') {
LOG_ERROR("Unexpected trailing characters after config value");
StrClear(key);
StrClear(value);
return saved_si;- In
KvConfig.c:263:
LOG_ERROR("Unexpected trailing characters after config value");
StrClear(key);
StrClear(value);
return saved_si;
} else {- In
JSON.c:215:
if (!StrIterPeek(&si, &c)) {
LOG_ERROR("Unexpected end of string.");
StrClear(str);
return saved_si;
}- In
JSON.c:270:
if (StrIterRemainingLength(&si) < 5) {
LOG_ERROR("Truncated \\uXXXX escape in JSON string.");
StrClear(str);
return saved_si;
}- In
JSON.c:282:
default :
LOG_ERROR("Invalid JSON object key string.");
StrClear(str);
return saved_si;
}- In
Str.Memory.c:129:
// Test StrClear function
bool test_str_clear(void) {
WriteFmt("Testing StrClear\n");
DefaultAllocator alloc = DefaultAllocatorInit();- In
Str.Memory.c:139:
// Clear the string
StrClear(&s);
// Length should now be 0, but capacity should remain
- In
Str.Convert.c:45:
// Test hexadecimal conversion (lowercase)
StrClear(&s);
config = (StrIntFormat) {.base = 16, .uppercase = false, .use_prefix = true};
StrFromU64(&s, 0xABCD, &config);- In
Str.Convert.c:54:
// Test hexadecimal conversion (uppercase)
StrClear(&s);
config = (StrIntFormat) {.base = 16, .uppercase = true, .use_prefix = true};
StrFromU64(&s, 0xABCD, &config);- In
Str.Convert.c:63:
// Test binary conversion
StrClear(&s);
config = (StrIntFormat) {.base = 2, .uppercase = false, .use_prefix = true};
StrFromU64(&s, 42, &config);- In
Str.Convert.c:72:
// Test octal conversion
StrClear(&s);
config = (StrIntFormat) {.base = 8, .uppercase = false, .use_prefix = true};
StrFromU64(&s, 42, &config);- In
Str.Convert.c:81:
// Test zero
StrClear(&s);
config = (StrIntFormat) {.base = 10, .uppercase = false};
StrFromU64(&s, 0, &config);
// Test negative decimal conversion (only decimal supports negative sign)
StrClear(&s);
config = (StrIntFormat) {.base = 10, .uppercase = false};
StrFromI64(&s, -12345, &config);
// Test hexadecimal conversion of negative number (negative non-decimal treated as unsigned)
StrClear(&s);
config = (StrIntFormat) {.base = 16, .uppercase = false, .use_prefix = true};
StrFromI64(&s, -0xABCD, &config);
// Test zero
StrClear(&s);
config = (StrIntFormat) {.base = 10, .uppercase = false};
StrFromI64(&s, 0, &config);
// Test binary conversion
StrClear(&s);
config = (StrIntFormat) {.base = 2, .uppercase = false, .use_prefix = true};
StrFromI64(&s, 42, &config);
// Test fractional conversion
StrClear(&s);
config = (StrFloatFormat) {.precision = 3, .force_sci = false, .uppercase = false};
StrFromF64(&s, 123.456, &config);
// Test negative number
StrClear(&s);
config = (StrFloatFormat) {.precision = 3, .force_sci = false, .uppercase = false};
StrFromF64(&s, -123.456, &config);
// Test scientific notation (forced)
StrClear(&s);
config = (StrFloatFormat) {.precision = 3, .force_sci = true, .uppercase = false};
StrFromF64(&s, 123.456, &config);
// Test scientific notation (uppercase)
StrClear(&s);
config = (StrFloatFormat) {.precision = 3, .force_sci = true, .uppercase = true};
StrFromF64(&s, 123.456, &config);
// Test very small number (auto scientific notation)
StrClear(&s);
config = (StrFloatFormat) {.precision = 3, .force_sci = false, .uppercase = false};
StrFromF64(&s, 0.0000123, &config);
// Test very large number (auto scientific notation)
StrClear(&s);
config = (StrFloatFormat) {.precision = 2, .force_sci = false, .uppercase = false};
StrFromF64(&s, 1234567890123.0, &config);
// Test zero
StrClear(&s);
config = (StrFloatFormat) {.precision = 2, .force_sci = false, .uppercase = false};
StrFromF64(&s, 0.0, &config);
// Test infinity
StrClear(&s);
config = (StrFloatFormat) {.precision = 2, .force_sci = false, .uppercase = false};
StrFromF64(&s, F64_INFINITY, &config);
// Test negative infinity
StrClear(&s);
config = (StrFloatFormat) {.precision = 2, .force_sci = false, .uppercase = false};
StrFromF64(&s, -F64_INFINITY, &config);
// Test NaN
StrClear(&s);
config = (StrFloatFormat) {.precision = 2, .force_sci = false, .uppercase = false};
StrFromF64(&s, F64_NAN, &config);
// Test hex round-trip
StrClear(&s);
config = (StrIntFormat) {.base = 16, .uppercase = false, .use_prefix = true};
StrFromU64(&s, u64_values[i], &config);
// Test minimum i64 (avoid INT64_MIN due to negation UB)
StrClear(&s);
config = (StrIntFormat) {.base = 10, .uppercase = false};
StrFromI64(&s, INT64_MIN + 1, &config);
// Test very small floating point
StrClear(&s);
StrFloatFormat fconfig = {.precision = 3, .force_sci = false, .uppercase = false};
StrFromF64(&s, 1e-300, &fconfig);
// Test very large floating point
StrClear(&s);
fconfig = (StrFloatFormat) {.precision = 3, .force_sci = false, .uppercase = false};
StrFromF64(&s, 1e300, &fconfig);
// Test uppercase E
StrClear(&s);
config = (StrFloatFormat) {.precision = 3, .force_sci = true, .uppercase = true};
StrFromF64(&s, sci_values[i], &config);- In
Str.Access.c:35:
result = result && !StrEmpty(&s);
StrClear(&s);
result = result && (StrLen(&s) == 0);
result = result && StrEmpty(&s);- In
Io.Read.c:330:
success = success && (StrCmp(&s, &expected) == 0);
StrDeinit(&expected);
StrClear(&s);
z = "\"Hello, World!\"";- In
Io.Read.c:377:
success = success && (StrCmp(&name, &expected) == 0);
StrDeinit(&expected);
StrClear(&name);
f64 val = 0.0;- In
Io.Write.c:40:
StrAppendFmt(&output, "");
success = success && (StrLen(&output) == 0);
StrClear(&output);
StrAppendFmt(&output, "Hello, world!");- In
Io.Write.c:44:
StrAppendFmt(&output, "Hello, world!");
success = success && (ZstrCompare(StrBegin(&output), "Hello, world!") == 0);
StrClear(&output);
StrAppendFmt(&output, "{{Hello}}");- In
Io.Write.c:48:
StrAppendFmt(&output, "{{Hello}}");
success = success && (ZstrCompare(StrBegin(&output), "{Hello}") == 0);
StrClear(&output);
StrAppendFmt(&output, "{{{{");- In
Io.Write.c:69:
StrAppendFmt(&output, "{}", str);
success = success && (ZstrCompare(StrBegin(&output), "Hello") == 0);
StrClear(&output);
Zstr empty = "";- In
Io.Write.c:74:
StrAppendFmt(&output, "{}", empty);
success = success && (StrLen(&output) == 0);
StrClear(&output);
StrAppendFmt(&output, "{>10}", str);- In
Io.Write.c:78:
StrAppendFmt(&output, "{>10}", str);
success = success && (ZstrCompare(StrBegin(&output), " Hello") == 0);
StrClear(&output);
StrAppendFmt(&output, "{<10}", str);- In
Io.Write.c:82:
StrAppendFmt(&output, "{<10}", str);
success = success && (ZstrCompare(StrBegin(&output), "Hello ") == 0);
StrClear(&output);
StrAppendFmt(&output, "{^10}", str);- In
Io.Write.c:86:
StrAppendFmt(&output, "{^10}", str);
success = success && (ZstrCompare(StrBegin(&output), " Hello ") == 0);
StrClear(&output);
Str s = StrInitFromZstr("World", &alloc);- In
Io.Write.c:109:
StrAppendFmt(&output, "{}", i8_val);
success = success && (ZstrCompare(StrBegin(&output), "-42") == 0);
StrClear(&output);
i16 i16_val = -1234;- In
Io.Write.c:114:
StrAppendFmt(&output, "{}", i16_val);
success = success && (ZstrCompare(StrBegin(&output), "-1234") == 0);
StrClear(&output);
i32 i32_val = -123456;- In
Io.Write.c:119:
StrAppendFmt(&output, "{}", i32_val);
success = success && (ZstrCompare(StrBegin(&output), "-123456") == 0);
StrClear(&output);
i64 i64_val = -1234567890LL;- In
Io.Write.c:124:
StrAppendFmt(&output, "{}", i64_val);
success = success && (ZstrCompare(StrBegin(&output), "-1234567890") == 0);
StrClear(&output);
u8 u8_val = 42;- In
Io.Write.c:129:
StrAppendFmt(&output, "{}", u8_val);
success = success && (ZstrCompare(StrBegin(&output), "42") == 0);
StrClear(&output);
u16 u16_val = 1234;- In
Io.Write.c:134:
StrAppendFmt(&output, "{}", u16_val);
success = success && (ZstrCompare(StrBegin(&output), "1234") == 0);
StrClear(&output);
u32 u32_val = 123456;- In
Io.Write.c:139:
StrAppendFmt(&output, "{}", u32_val);
success = success && (ZstrCompare(StrBegin(&output), "123456") == 0);
StrClear(&output);
u64 u64_val = 1234567890ULL;- In
Io.Write.c:144:
StrAppendFmt(&output, "{}", u64_val);
success = success && (ZstrCompare(StrBegin(&output), "1234567890") == 0);
StrClear(&output);
i8 i8_max = 127;- In
Io.Write.c:149:
StrAppendFmt(&output, "{}", i8_max);
success = success && (ZstrCompare(StrBegin(&output), "127") == 0);
StrClear(&output);
i8 i8_min = -128;- In
Io.Write.c:154:
StrAppendFmt(&output, "{}", i8_min);
success = success && (ZstrCompare(StrBegin(&output), "-128") == 0);
StrClear(&output);
u8 u8_max = 255;- In
Io.Write.c:159:
StrAppendFmt(&output, "{}", u8_max);
success = success && (ZstrCompare(StrBegin(&output), "255") == 0);
StrClear(&output);
u8 u8_min = 0;- In
Io.Write.c:181:
StrAppendFmt(&output, "{x}", val);
success = success && (ZstrCompare(StrBegin(&output), "0xdeadbeef") == 0);
StrClear(&output);
StrAppendFmt(&output, "{X}", val);- In
Io.Write.c:236:
StrAppendFmt(&output, "{}", f32_val);
success = success && (ZstrCompare(StrBegin(&output), "3.141590") == 0);
StrClear(&output);
f64 f64_val = 2.71828;- In
Io.Write.c:259:
StrAppendFmt(&output, "{.2}", val);
success = success && (ZstrCompare(StrBegin(&output), "3.14") == 0);
StrClear(&output);
StrAppendFmt(&output, "{.0}", val);- In
Io.Write.c:263:
StrAppendFmt(&output, "{.0}", val);
success = success && (ZstrCompare(StrBegin(&output), "3") == 0);
StrClear(&output);
StrAppendFmt(&output, "{.10}", val);- In
Io.Write.c:284:
StrAppendFmt(&output, "{}", pos_inf);
success = success && (ZstrCompare(StrBegin(&output), "inf") == 0);
StrClear(&output);
f64 neg_inf = -F64_INFINITY;- In
Io.Write.c:289:
StrAppendFmt(&output, "{}", neg_inf);
success = success && (ZstrCompare(StrBegin(&output), "-inf") == 0);
StrClear(&output);
f64 nan_val = F64_NAN;- In
Io.Write.c:311:
StrAppendFmt(&output, "{5}", val);
success = success && (ZstrCompare(StrBegin(&output), " 42") == 0);
StrClear(&output);
StrAppendFmt(&output, "{<5}", val);- In
Io.Write.c:315:
StrAppendFmt(&output, "{<5}", val);
success = success && (ZstrCompare(StrBegin(&output), "42 ") == 0);
StrClear(&output);
StrAppendFmt(&output, "{^5}", val);- In
Io.Write.c:319:
StrAppendFmt(&output, "{^5}", val);
success = success && (ZstrCompare(StrBegin(&output), " 42 ") == 0);
StrClear(&output);
Zstr str = "abc";- In
Io.Write.c:324:
StrAppendFmt(&output, "{5}", str);
success = success && (ZstrCompare(StrBegin(&output), " abc") == 0);
StrClear(&output);
StrAppendFmt(&output, "{<5}", str);- In
Io.Write.c:328:
StrAppendFmt(&output, "{<5}", str);
success = success && (ZstrCompare(StrBegin(&output), "abc ") == 0);
StrClear(&output);
StrAppendFmt(&output, "{^5}", str);- In
Io.Write.c:352:
StrAppendFmt(&output, "{} {} {}", hello, num, pi);
success = success && (ZstrCompare(StrBegin(&output), "Hello 42 3.140000") == 0);
StrClear(&output);
StrAppendFmt(&output, "{} {} {}", pi, hello, num);- In
Io.Write.c:373:
StrAppendFmt(&output, "{c}", mixed_case);
success = success && (ZstrCompare(StrBegin(&output), "MiXeD CaSe") == 0);
StrClear(&output);
StrAppendFmt(&output, "{a}", mixed_case);- In
Io.Write.c:377:
StrAppendFmt(&output, "{a}", mixed_case);
success = success && (ZstrCompare(StrBegin(&output), "mixed case") == 0);
StrClear(&output);
StrAppendFmt(&output, "{A}", mixed_case);- In
Io.Write.c:381:
StrAppendFmt(&output, "{A}", mixed_case);
success = success && (ZstrCompare(StrBegin(&output), "MIXED CASE") == 0);
StrClear(&output);
Str s = StrInitFromZstr("MiXeD CaSe", &alloc);- In
Io.Write.c:387:
StrAppendFmt(&output, "{c}", s);
success = success && (ZstrCompare(StrBegin(&output), "MiXeD CaSe") == 0);
StrClear(&output);
StrAppendFmt(&output, "{a}", s);- In
Io.Write.c:391:
StrAppendFmt(&output, "{a}", s);
success = success && (ZstrCompare(StrBegin(&output), "mixed case") == 0);
StrClear(&output);
StrAppendFmt(&output, "{A}", s);- In
Io.Write.c:395:
StrAppendFmt(&output, "{A}", s);
success = success && (ZstrCompare(StrBegin(&output), "MIXED CASE") == 0);
StrClear(&output);
u8 upper_char = 'M';- In
Io.Write.c:402:
StrAppendFmt(&output, "{c}", upper_char);
success = success && (ZstrCompare(StrBegin(&output), "M") == 0);
StrClear(&output);
StrAppendFmt(&output, "{a}", upper_char);- In
Io.Write.c:406:
StrAppendFmt(&output, "{a}", upper_char);
success = success && (ZstrCompare(StrBegin(&output), "m") == 0);
StrClear(&output);
StrAppendFmt(&output, "{A}", lower_char);- In
Io.Write.c:410:
StrAppendFmt(&output, "{A}", lower_char);
success = success && (ZstrCompare(StrBegin(&output), "M") == 0);
StrClear(&output);
u16 u16_value = ('A' << 8) | 'B'; // big-endian "AB"
- In
Io.Write.c:416:
StrAppendFmt(&output, "{c}", u16_value);
success = success && (StrLen(&output) == 2 && StrBegin(&output)[0] == 'A' && StrBegin(&output)[1] == 'B');
StrClear(&output);
StrAppendFmt(&output, "{a}", u16_value);- In
Io.Write.c:420:
StrAppendFmt(&output, "{a}", u16_value);
success = success && (StrLen(&output) == 2 && StrBegin(&output)[0] == 'a' && StrBegin(&output)[1] == 'b');
StrClear(&output);
StrAppendFmt(&output, "{A}", u16_value);- In
Io.Write.c:424:
StrAppendFmt(&output, "{A}", u16_value);
success = success && (StrLen(&output) == 2 && StrBegin(&output)[0] == 'A' && StrBegin(&output)[1] == 'B');
StrClear(&output);
i16 i16_value = ('C' << 8) | 'd'; // big-endian "Cd"
- In
Io.Write.c:430:
StrAppendFmt(&output, "{c}", i16_value);
success = success && (StrLen(&output) == 2 && StrBegin(&output)[0] == 'C' && StrBegin(&output)[1] == 'd');
StrClear(&output);
StrAppendFmt(&output, "{a}", i16_value);- In
Io.Write.c:434:
StrAppendFmt(&output, "{a}", i16_value);
success = success && (StrLen(&output) == 2 && StrBegin(&output)[0] == 'c' && StrBegin(&output)[1] == 'd');
StrClear(&output);
StrAppendFmt(&output, "{A}", i16_value);- In
Io.Write.c:438:
StrAppendFmt(&output, "{A}", i16_value);
success = success && (StrLen(&output) == 2 && StrBegin(&output)[0] == 'C' && StrBegin(&output)[1] == 'D');
StrClear(&output);
u32 u32_value = ('E' << 24) | ('f' << 16) | ('G' << 8) | 'h'; // big-endian "EfGh"
- In
Io.Write.c:445:
success = success && (StrLen(&output) == 4 && StrBegin(&output)[0] == 'E' && StrBegin(&output)[1] == 'f' &&
StrBegin(&output)[2] == 'G' && StrBegin(&output)[3] == 'h');
StrClear(&output);
StrAppendFmt(&output, "{a}", u32_value);- In
Io.Write.c:450:
success = success && (StrLen(&output) == 4 && StrBegin(&output)[0] == 'e' && StrBegin(&output)[1] == 'f' &&
StrBegin(&output)[2] == 'g' && StrBegin(&output)[3] == 'h');
StrClear(&output);
StrAppendFmt(&output, "{A}", u32_value);- In
Io.Write.c:455:
success = success && (StrLen(&output) == 4 && StrBegin(&output)[0] == 'E' && StrBegin(&output)[1] == 'F' &&
StrBegin(&output)[2] == 'G' && StrBegin(&output)[3] == 'H');
StrClear(&output);
i32 i32_value = ('I' << 24) | ('j' << 16) | ('K' << 8) | 'l'; // big-endian "IjKl"
- In
Io.Write.c:462:
success = success && (StrLen(&output) == 4 && StrBegin(&output)[0] == 'I' && StrBegin(&output)[1] == 'j' &&
StrBegin(&output)[2] == 'K' && StrBegin(&output)[3] == 'l');
StrClear(&output);
StrAppendFmt(&output, "{a}", i32_value);- In
Io.Write.c:467:
success = success && (StrLen(&output) == 4 && StrBegin(&output)[0] == 'i' && StrBegin(&output)[1] == 'j' &&
StrBegin(&output)[2] == 'k' && StrBegin(&output)[3] == 'l');
StrClear(&output);
StrAppendFmt(&output, "{A}", i32_value);- In
Io.Write.c:472:
success = success && (StrLen(&output) == 4 && StrBegin(&output)[0] == 'I' && StrBegin(&output)[1] == 'J' &&
StrBegin(&output)[2] == 'K' && StrBegin(&output)[3] == 'L');
StrClear(&output);
u64 u64_value = ((u64)'M' << 56) | ((u64)'n' << 48) | ((u64)'O' << 40) | ((u64)'p' << 32) | ('Q' << 24) |- In
Io.Write.c:481:
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);
StrAppendFmt(&output, "{a}", u64_value);- In
Io.Write.c:487:
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);
StrAppendFmt(&output, "{A}", u64_value);- In
Io.Write.c:493:
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);
i64 i64_value = ((i64)'U' << 56) | ((i64)'v' << 48) | ((i64)'W' << 40) | ((i64)'x' << 32) | ('Y' << 24) |- In
Io.Write.c:502:
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);
StrAppendFmt(&output, "{a}", i64_value);- In
Io.Write.c:508:
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);
StrAppendFmt(&output, "{A}", i64_value);- In
Io.Write.c:533:
StrAppendFmt(&output, "{}", bv1);
success = success && (ZstrCompare(StrBegin(&output), "10110") == 0);
StrClear(&output);
BitVec bv_empty = BitVecInit(alloc_base);- In
Io.Write.c:538:
StrAppendFmt(&output, "{}", bv_empty);
success = success && (StrLen(&output) == 0);
StrClear(&output);
BitVec bv2 = BitVecFromInteger(0xABCD, 16, alloc_base);- In
Io.Write.c:543:
StrAppendFmt(&output, "{x}", bv2);
success = success && (ZstrCompare(StrBegin(&output), "0xabcd") == 0);
StrClear(&output);
StrAppendFmt(&output, "{X}", bv2);- In
Io.Write.c:547:
StrAppendFmt(&output, "{X}", bv2);
success = success && (ZstrCompare(StrBegin(&output), "0xABCD") == 0);
StrClear(&output);
BitVec bv3 = BitVecFromInteger(0755, 10, alloc_base);- In
Io.Write.c:552:
StrAppendFmt(&output, "{o}", bv3);
success = success && (ZstrCompare(StrBegin(&output), "0o755") == 0);
StrClear(&output);
StrAppendFmt(&output, "{>10}", bv1);- In
Io.Write.c:556:
StrAppendFmt(&output, "{>10}", bv1);
success = success && (ZstrCompare(StrBegin(&output), " 10110") == 0);
StrClear(&output);
StrAppendFmt(&output, "{<10}", bv1);- In
Io.Write.c:560:
StrAppendFmt(&output, "{<10}", bv1);
success = success && (ZstrCompare(StrBegin(&output), "10110 ") == 0);
StrClear(&output);
StrAppendFmt(&output, "{^10}", bv1);- In
Io.Write.c:564:
StrAppendFmt(&output, "{^10}", bv1);
success = success && (ZstrCompare(StrBegin(&output), " 10110 ") == 0);
StrClear(&output);
BitVec bv_zero = BitVecFromInteger(0, 1, alloc_base);- In
Io.Write.c:569:
StrAppendFmt(&output, "{x}", bv_zero);
success = success && (ZstrCompare(StrBegin(&output), "0x0") == 0);
StrClear(&output);
StrAppendFmt(&output, "{o}", bv_zero);- In
Io.Write.c:573:
StrAppendFmt(&output, "{o}", bv_zero);
success = success && (ZstrCompare(StrBegin(&output), "0o0") == 0);
StrClear(&output);
BitVecDeinit(&bv1);- In
Io.Write.c:601:
StrAppendFmt(&output, "{}", big_dec);
success = success && (ZstrCompare(StrBegin(&output), "123456789012345678901234567890") == 0);
StrClear(&output);
StrAppendFmt(&output, "{x}", hex_val);- In
Io.Write.c:605:
StrAppendFmt(&output, "{x}", hex_val);
success = success && (ZstrCompare(StrBegin(&output), "deadbeefcafebabe1234") == 0);
StrClear(&output);
StrAppendFmt(&output, "{X}", hex_val);- In
Io.Write.c:609:
StrAppendFmt(&output, "{X}", hex_val);
success = success && (ZstrCompare(StrBegin(&output), "DEADBEEFCAFEBABE1234") == 0);
StrClear(&output);
StrAppendFmt(&output, "{b}", bin_val);- In
Io.Write.c:613:
StrAppendFmt(&output, "{b}", bin_val);
success = success && (ZstrCompare(StrBegin(&output), "10100011") == 0);
StrClear(&output);
StrAppendFmt(&output, "{o}", oct_val);- In
Io.Write.c:617:
StrAppendFmt(&output, "{o}", oct_val);
success = success && (ZstrCompare(StrBegin(&output), "755") == 0);
StrClear(&output);
StrAppendFmt(&output, "{>34}", big_dec);- In
Io.Write.c:645:
StrAppendFmt(&output, "{}", exact);
success = success && (ZstrCompare(StrBegin(&output), "1234567890.012345") == 0);
StrClear(&output);
StrAppendFmt(&output, "{e}", sci);- In
Io.Write.c:649:
StrAppendFmt(&output, "{e}", sci);
success = success && (ZstrCompare(StrBegin(&output), "1.234567e+04") == 0);
StrClear(&output);
StrAppendFmt(&output, "{E}", sci);- In
Io.Write.c:653:
StrAppendFmt(&output, "{E}", sci);
success = success && (ZstrCompare(StrBegin(&output), "1.234567E+04") == 0);
StrClear(&output);
StrAppendFmt(&output, "{.3}", short_v);- In
Io.Write.c:657:
StrAppendFmt(&output, "{.3}", short_v);
success = success && (ZstrCompare(StrBegin(&output), "1.200") == 0);
StrClear(&output);
StrAppendFmt(&output, "{>18}", sci);
Last updated on