VecAt
Description
Element at idx accessed by value. Use this rather than indexing data directly so the canonical element stride is used.
Parameters
| Name | Direction | Description |
|---|---|---|
v |
in | Vector to query. |
idx |
in | Index in [0, length). |
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Foreach.h:33:
if ((ValidateVec(UNPL(pv)), 1) && UNPL(pv)->length > 0) \
for (u64 idx = 0, UNPL(d) = 1; UNPL(d); UNPL(d)--) \
for (VEC_DATATYPE(UNPL(pv)) var = {0}; idx < UNPL(pv)->length && (var = VecAt(UNPL(pv), idx), 1); idx++)
///
- In
Foreach.h:59:
for (u64 idx = UNPL(pv)->length; idx-- > 0 && idx < UNPL(pv)->length;) \
for (u8 UNPL(run_once) = 1; UNPL(run_once); UNPL(run_once) = 0) \
for (VEC_DATATYPE(UNPL(pv)) var = VecAt(UNPL(pv), idx); UNPL(run_once); UNPL(run_once) = 0)
///
- In
Foreach.h:181:
UNPL(s) <= idx && idx < UNPL(e) && idx < UNPL(pv)->length && UNPL(s) <= UNPL(e); \
++idx, UNPL(d) = 1) \
for (VEC_DATATYPE(UNPL(pv)) var = VecAt(UNPL(pv), idx); UNPL(d); UNPL(d) = 0)
///
- In
Access.h:55:
/// TAGS: Vec, Access, First
///
#define VecFirst(v) VecAt(v, 0)
///
- In
Access.h:65:
/// TAGS: Vec, Access, Last
///
#define VecLast(v) VecAt(v, (v)->length - 1)
///
- In
Access.h:108:
/// TAGS: Str, Access, Index
///
#define StrCharAt(str, idx) VecAt(str, idx)
///
- In
VecInt.c:94:
uint16_t idx = extract_u16(data, offset, data_size);
if (idx < VecLen(vec)) {
volatile i32 value = VecAt(vec, idx);
(void)value; // Prevent optimization
}- In
VecCharPtr.c:126:
if (VecLen(vec) > 0 && *offset + 4 <= data_size) {
size_t index = extract_u32(data, offset, data_size) % VecLen(vec);
char *str = VecAt(vec, index);
(void)str; // Use the result to avoid warnings
}- In
VecCharPtr.c:179:
char *str = generate_cstring(data, offset, data_size, 16);
if (str) {
VecAt(vec, i) = (char *)ZstrDup(str, (Allocator *)alloc);
cleanup_cstring(str);
}- In
VecStr.c:148:
if (VecLen(vec) > 0 && *offset + 4 <= data_size) {
size_t index = extract_u32(data, offset, data_size) % VecLen(vec);
Str str = VecAt(vec, index);
(void)str; // Use the result to avoid warnings
}- In
VecStr.c:195:
for (size_t i = old_size; i < new_size; i++) {
Str str = generate_str_from_input(data, offset, data_size, 16, alloc);
VecAt(vec, i) = str;
}
}- In
Graph.c:200:
for (idx = 0; idx < VecLen(neighbors); idx++) {
if (VecAt(neighbors, idx) == node_id) {
return true;
}- In
Graph.c:212:
for (idx = 0; idx < VecLen(neighbors); idx++) {
if (VecAt(neighbors, idx) == node_id) {
return idx;
}- In
Graph.c:264:
while (idx < VecLen(neighbors)) {
GraphNodeId neighbor_id = VecAt(neighbors, idx);
const GenericGraphSlot *slot;- In
Graph.c:378:
for (neighbor_i = 0; neighbor_i < VecLen(&slot->out_neighbors); neighbor_i++) {
GraphNodeId neighbor_id = VecAt(&slot->out_neighbors, neighbor_i);
const GenericGraphSlot *target_slot;- In
Graph.c:389:
for (neighbor_i = 0; neighbor_i < VecLen(&slot->in_neighbors); neighbor_i++) {
GraphNodeId predecessor_id = VecAt(&slot->in_neighbors, neighbor_i);
const GenericGraphSlot *source_slot;- In
Graph.c:418:
for (free_index_i = 0; free_index_i < VecLen(&graph->free_indices); free_index_i++) {
u32 index = VecAt(&graph->free_indices, free_index_i);
if ((u64)index >= VecLen(&graph->slots)) {
LOG_FATAL("Graph free slot index out of bounds");- In
Graph.c:698:
}
return VecAt(neighbors, neighbor_idx);
}- In
Graph.c:712:
}
return VecAt(neighbors, predecessor_idx);
}- In
Graph.c:1027:
while (iter->neighbor_index < VecLen(neighbors)) {
GraphNodeId neighbor_id = VecAt(neighbors, iter->neighbor_index);
iter->neighbor_index += 1;- In
Graph.c:1074:
while (iter->predecessor_index < VecLen(neighbors)) {
GraphNodeId predecessor_id = VecAt(neighbors, iter->predecessor_index);
iter->predecessor_index += 1;- In
Dns.c:712:
bool have_one = ok && VecLen(&addrs) > 0;
if (have_one) {
*out = VecAt(&addrs, 0);
}
VecDeinit(&addrs);- In
Pdb.c:434:
if (!stream_read(self, DBI_STREAM_INDEX, sec_hdr_off, VecBegin(&sh), 2))
break;
r.section_hdr_stream = (u16)VecAt(&sh, 0) | (u16)VecAt(&sh, 1) << 8;
r.ok = true;
}- In
Dwarf.c:315:
u64 dir_off = 0;
if (st->file >= 1 && st->file - 1 < VecLen(&cs->file_offsets)) {
file_off = VecAt(&cs->file_offsets, st->file - 1);
u64 dir_idx = VecAt(&cs->file_dir_idx, st->file - 1);
if (dir_idx >= 1 && dir_idx - 1 < VecLen(&cs->dir_offsets)) {- In
Dwarf.c:316:
if (st->file >= 1 && st->file - 1 < VecLen(&cs->file_offsets)) {
file_off = VecAt(&cs->file_offsets, st->file - 1);
u64 dir_idx = VecAt(&cs->file_dir_idx, st->file - 1);
if (dir_idx >= 1 && dir_idx - 1 < VecLen(&cs->dir_offsets)) {
dir_off = VecAt(&cs->dir_offsets, dir_idx - 1);- In
Dwarf.c:318:
u64 dir_idx = VecAt(&cs->file_dir_idx, st->file - 1);
if (dir_idx >= 1 && dir_idx - 1 < VecLen(&cs->dir_offsets)) {
dir_off = VecAt(&cs->dir_offsets, dir_idx - 1);
}
}- In
Dwarf.c:641:
if (ok) {
for (u64 i = 0; i < VecLen(&out->entries); ++i) {
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;- In
Dwarf.c:642:
for (u64 i = 0; i < VecLen(&out->entries); ++i) {
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
Ops.c:54:
// Check that the elements were swapped
bool result = (VecAt(&vec, 0) == 50 && VecAt(&vec, 4) == 10);
// Swap two elements in the middle
- In
Ops.c:60:
// Check that the elements were swapped
result = result && (VecAt(&vec, 1) == 40 && VecAt(&vec, 3) == 20);
// Check that the middle element is unchanged
- In
Ops.c:63:
// Check that the middle element is unchanged
result = result && (VecAt(&vec, 2) == 30);
// Clean up
- In
Ops.c:91:
bool result = true;
for (size i = 0; i < VecLen(&vec); i++) {
result = result && (VecAt(&vec, i) == values[4 - i]);
}- In
Ops.c:99:
// Check that the elements are back in the original order
for (size i = 0; i < VecLen(&vec); i++) {
result = result && (VecAt(&vec, i) == values[i]);
}- In
Ops.c:114:
// Check that the elements are reversed
for (size i = 0; i < VecLen(&vec); i++) {
result = result && (VecAt(&vec, i) == even_values[3 - i]);
}- In
Ops.c:144:
int sorted_asc[] = {10, 20, 30, 40, 50};
for (size i = 0; i < VecLen(&vec); i++) {
result = result && (VecAt(&vec, i) == sorted_asc[i]);
}- In
Ops.c:153:
int sorted_desc[] = {50, 40, 30, 20, 10};
for (size i = 0; i < VecLen(&vec); i++) {
result = result && (VecAt(&vec, i) == sorted_desc[i]);
}- In
Complex.c:202:
// Check that the item was copied correctly
result = result && ComplexItemsEqual(&VecAt(&vec, 0), &item);
// Modify the original item and verify the vector's copy is independent
- In
Complex.c:210:
// The vector's copy should still have the original values
result = result && (ZstrCompare(VecAt(&vec, 0).name, "Test Item") == 0);
result = result && (VecAt(&vec, 0).values[0] == 1);- In
Complex.c:211:
// The vector's copy should still have the original values
result = result && (ZstrCompare(VecAt(&vec, 0).name, "Test Item") == 0);
result = result && (VecAt(&vec, 0).values[0] == 1);
// Clean up
- In
Complex.c:246:
// Check items order: item2, item1, item3
result = result && (ZstrCompare(VecAt(&vec, 0).name, "Item 2") == 0);
result = result && (ZstrCompare(VecAt(&vec, 1).name, "Item 1") == 0);
result = result && (ZstrCompare(VecAt(&vec, 2).name, "Item 3") == 0);- In
Complex.c:247:
// Check items order: item2, item1, item3
result = result && (ZstrCompare(VecAt(&vec, 0).name, "Item 2") == 0);
result = result && (ZstrCompare(VecAt(&vec, 1).name, "Item 1") == 0);
result = result && (ZstrCompare(VecAt(&vec, 2).name, "Item 3") == 0);- In
Complex.c:248:
result = result && (ZstrCompare(VecAt(&vec, 0).name, "Item 2") == 0);
result = result && (ZstrCompare(VecAt(&vec, 1).name, "Item 1") == 0);
result = result && (ZstrCompare(VecAt(&vec, 2).name, "Item 3") == 0);
// Check values
- In
Complex.c:251:
// Check values
result = result && (VecAt(&vec, 0).values[0] == 40);
result = result && (VecAt(&vec, 1).values[0] == 10);
result = result && (VecAt(&vec, 2).values[0] == 70);- In
Complex.c:252:
// Check values
result = result && (VecAt(&vec, 0).values[0] == 40);
result = result && (VecAt(&vec, 1).values[0] == 10);
result = result && (VecAt(&vec, 2).values[0] == 70);- In
Complex.c:253:
result = result && (VecAt(&vec, 0).values[0] == 40);
result = result && (VecAt(&vec, 1).values[0] == 10);
result = result && (VecAt(&vec, 2).values[0] == 70);
// Clean up
- In
Complex.c:294:
// Check items order: item2, item3, item1
result = result && (ZstrCompare(VecAt(&vec, 0).name, "Item 2") == 0);
result = result && (ZstrCompare(VecAt(&vec, 1).name, "Item 3") == 0);
result = result && (ZstrCompare(VecAt(&vec, 2).name, "Item 1") == 0);- In
Complex.c:295:
// Check items order: item2, item3, item1
result = result && (ZstrCompare(VecAt(&vec, 0).name, "Item 2") == 0);
result = result && (ZstrCompare(VecAt(&vec, 1).name, "Item 3") == 0);
result = result && (ZstrCompare(VecAt(&vec, 2).name, "Item 1") == 0);- In
Complex.c:296:
result = result && (ZstrCompare(VecAt(&vec, 0).name, "Item 2") == 0);
result = result && (ZstrCompare(VecAt(&vec, 1).name, "Item 3") == 0);
result = result && (ZstrCompare(VecAt(&vec, 2).name, "Item 1") == 0);
// Clean up
- In
Complex.c:338:
// Check items in vec1: item1, item2, item3
result = result && (ZstrCompare(VecAt(&vec1, 0).name, "Item 1") == 0);
result = result && (ZstrCompare(VecAt(&vec1, 1).name, "Item 2") == 0);
result = result && (ZstrCompare(VecAt(&vec1, 2).name, "Item 3") == 0);- In
Complex.c:339:
// Check items in vec1: item1, item2, item3
result = result && (ZstrCompare(VecAt(&vec1, 0).name, "Item 1") == 0);
result = result && (ZstrCompare(VecAt(&vec1, 1).name, "Item 2") == 0);
result = result && (ZstrCompare(VecAt(&vec1, 2).name, "Item 3") == 0);- In
Complex.c:340:
result = result && (ZstrCompare(VecAt(&vec1, 0).name, "Item 1") == 0);
result = result && (ZstrCompare(VecAt(&vec1, 1).name, "Item 2") == 0);
result = result && (ZstrCompare(VecAt(&vec1, 2).name, "Item 3") == 0);
// Now test VecMergeL which transfers ownership
- In
Complex.c:370:
// Check items in vec3: item4, item5
result = result && (ZstrCompare(VecAt(&vec3, 0).name, "Item 4") == 0);
result = result && (ZstrCompare(VecAt(&vec3, 1).name, "Item 5") == 0);- In
Complex.c:371:
// Check items in vec3: item4, item5
result = result && (ZstrCompare(VecAt(&vec3, 0).name, "Item 4") == 0);
result = result && (ZstrCompare(VecAt(&vec3, 1).name, "Item 5") == 0);
// Clean up
- In
Complex.c:409:
// Check items order: val2, val3, val1
result = result && (VecAt(&vec, 0) == 20);
result = result && (VecAt(&vec, 1) == 30);
result = result && (VecAt(&vec, 2) == 10);- In
Complex.c:410:
// Check items order: val2, val3, val1
result = result && (VecAt(&vec, 0) == 20);
result = result && (VecAt(&vec, 1) == 30);
result = result && (VecAt(&vec, 2) == 10);- In
Complex.c:411:
result = result && (VecAt(&vec, 0) == 20);
result = result && (VecAt(&vec, 1) == 30);
result = result && (VecAt(&vec, 2) == 10);
// Test array operations
- In
Complex.c:423:
// Check items: val2, val3, val1, arr[0], arr[1], arr[2]
result = result && (VecAt(&vec, 3) == 40);
result = result && (VecAt(&vec, 4) == 50);
result = result && (VecAt(&vec, 5) == 60);- In
Complex.c:424:
// Check items: val2, val3, val1, arr[0], arr[1], arr[2]
result = result && (VecAt(&vec, 3) == 40);
result = result && (VecAt(&vec, 4) == 50);
result = result && (VecAt(&vec, 5) == 60);- In
Complex.c:425:
result = result && (VecAt(&vec, 3) == 40);
result = result && (VecAt(&vec, 4) == 50);
result = result && (VecAt(&vec, 5) == 60);
// Clean up
- In
Complex.c:455:
// Check that the element was inserted
result = result && (VecAt(&vec, 2) == 99);
// Use regular insert range instead of fast insert range
- In
Complex.c:466:
// Check that the array was inserted
result = result && (VecAt(&vec, 1) == 100);
result = result && (VecAt(&vec, 2) == 200);
result = result && (VecAt(&vec, 3) == 300);- In
Complex.c:467:
// Check that the array was inserted
result = result && (VecAt(&vec, 1) == 100);
result = result && (VecAt(&vec, 2) == 200);
result = result && (VecAt(&vec, 3) == 300);- In
Complex.c:468:
result = result && (VecAt(&vec, 1) == 100);
result = result && (VecAt(&vec, 2) == 200);
result = result && (VecAt(&vec, 3) == 300);
// Clean up
- In
Complex.c:489:
result = result && (VecLen(&vec2) == 6);
result = result && (VecAt(&vec2, 2) == 42);
// Now try the range insert with a small array
- In
Complex.c:501:
// Check that the array was inserted
result = result && (VecAt(&vec2, 1) == 111);
result = result && (VecAt(&vec2, 2) == 222);- In
Complex.c:502:
// Check that the array was inserted
result = result && (VecAt(&vec2, 1) == 111);
result = result && (VecAt(&vec2, 2) == 222);
// Clean up
- In
Complex.c:529:
// Check that the element was deleted and elements shifted
result = result && (VecAt(&vec, 0) == 10);
result = result && (VecAt(&vec, 1) == 20);
result = result && (VecAt(&vec, 2) == 40); // 30 was deleted, so now 40 is at index 2
- In
Complex.c:530:
// Check that the element was deleted and elements shifted
result = result && (VecAt(&vec, 0) == 10);
result = result && (VecAt(&vec, 1) == 20);
result = result && (VecAt(&vec, 2) == 40); // 30 was deleted, so now 40 is at index 2
- In
Complex.c:531:
result = result && (VecAt(&vec, 0) == 10);
result = result && (VecAt(&vec, 1) == 20);
result = result && (VecAt(&vec, 2) == 40); // 30 was deleted, so now 40 is at index 2
// Test VecDeleteRange (regular delete range)
- In
Complex.c:540:
// Check that elements were deleted and remaining elements shifted
result = result && (VecAt(&vec, 0) == 40);
result = result && (VecAt(&vec, 1) == 50);- In
Complex.c:541:
// Check that elements were deleted and remaining elements shifted
result = result && (VecAt(&vec, 0) == 40);
result = result && (VecAt(&vec, 1) == 50);
// Clean up this vector
- In
Complex.c:560:
// Check that the element was deleted and replaced with the last element (90)
result = result && (VecAt(&vec, 0) == 10);
result = result && (VecAt(&vec, 1) == 20);
result = result && (VecAt(&vec, 2) == 90); // 30 was replaced with 90
- In
Complex.c:561:
// Check that the element was deleted and replaced with the last element (90)
result = result && (VecAt(&vec, 0) == 10);
result = result && (VecAt(&vec, 1) == 20);
result = result && (VecAt(&vec, 2) == 90); // 30 was replaced with 90
result = result && (VecAt(&vec, 7) == 80); // Last element is now 80
- In
Complex.c:562:
result = result && (VecAt(&vec, 0) == 10);
result = result && (VecAt(&vec, 1) == 20);
result = result && (VecAt(&vec, 2) == 90); // 30 was replaced with 90
result = result && (VecAt(&vec, 7) == 80); // Last element is now 80
- In
Complex.c:563:
result = result && (VecAt(&vec, 1) == 20);
result = result && (VecAt(&vec, 2) == 90); // 30 was replaced with 90
result = result && (VecAt(&vec, 7) == 80); // Last element is now 80
// Test VecDeleteRangeFast (fast delete range)
- In
Complex.c:593:
// Check that the element was deleted
result = result && (VecAt(&vec, 3) == 50); // 40 was deleted, so now 50 is at index 3
// Clean up
- In
Complex.c:611:
// Test pushing to empty vector
VecPushBackR(&vec, 10);
bool result = (VecLen(&vec) == 1 && VecAt(&vec, 0) == 10);
// Test pushing with zero count
- In
Complex.c:621:
// Test inserting at end index
VecInsertR(&vec, 20, VecLen(&vec));
result = result && (VecLen(&vec) == 2 && VecAt(&vec, 1) == 20);
// Test with large number of elements
- In
Complex.c:638:
bool all_correct = true;
for (int i = 0; i < large_count; i++) {
if (VecAt(&vec, i) != i) {
all_correct = false;
break;- In
Complex.c:655:
// Push an element (should auto-resize)
VecPushBackR(&vec, 42);
result = result && (VecLen(&vec) == 1 && VecAt(&vec, 0) == 42);
// Clean up
- In
Complex.c:918:
// Under the mutant src->length != 0 returns true immediately and dst is
// left empty (length 0).
bool result = (VecLen(&dst) == 3) && (VecAt(&dst, 0) == 1) && (VecAt(&dst, 1) == 2) && (VecAt(&dst, 2) == 3);
VecDeinit(&src);- In
Complex.c:944:
// Real: dst has all 3 elements starting at index 0. Mutant (init 42):
// 42 < 3 is false, loop skipped, dst length 0.
bool result = (VecLen(&dst) == 3) && (VecAt(&dst, 0) == 1);
VecDeinit(&src);- In
Complex.c:994:
// Real: dst length 3, all values present. Mutant (i--): dst length 1.
bool result = (VecLen(&dst) == 3) && (VecAt(&dst, 0) == 1) && (VecAt(&dst, 1) == 2) && (VecAt(&dst, 2) == 3);
VecDeinit(&src);- In
Memory.c:110:
// Check that the data is still intact
for (size i = 0; i < VecLen(&vec); i++) {
result = result && (VecAt(&vec, i) == values[i]);
}- In
Memory.c:147:
// First 3 elements should be unchanged
for (size i = 0; i < 3; i++) {
result = result && (VecAt(&vec, i) == values[i]);
}- In
Memory.c:158:
// First 3 elements should still be the same
for (size i = 0; i < 3; i++) {
result = result && (VecAt(&vec, i) == values[i]);
}- In
Memory.c:390:
VecResize(&vec, 8);
for (u64 i = 0; i < VecLen(&vec); i++) {
VecAt(&vec, i) = 0x11111111;
}- In
Memory.c:400:
// Live data below the old capacity is preserved; the probed grown slot must
// be zeroed by reserve_vec.
bool result = (VecAt(&vec, 0) == 0x11111111 && VecAt(&vec, probe_index) == 0);
VecDeinit(&vec);- In
Memory.c:565:
bool result = (VecLen(&vec) == N);
for (u32 i = 0; i < N; i++) {
result = result && (VecAt(&vec, i).tag == 100 + i);
}- In
Init.c:239:
VecPushBackR(&vec, 30);
if (VecLen(&vec) != 3 || VecAt(&vec, 0) != 10 || VecAt(&vec, 1) != 20 || VecAt(&vec, 2) != 30) {
result = false;
}- In
Init.c:256:
VecPushBackR(&test_vec, item);
if (VecLen(&test_vec) != 1 || VecAt(&test_vec, 0).id != 1 || VecAt(&test_vec, 0).value != 3.14f) {
result = false;
}- In
Init.c:274:
AlignedItem item = {.a = 7, .b = 2.71828};
VecPushBackR(&av, item);
if (VecLen(&av) != 1 || VecAt(&av, 0).a != 7 || VecAt(&av, 0).b != 2.71828) {
result = false;
}- In
Init.c:319:
if (result) {
for (size i = 0; i < VecLen(&src); i++) {
if (VecAt(&clone, i) != VecAt(&src, i)) {
result = false;
break;- In
Insert.c:97:
// Check elements in order
for (size i = 0; i < VecLen(&vec); i++) {
result = result && (VecAt(&vec, i) == values[i]);
}- In
Insert.c:125:
// Check elements in reverse order (since we pushed to front)
for (size i = 0; i < VecLen(&vec); i++) {
result = result && (VecAt(&vec, i) == values[4 - i]);
}- In
Insert.c:146:
// Check first element
bool result = (VecLen(&vec) == 1 && VecAt(&vec, 0) == 10);
// Insert at the end
- In
Insert.c:152:
// Check elements
result = result && (VecLen(&vec) == 2 && VecAt(&vec, 0) == 10 && VecAt(&vec, 1) == 30);
// Insert in the middle
- In
Insert.c:159:
// Check all elements
result = result && (VecLen(&vec) == 3);
result = result && (VecAt(&vec, 0) == 10);
result = result && (VecAt(&vec, 1) == 20);
result = result && (VecAt(&vec, 2) == 30);- In
Insert.c:160:
result = result && (VecLen(&vec) == 3);
result = result && (VecAt(&vec, 0) == 10);
result = result && (VecAt(&vec, 1) == 20);
result = result && (VecAt(&vec, 2) == 30);- In
Insert.c:161:
result = result && (VecAt(&vec, 0) == 10);
result = result && (VecAt(&vec, 1) == 20);
result = result && (VecAt(&vec, 2) == 30);
// Clean up
- In
Insert.c:186:
// Check elements in order
for (size i = 0; i < VecLen(&vec); i++) {
result = result && (VecAt(&vec, i) == values[i]);
}- In
Insert.c:198:
// Check all elements
for (size i = 0; i < 5; i++) {
result = result && (VecAt(&vec, i) == values[i]);
}
for (size i = 0; i < 3; i++) {- In
Insert.c:201:
}
for (size i = 0; i < 3; i++) {
result = result && (VecAt(&vec, i + 5) == more_values[i]);
}- In
Insert.c:227:
// Check elements in order
for (size i = 0; i < VecLen(&vec); i++) {
result = result && (VecAt(&vec, i) == values[i]);
}- In
Insert.c:239:
// Check all elements
for (size i = 0; i < 3; i++) {
result = result && (VecAt(&vec, i) == more_values[i]);
}
for (size i = 0; i < 5; i++) {- In
Insert.c:242:
}
for (size i = 0; i < 5; i++) {
result = result && (VecAt(&vec, i + 3) == values[i]);
}- In
Insert.c:275:
// Check all elements
for (size i = 0; i < VecLen(&vec); i++) {
result = result && (VecAt(&vec, i) == expected[i]);
}- In
Insert.c:312:
// Check all elements
for (size i = 0; i < VecLen(&vec); i++) {
result = result && (VecAt(&vec, i) == expected[i]);
}- In
Insert.c:353:
// Check all elements in vec1
for (size i = 0; i < VecLen(&vec1); i++) {
result = result && (VecAt(&vec1, i) == expected[i]);
}- In
Insert.c:399:
VecAllocator(&dst)->effort == ALLOCATOR_EFFORT_RETRY_FALLBACK &&
VecAllocator(&dst)->retry_limit == 11 && allocator_matches && VecLen(&src) == 3 &&
VecAt(&src, 0) == 10 && VecAt(&src, 1) == 20 && VecAt(&src, 2) == 30 && VecLen(&dst) == 3 &&
VecAt(&dst, 0) == 10 && VecAt(&dst, 1) == 20 && VecAt(&dst, 2) == 30;- In
Insert.c:400:
VecAllocator(&dst)->retry_limit == 11 && allocator_matches && VecLen(&src) == 3 &&
VecAt(&src, 0) == 10 && VecAt(&src, 1) == 20 && VecAt(&src, 2) == 30 && VecLen(&dst) == 3 &&
VecAt(&dst, 0) == 10 && VecAt(&dst, 1) == 20 && VecAt(&dst, 2) == 30;
VecDeinit(&src);- In
Insert.c:420:
// Check that the element was added
bool result = (VecLen(&vec) == 1 && VecAt(&vec, 0) == 42);
// Test L-value insert operations
- In
Insert.c:427:
// Check that the element was added
result = result && (VecLen(&vec) == 2 && VecAt(&vec, 1) == 100);
// Test R-value insert at index
- In
Insert.c:434:
// Check that the element was inserted
result = result && (VecLen(&vec) == 3);
result = result && (VecAt(&vec, 0) == 42);
result = result && (VecAt(&vec, 1) == 50);
result = result && (VecAt(&vec, 2) == 100);- In
Insert.c:435:
result = result && (VecLen(&vec) == 3);
result = result && (VecAt(&vec, 0) == 42);
result = result && (VecAt(&vec, 1) == 50);
result = result && (VecAt(&vec, 2) == 100);- In
Insert.c:436:
result = result && (VecAt(&vec, 0) == 42);
result = result && (VecAt(&vec, 1) == 50);
result = result && (VecAt(&vec, 2) == 100);
// Test L-value insert at index
- In
Insert.c:444:
// Check that the element was inserted
result = result && (VecLen(&vec) == 4);
result = result && (VecAt(&vec, 0) == 42);
result = result && (VecAt(&vec, 1) == 50);
result = result && (VecAt(&vec, 2) == 75);- In
Insert.c:445:
result = result && (VecLen(&vec) == 4);
result = result && (VecAt(&vec, 0) == 42);
result = result && (VecAt(&vec, 1) == 50);
result = result && (VecAt(&vec, 2) == 75);
result = result && (VecAt(&vec, 3) == 100);- In
Insert.c:446:
result = result && (VecAt(&vec, 0) == 42);
result = result && (VecAt(&vec, 1) == 50);
result = result && (VecAt(&vec, 2) == 75);
result = result && (VecAt(&vec, 3) == 100);- In
Insert.c:447:
result = result && (VecAt(&vec, 1) == 50);
result = result && (VecAt(&vec, 2) == 75);
result = result && (VecAt(&vec, 3) == 100);
// Test R-value fast insert
- In
Insert.c:454:
// Check that the element was inserted
result = result && (VecLen(&vec) == 5);
result = result && (VecAt(&vec, 1) == 60);
// Test L-value fast insert
- In
Insert.c:462:
// Check that the element was inserted
result = result && (VecLen(&vec) == 6);
result = result && (VecAt(&vec, 3) == 80);
// Test array operations with L-values and R-values
- In
Insert.c:472:
// Check that the elements were added
result = result && (VecLen(&vec) == 9);
result = result && (VecAt(&vec, 6) == 200);
result = result && (VecAt(&vec, 7) == 300);
result = result && (VecAt(&vec, 8) == 400);- In
Insert.c:473:
result = result && (VecLen(&vec) == 9);
result = result && (VecAt(&vec, 6) == 200);
result = result && (VecAt(&vec, 7) == 300);
result = result && (VecAt(&vec, 8) == 400);- In
Insert.c:474:
result = result && (VecAt(&vec, 6) == 200);
result = result && (VecAt(&vec, 7) == 300);
result = result && (VecAt(&vec, 8) == 400);
// L-value array operations
- In
Insert.c:481:
// Check that the elements were added
result = result && (VecLen(&vec) == 12);
result = result && (VecAt(&vec, 0) == 200);
result = result && (VecAt(&vec, 1) == 300);
result = result && (VecAt(&vec, 2) == 400);- In
Insert.c:482:
result = result && (VecLen(&vec) == 12);
result = result && (VecAt(&vec, 0) == 200);
result = result && (VecAt(&vec, 1) == 300);
result = result && (VecAt(&vec, 2) == 400);- In
Insert.c:483:
result = result && (VecAt(&vec, 0) == 200);
result = result && (VecAt(&vec, 1) == 300);
result = result && (VecAt(&vec, 2) == 400);
// Clean up
- In
Insert.c:593:
for (size i = 0; i < idx; i++) {
result = result && (VecAt(&vec, i) == originals[i]);
}- In
Insert.c:597:
for (size i = 0; i < new_count; i++) {
result = result && (VecAt(&vec, idx + i) == new_items[i]);
}- In
Insert.c:608:
bool found = false;
for (size j = tail_start; j < tail_end; j++) {
if (VecAt(&vec, j) == originals[i]) {
found = true;
break;- In
Insert.c:748:
bool result = ok && (VecLen(&vec) == 16) && (VecCapacity(&vec) >= 16);
for (int i = 0; i < 8; i++) {
result = result && (VecAt(&vec, (size)i) == i);
}
// Appended items occupy the new tail [8, 16).
- In
Insert.c:755:
bool found = false;
for (size j = 8; j < VecLen(&vec); j++) {
if (VecAt(&vec, j) == v) {
found = true;
break;- In
Insert.c:795:
bool result = ok && (VecLen(&vec) == 10) && (VecCapacity(&vec) > 10);
for (int i = 0; i < 5; i++) {
result = result && (VecAt(&vec, (size)i) == i);
}- In
Insert.c:818:
bool result = ok && (VecLen(&vec) == 8) && (VecCapacity(&vec) >= 8);
for (size i = 0; i < 8; i++) {
result = result && (VecAt(&vec, i) == add[i]);
}- In
Insert.c:843:
bool result = ok && (VecLen(&vec) == 10) && (VecCapacity(&vec) >= 10);
for (size i = 0; i < 10; i++) {
result = result && (VecAt(&vec, i) == add[i]);
}- In
Insert.c:876:
bool result = ok && (VecLen(&vec) == 6);
// Prefix [0,1) intact, inserted block at [1,3).
result = result && (VecAt(&vec, 0).value == 10);
result = result && (VecAt(&vec, 1).value == 100);
result = result && (VecAt(&vec, 2).value == 200);- In
Insert.c:877:
// Prefix [0,1) intact, inserted block at [1,3).
result = result && (VecAt(&vec, 0).value == 10);
result = result && (VecAt(&vec, 1).value == 100);
result = result && (VecAt(&vec, 2).value == 200);
// Displaced originals {11,12} must appear somewhere in the new tail [3,6).
- In
Insert.c:878:
result = result && (VecAt(&vec, 0).value == 10);
result = result && (VecAt(&vec, 1).value == 100);
result = result && (VecAt(&vec, 2).value == 200);
// Displaced originals {11,12} must appear somewhere in the new tail [3,6).
for (int v = 11; v <= 12; v++) {- In
Insert.c:883:
bool found = false;
for (size j = 3; j < VecLen(&vec); j++) {
if (VecAt(&vec, j).value == v) {
found = true;
break;- In
Insert.c:893:
bool found13 = false;
for (size j = 3; j < VecLen(&vec); j++) {
if (VecAt(&vec, j).value == 13) {
found13 = true;
break;- In
Insert.c:939:
bool result = ok && (VecLen(&vec) == 2 * N);
// The new block occupies the front [0, N).
result = result && (VecAt(&vec, 0).value == 1000000);
// Every displaced original must still be present somewhere in the tail.
result = result && (VecAt(&vec, N).value >= 0);- In
Insert.c:941:
result = result && (VecAt(&vec, 0).value == 1000000);
// Every displaced original must still be present somewhere in the tail.
result = result && (VecAt(&vec, N).value >= 0);
VecDeinit(&ins);- In
Insert.c:968:
bool result = ok && (VecLen(&vec) == 6);
// Prefix [0,2) must be the original 10,11.
result = result && (VecAt(&vec, 0).value == 10);
result = result && (VecAt(&vec, 1).value == 11);
// Inserted block correct.
- In
Insert.c:969:
// Prefix [0,2) must be the original 10,11.
result = result && (VecAt(&vec, 0).value == 10);
result = result && (VecAt(&vec, 1).value == 11);
// Inserted block correct.
result = result && (VecAt(&vec, 2).value == 100);- In
Insert.c:971:
result = result && (VecAt(&vec, 1).value == 11);
// Inserted block correct.
result = result && (VecAt(&vec, 2).value == 100);
result = result && (VecAt(&vec, 3).value == 200);- In
Insert.c:972:
// Inserted block correct.
result = result && (VecAt(&vec, 2).value == 100);
result = result && (VecAt(&vec, 3).value == 200);
VecDeinit(&vec);- In
Insert.c:997:
bool result = ok && (VecLen(&vec) == 6);
result = result && (VecAt(&vec, 2).value == 100);
result = result && (VecAt(&vec, 3).value == 200);
// Prefix [0,2) intact.
- In
Insert.c:998:
bool result = ok && (VecLen(&vec) == 6);
result = result && (VecAt(&vec, 2).value == 100);
result = result && (VecAt(&vec, 3).value == 200);
// Prefix [0,2) intact.
result = result && (VecAt(&vec, 0).value == 10);- In
Insert.c:1000:
result = result && (VecAt(&vec, 3).value == 200);
// Prefix [0,2) intact.
result = result && (VecAt(&vec, 0).value == 10);
result = result && (VecAt(&vec, 1).value == 11);- In
Insert.c:1001:
// Prefix [0,2) intact.
result = result && (VecAt(&vec, 0).value == 10);
result = result && (VecAt(&vec, 1).value == 11);
VecDeinit(&vec);- In
Insert.c:1028:
bool result = ok && (VecLen(&vec) == 5);
result = result && (VecAt(&vec, 1).value == 100);
result = result && (VecAt(&vec, 2).value == 200);
result = result && (VecAt(&vec, 3).value == 300);- In
Insert.c:1029:
bool result = ok && (VecLen(&vec) == 5);
result = result && (VecAt(&vec, 1).value == 100);
result = result && (VecAt(&vec, 2).value == 200);
result = result && (VecAt(&vec, 3).value == 300);- In
Insert.c:1030:
result = result && (VecAt(&vec, 1).value == 100);
result = result && (VecAt(&vec, 2).value == 200);
result = result && (VecAt(&vec, 3).value == 300);
VecDeinit(&vec);- In
Insert.c:1057:
bool result = (ok == false) && (g_deinit_count == 0) && (VecLen(&vec) == 4);
// Originals fully intact after rollback.
result = result && (VecAt(&vec, 0).value == 10);
result = result && (VecAt(&vec, 3).value == 13);- In
Insert.c:1058:
// Originals fully intact after rollback.
result = result && (VecAt(&vec, 0).value == 10);
result = result && (VecAt(&vec, 3).value == 13);
g_fail_at = 0; // let VecDeinit clean up the live originals
- In
Insert.c:1256:
// Original elements must all be present and unchanged after rollback.
for (size i = 0; i < 5; i++) {
result = result && (VecAt(&vec, i).value == 10 + (int)i);
result = result && VecAt(&vec, i).live;
}- In
Insert.c:1257:
for (size i = 0; i < 5; i++) {
result = result && (VecAt(&vec, i).value == 10 + (int)i);
result = result && VecAt(&vec, i).live;
}- In
Insert.c:1284:
bool result = (ok == false) && (VecLen(&vec) == 5);
for (size i = 0; i < 5; i++) {
result = result && (VecAt(&vec, i).value == 20 + (int)i);
result = result && VecAt(&vec, i).live;
}- In
Insert.c:1285:
for (size i = 0; i < 5; i++) {
result = result && (VecAt(&vec, i).value == 20 + (int)i);
result = result && VecAt(&vec, i).live;
}- In
Insert.c:1316:
bool result = (ok == false) && (VecLen(&vec) == 6);
for (size i = 0; i < 6; i++) {
result = result && (VecAt(&vec, i).value == 30 + (int)i);
result = result && VecAt(&vec, i).live;
}- In
Insert.c:1317:
for (size i = 0; i < 6; i++) {
result = result && (VecAt(&vec, i).value == 30 + (int)i);
result = result && VecAt(&vec, i).live;
}- In
Insert.c:1439:
bool ret = VecInsertRangeR(&vec, &newv, 0, 1);
bool result = ret && (VecLen(&vec) == 4) && (VecAt(&vec, 0) == 99) && (VecAt(&vec, 1) == 10) &&
(VecAt(&vec, 2) == 20) && (VecAt(&vec, 3) == 30);- In
Insert.c:1440:
bool result = ret && (VecLen(&vec) == 4) && (VecAt(&vec, 0) == 99) && (VecAt(&vec, 1) == 10) &&
(VecAt(&vec, 2) == 20) && (VecAt(&vec, 3) == 30);
VecDeinit(&vec);- In
Insert.c:1459:
// The original at index 0 (11) must survive at index 1 after the insert.
bool result = ret && (VecLen(&vec) == 4) && (VecAt(&vec, 0) == 77) && (VecAt(&vec, 1) == 11);
VecDeinit(&vec);- In
Insert.c:1482:
bool ret = VecInsertRangeR(&vec, &newv, N - 1, 1); // insert just before the last element
bool result = ret && (VecLen(&vec) == N + 1) && (VecAt(&vec, 0) == 0) && (VecAt(&vec, N - 2) == (u64)(N - 2)) &&
(VecAt(&vec, N - 1) == 999999) && (VecAt(&vec, N) == (u64)(N - 1));- In
Insert.c:1483:
bool result = ret && (VecLen(&vec) == N + 1) && (VecAt(&vec, 0) == 0) && (VecAt(&vec, N - 2) == (u64)(N - 2)) &&
(VecAt(&vec, N - 1) == 999999) && (VecAt(&vec, N) == (u64)(N - 1));
VecDeinit(&vec);- In
Insert.c:1617:
bool result = (ret == false) && (ti_deinit_count == 2) && deinit_tags_contain(100) && deinit_tags_contain(101) &&
!deinit_tags_contain(1) && (VecLen(&vec) == 1) && (VecAt(&vec, 0).tag == 1);
VecDeinit(&vec);- In
Insert.c:1658:
bool ret = VecInsertRangeR(&vec, &it, 1, 1);
bool result = (ret == false) && (VecLen(&vec) == 3) && (VecAt(&vec, 0).tag == 1) && (VecAt(&vec, 1).tag == 2) &&
(VecAt(&vec, 2).tag == 3);- In
Insert.c:1659:
bool result = (ret == false) && (VecLen(&vec) == 3) && (VecAt(&vec, 0).tag == 1) && (VecAt(&vec, 1).tag == 2) &&
(VecAt(&vec, 2).tag == 3);
VecDeinit(&vec);- In
Insert.c:1677:
bool ret = VecInsertRangeR(&vec, &it, 1, 1);
bool result = (ret == false) && (VecLen(&vec) == 3) && (VecAt(&vec, 0).tag == 1) && (VecAt(&vec, 1).tag == 2) &&
(VecAt(&vec, 2).tag == 3);- In
Insert.c:1678:
bool result = (ret == false) && (VecLen(&vec) == 3) && (VecAt(&vec, 0).tag == 1) && (VecAt(&vec, 1).tag == 2) &&
(VecAt(&vec, 2).tag == 3);
VecDeinit(&vec);- In
Insert.c:1704:
bool ret = VecInsertRangeR(&vec, &it, N - 1, 1);
bool result = (ret == false) && (VecLen(&vec) == N) && (VecAt(&vec, 0).tag == 1) &&
(VecAt(&vec, N - 2).tag == (int)(N - 1)) && (VecAt(&vec, N - 1).tag == (int)N);- In
Insert.c:1705:
bool result = (ret == false) && (VecLen(&vec) == N) && (VecAt(&vec, 0).tag == 1) &&
(VecAt(&vec, N - 2).tag == (int)(N - 1)) && (VecAt(&vec, N - 1).tag == (int)N);
VecDeinit(&vec);- In
Insert.c:1724:
bool ret = VecInsertRangeR(&vec, &it, 1, 1);
bool result = (ret == false) && (VecLen(&vec) == 3) && (VecAt(&vec, 0).tag == 1) && (VecAt(&vec, 1).tag == 2) &&
(VecAt(&vec, 2).tag == 3);- In
Insert.c:1725:
bool result = (ret == false) && (VecLen(&vec) == 3) && (VecAt(&vec, 0).tag == 1) && (VecAt(&vec, 1).tag == 2) &&
(VecAt(&vec, 2).tag == 3);
VecDeinit(&vec);- In
Insert.c:1748:
bool result =
ok && (VecLen(&vec) == 3) && (VecAt(&vec, 0) == 111u) && (VecAt(&vec, 1) == 222u) && (VecAt(&vec, 2) == 333u);
VecDeinit(&vec);- In
Insert.c:1770:
// check is valid here.
bool result =
ok && (VecLen(&vec) == 3) && (VecAt(&vec, 0) == 444u) && (VecAt(&vec, 1) == 555u) && (VecAt(&vec, 2) == 666u);
VecDeinit(&vec);- In
Insert.c:1789:
bool ok = VecInsertL(&vec, val, 0);
bool result = ok && (VecLen(&vec) == 1) && (VecAt(&vec, 0) == 777u);
VecDeinit(&vec);- In
Insert.c:1923:
// Originals fully intact after rollback.
result = result && (VecAt(&vec, 0).value == 10);
result = result && (VecAt(&vec, 1).value == 11);
result = result && (VecAt(&vec, 2).value == 12);- In
Insert.c:1924:
// Originals fully intact after rollback.
result = result && (VecAt(&vec, 0).value == 10);
result = result && (VecAt(&vec, 1).value == 11);
result = result && (VecAt(&vec, 2).value == 12);
result = result && (VecAt(&vec, 3).value == 13);- In
Insert.c:1925:
result = result && (VecAt(&vec, 0).value == 10);
result = result && (VecAt(&vec, 1).value == 11);
result = result && (VecAt(&vec, 2).value == 12);
result = result && (VecAt(&vec, 3).value == 13);- In
Insert.c:1926:
result = result && (VecAt(&vec, 1).value == 11);
result = result && (VecAt(&vec, 2).value == 12);
result = result && (VecAt(&vec, 3).value == 13);
// The two slots one-past-end (the vacated tail) must be zeroed. Under the
- In
Insert.c:1930:
// The two slots one-past-end (the vacated tail) must be zeroed. Under the
// mutant they retain stale copies of the shifted originals (non-zero).
result = result && (VecAt(&vec, 4).value == 0);
result = result && (VecAt(&vec, 5).value == 0);- In
Insert.c:1931:
// mutant they retain stale copies of the shifted originals (non-zero).
result = result && (VecAt(&vec, 4).value == 0);
result = result && (VecAt(&vec, 5).value == 0);
g_fail_at = 0; // let VecDeinit run copy_deinit on the live originals
- In
Insert.c:1971:
bool found100 = false, found101 = false, found102 = false, found103 = false;
for (size i = 0; i < VecLen(&vec); i++) {
u64 v = (u64)VecAt(&vec, i).value;
found100 = found100 || (v == 100);
found101 = found101 || (v == 101);- In
Insert.c:1981:
// The two parked slots one-past-end must be zeroed; the mutant leaves
// stale displaced copies there.
result = result && (VecAt(&vec, 4).value == 0);
result = result && (VecAt(&vec, 5).value == 0);- In
Insert.c:1982:
// stale displaced copies there.
result = result && (VecAt(&vec, 4).value == 0);
result = result && (VecAt(&vec, 5).value == 0);
g_fail_at = 0;- In
Remove.c:146:
// Check remaining elements
for (u64 i = 0; i < VecLen(&vec); i++) {
result = result && (VecAt(&vec, i) == values[i]);
}- In
Remove.c:194:
// Check remaining elements
for (u64 i = 0; i < VecLen(&vec); i++) {
result = result && (VecAt(&vec, i) == values[i + 1]);
}- In
Remove.c:239:
int expected1[] = {10, 20, 40, 50};
for (u64 i = 0; i < VecLen(&vec); i++) {
result = result && (VecAt(&vec, i) == expected1[i]);
}- In
Remove.c:251:
int expected2[] = {20, 40, 50};
for (u64 i = 0; i < VecLen(&vec); i++) {
result = result && (VecAt(&vec, i) == expected2[i]);
}- In
Remove.c:288:
int expected[] = {10, 50, 30, 40};
for (u64 i = 0; i < VecLen(&vec); i++) {
result = result && (VecAt(&vec, i) == expected[i]);
}- In
Remove.c:324:
int expected[] = {10, 20, 60, 70};
for (u64 i = 0; i < VecLen(&vec); i++) {
result = result && (VecAt(&vec, i) == expected[i]);
}- In
Remove.c:353:
WriteFmt("Before fast range delete: ");
for (u64 i = 0; i < VecLen(&vec); i++) {
WriteFmt("{} ", VecAt(&vec, i));
}
WriteFmt("\n");- In
Remove.c:364:
int end_values[3];
for (int i = 0; i < count; i++) {
end_values[i] = VecAt(&vec, VecLen(&vec) - count + i);
}- In
Remove.c:372:
WriteFmt("After fast range delete: ");
for (u64 i = 0; i < VecLen(&vec); i++) {
WriteFmt("{} ", VecAt(&vec, i));
}
WriteFmt("\n");- In
Remove.c:381:
// Check that the last 3 elements moved to the deleted positions
for (int i = 0; i < count; i++) {
result = result && (VecAt(&vec, start_index + i) == end_values[i]);
}- In
Remove.c:387:
bool values_found[10] = {false};
for (u64 i = 0; i < VecLen(&vec); i++) {
int val = VecAt(&vec, i);
int index = val / 10;
if (index >= 0 && index < 10) {- In
Remove.c:435:
// Check remaining elements
for (u64 i = 0; i < VecLen(&vec); i++) {
result = result && (VecAt(&vec, i) == values[i]);
}- In
Remove.c:446:
// Check remaining elements
for (u64 i = 0; i < VecLen(&vec); i++) {
result = result && (VecAt(&vec, i) == values[i]);
}- In
Remove.c:482:
int expected[] = {10, 20, 40, 50};
for (u64 i = 0; i < VecLen(&vec); i++) {
result = result && (VecAt(&vec, i) == expected[i]);
}- In
Remove.c:517:
int expected[] = {10, 20, 40, 50};
for (u64 i = 0; i < VecLen(&vec); i++) {
result = result && (VecAt(&vec, i) == expected[i]);
}- In
Remove.c:546:
WriteFmt("Before L-value fast delete: ");
for (u64 i = 0; i < VecLen(&vec); i++) {
WriteFmt("{} ", VecAt(&vec, i));
}
WriteFmt("\n");- In
Remove.c:552:
// Test L-value fast delete operation
int fast_index = 2; // Delete 30
int valueToBeDeleted = VecAt(&vec, fast_index);
int lastValue = VecAt(&vec, VecLen(&vec) - 1); // Should move to deleted position
VecDeleteFast(&vec, fast_index);- In
Remove.c:553:
int fast_index = 2; // Delete 30
int valueToBeDeleted = VecAt(&vec, fast_index);
int lastValue = VecAt(&vec, VecLen(&vec) - 1); // Should move to deleted position
VecDeleteFast(&vec, fast_index);- In
Remove.c:559:
WriteFmt("After L-value fast delete: ");
for (u64 i = 0; i < VecLen(&vec); i++) {
WriteFmt("{} ", VecAt(&vec, i));
}
WriteFmt("\n");- In
Remove.c:569:
bool containsValue = false;
for (u64 i = 0; i < VecLen(&vec); i++) {
if (VecAt(&vec, i) == valueToBeDeleted) {
containsValue = true;
break;- In
Remove.c:577:
// Check that the value at the deleted position is now the last value
result = result && (VecAt(&vec, fast_index) == lastValue);
WriteFmtLn(
"Value at deleted position ({}) is now {} (expected {})\n",- In
Remove.c:581:
"Value at deleted position ({}) is now {} (expected {})\n",
fast_index,
VecAt(&vec, fast_index),
lastValue
);- In
Remove.c:590:
bool found = false;
for (u64 j = 0; j < VecLen(&vec); j++) {
if (VecAt(&vec, j) == expected_values[i]) {
found = true;
break;- In
Remove.c:627:
WriteFmt("Before R-value fast delete: ");
for (u64 i = 0; i < VecLen(&vec); i++) {
WriteFmt("{} ", VecAt(&vec, i));
}
WriteFmt("\n");- In
Remove.c:632:
// Remember the value to be deleted and the last value
int valueToBeDeleted = VecAt(&vec, 2); // 30
int lastValue = VecAt(&vec, VecLen(&vec) - 1); // Should move to deleted position
- In
Remove.c:633:
// Remember the value to be deleted and the last value
int valueToBeDeleted = VecAt(&vec, 2); // 30
int lastValue = VecAt(&vec, VecLen(&vec) - 1); // Should move to deleted position
// Test R-value fast delete operation
- In
Remove.c:641:
WriteFmt("After R-value fast delete: ");
for (u64 i = 0; i < VecLen(&vec); i++) {
WriteFmt("{} ", VecAt(&vec, i));
}
WriteFmt("\n");- In
Remove.c:651:
bool containsValue = false;
for (u64 i = 0; i < VecLen(&vec); i++) {
if (VecAt(&vec, i) == valueToBeDeleted) {
containsValue = true;
break;- In
Remove.c:659:
// Check that the value at the deleted position is now the last value
result = result && (VecAt(&vec, 2) == lastValue);
WriteFmtLn("Value at deleted position (2) is now {} (expected {})\n", VecAt(&vec, 2), lastValue);- In
Remove.c:660:
// Check that the value at the deleted position is now the last value
result = result && (VecAt(&vec, 2) == lastValue);
WriteFmtLn("Value at deleted position (2) is now {} (expected {})\n", VecAt(&vec, 2), lastValue);
// Verify all expected values (except the deleted one and the moved one) are still present
- In
Remove.c:667:
bool found = false;
for (u64 j = 0; j < VecLen(&vec); j++) {
if (VecAt(&vec, j) == expected_values[i]) {
found = true;
break;- In
Remove.c:712:
int expected[] = {10, 20, 60, 70};
for (u64 i = 0; i < VecLen(&vec); i++) {
result = result && (VecAt(&vec, i) == expected[i]);
}- In
Remove.c:747:
int expected[] = {10, 20, 60, 70};
for (u64 i = 0; i < VecLen(&vec); i++) {
result = result && (VecAt(&vec, i) == expected[i]);
}- In
Remove.c:776:
WriteFmt("Before L-value fast range delete: ");
for (u64 i = 0; i < VecLen(&vec); i++) {
WriteFmt("{} ", VecAt(&vec, i));
}
WriteFmt("\n");- In
Remove.c:791:
WriteFmt("After L-value fast range delete: ");
for (u64 i = 0; i < VecLen(&vec); i++) {
WriteFmt("{} ", VecAt(&vec, i));
}
WriteFmt("\n");- In
Remove.c:802:
bool found = false;
for (u64 j = 0; j < VecLen(&vec); j++) {
if (VecAt(&vec, j) == valuesToDelete[i]) {
found = true;
break;- In
Remove.c:818:
bool found = false;
for (u64 j = 0; j < VecLen(&vec); j++) {
if (VecAt(&vec, j) == remainingValues[i]) {
found = true;
break;- In
Remove.c:855:
WriteFmt("Before R-value fast range delete: ");
for (u64 i = 0; i < VecLen(&vec); i++) {
WriteFmt("{} ", VecAt(&vec, i));
}
WriteFmt("\n");- In
Remove.c:868:
WriteFmt("After R-value fast range delete: ");
for (u64 i = 0; i < VecLen(&vec); i++) {
WriteFmt("{} ", VecAt(&vec, i));
}
WriteFmt("\n");- In
Remove.c:879:
bool found = false;
for (u64 j = 0; j < VecLen(&vec); j++) {
if (VecAt(&vec, j) == valuesToDelete[i]) {
found = true;
break;- In
Remove.c:895:
bool found = false;
for (u64 j = 0; j < VecLen(&vec); j++) {
if (VecAt(&vec, j) == remainingValues[i]) {
found = true;
break;- In
Remove.c:1265:
VecDeleteRange(&vec, 20000, 2);
bool result = (VecLen(&vec) == (u64)(N - 2)) && (VecAt(&vec, 0) == 0) && (VecAt(&vec, 19999) == 19999) &&
(VecAt(&vec, 20000) == 20002);- In
Remove.c:1266:
bool result = (VecLen(&vec) == (u64)(N - 2)) && (VecAt(&vec, 0) == 0) && (VecAt(&vec, 19999) == 19999) &&
(VecAt(&vec, 20000) == 20002);
VecDeinit(&vec);- In
Remove.c:1289:
VecDeleteRange(&vec, 0, K);
bool result = (VecLen(&vec) == (u64)N - K) && (VecAt(&vec, 0) == (int)K) && (VecAt(&vec, 19999) == (int)(N - 1));
VecDeinit(&vec);- In
Remove.c:1309:
VecDeleteRange(&vec, 1, 2); // real move ~ (N-3)*4 bytes; mutant ~ (N-3)*42 (~1.5 MB)
bool result = (VecLen(&vec) == (u64)(N - 2)) && (VecAt(&vec, 0) == 0) && (VecAt(&vec, 1) == 3) &&
(VecAt(&vec, (u64)(N - 3)) == (int)(N - 1));- In
Remove.c:1310:
bool result = (VecLen(&vec) == (u64)(N - 2)) && (VecAt(&vec, 0) == 0) && (VecAt(&vec, 1) == 3) &&
(VecAt(&vec, (u64)(N - 3)) == (int)(N - 1));
VecDeinit(&vec);- In
Remove.c:1372:
VecDeleteRange(&vec, 0, K); // length becomes N-K
bool result = (VecLen(&vec) == (u64)N - K) && (VecAt(&vec, 0) == (int)K);
VecDeinit(&vec);- In
Remove.c:1419:
bool result = (VecLen(&vec) == old_len - 1);
// Surviving prefix is intact (the real path moved nothing).
result = result && (VecAt(&vec, 0) == 1);
result = result && (VecAt(&vec, old_len - 2) == (u64)(old_len - 1));- In
Remove.c:1420:
// Surviving prefix is intact (the real path moved nothing).
result = result && (VecAt(&vec, 0) == 1);
result = result && (VecAt(&vec, old_len - 2) == (u64)(old_len - 1));
VecDeinit(&vec);- In
Remove.c:1456:
bool result = (VecLen(&vec) == 1);
// The single survivor is the original last element.
result = result && (VecAt(&vec, 0) == (u64)old_len);
VecDeinit(&vec);- In
Foreach.c:60:
// Check that the values in the vector are unchanged (foreach uses value, not reference)
for (u64 i = 0; i < VecLen(&vec); i++) {
result = result && (VecAt(&vec, i) == values[i]);
}- In
Foreach.c:127:
bool result = true;
for (u64 i = 0; i < VecLen(&vec); i++) {
result = result && (VecAt(&vec, i) == values[i] * 2);
}- In
Foreach.c:168:
bool result = true;
for (u64 i = 0; i < VecLen(&vec); i++) {
result = result && (VecAt(&vec, i) == i);
}- In
Foreach.c:228:
VecForeachReverseIdx(&vec, item, idx) {
result = result && (item == values[idx]);
result = result && (VecAt(&vec, idx) == item);
}- In
Foreach.c:262:
bool result = true;
for (size i = 0; i < VecLen(&vec); i++) {
result = result && (VecAt(&vec, i) == expected[i]);
}- In
Foreach.c:297:
bool result = true;
for (size i = 0; i < VecLen(&vec); i++) {
result = result && (VecAt(&vec, i) == expected[i]);
}- In
Access.c:30:
// Test VecAt function
bool test_vec_at(void) {
WriteFmt("Testing VecAt\n");
DefaultAllocator alloc = DefaultAllocatorInit();- In
Access.c:46:
// Check values using VecAt
bool result = (VecAt(&vec, 0) == 10);
result = result && (VecAt(&vec, 1) == 20);
result = result && (VecAt(&vec, 2) == 30);- In
Access.c:47:
// Check values using VecAt
bool result = (VecAt(&vec, 0) == 10);
result = result && (VecAt(&vec, 1) == 20);
result = result && (VecAt(&vec, 2) == 30);
result = result && (VecAt(&vec, 3) == 40);- In
Access.c:48:
bool result = (VecAt(&vec, 0) == 10);
result = result && (VecAt(&vec, 1) == 20);
result = result && (VecAt(&vec, 2) == 30);
result = result && (VecAt(&vec, 3) == 40);
result = result && (VecAt(&vec, 4) == 50);- In
Access.c:49:
result = result && (VecAt(&vec, 1) == 20);
result = result && (VecAt(&vec, 2) == 30);
result = result && (VecAt(&vec, 3) == 40);
result = result && (VecAt(&vec, 4) == 50);- In
Access.c:50:
result = result && (VecAt(&vec, 2) == 30);
result = result && (VecAt(&vec, 3) == 40);
result = result && (VecAt(&vec, 4) == 50);
// Modify a value using VecAt
- In
Access.c:53:
// Modify a value using VecAt
VecAt(&vec, 2) = 35;
result = result && (VecAt(&vec, 2) == 35);- In
Access.c:54:
// Modify a value using VecAt
VecAt(&vec, 2) = 35;
result = result && (VecAt(&vec, 2) == 35);
// Clean up
- In
Access.c:93:
// Verify changes
result = result && (VecAt(&vec, 0) == 15);
result = result && (VecAt(&vec, 2) == 35);- In
Access.c:94:
// Verify changes
result = result && (VecAt(&vec, 0) == 15);
result = result && (VecAt(&vec, 2) == 35);
// Clean up
- In
Access.c:127:
// Verify changes
result = result && (VecAt(&vec, 0) == 15);
result = result && (VecAt(&vec, 2) == 35);- In
Access.c:128:
// Verify changes
result = result && (VecAt(&vec, 0) == 15);
result = result && (VecAt(&vec, 2) == 35);
// Clean up
- In
Access.c:314:
bool result = (VecLen(&vec) == 4);
for (int i = 0; i < 4; i++) {
result = result && (VecAt(&vec, i) == values[i]);
}- In
Access.c:343:
// Real: dst == {10,20,30,40}. Mutant (constant offset): every source read
// hits the same element, e.g. dst == {10,10,10,10}.
bool result = (VecLen(&dst) == 4) && (VecAt(&dst, 0) == 10) && (VecAt(&dst, 1) == 20) && (VecAt(&dst, 2) == 30) &&
(VecAt(&dst, 3) == 40);- In
Access.c:344:
// hits the same element, e.g. dst == {10,10,10,10}.
bool result = (VecLen(&dst) == 4) && (VecAt(&dst, 0) == 10) && (VecAt(&dst, 1) == 20) && (VecAt(&dst, 2) == 30) &&
(VecAt(&dst, 3) == 40);
VecDeinit(&src); result = result && VecLen(&matches) == 5;
if (result) {
result = result && VecAt(&matches, 0) == 0;
result = result && VecAt(&matches, 1) == 2;
result = result && VecAt(&matches, 2) == 4; if (result) {
result = result && VecAt(&matches, 0) == 0;
result = result && VecAt(&matches, 1) == 2;
result = result && VecAt(&matches, 2) == 4;
result = result && VecAt(&matches, 3) == 6; result = result && VecAt(&matches, 0) == 0;
result = result && VecAt(&matches, 1) == 2;
result = result && VecAt(&matches, 2) == 4;
result = result && VecAt(&matches, 3) == 6;
result = result && VecAt(&matches, 4) == 8; result = result && VecAt(&matches, 1) == 2;
result = result && VecAt(&matches, 2) == 4;
result = result && VecAt(&matches, 3) == 6;
result = result && VecAt(&matches, 4) == 8;
} result = result && VecAt(&matches, 2) == 4;
result = result && VecAt(&matches, 3) == 6;
result = result && VecAt(&matches, 4) == 8;
} result = result && (VecLen(&matches) == 1);
if (result) {
result = result && (VecAt(&matches, 0) == 0);
}- In
Arena.c:84:
}
ok = ok && VecLen(&v) == 4096 && VecAt(&v, 0) == 0 && VecAt(&v, 4095) == 4095;
VecDeinit(&v);
ArenaAllocatorDeinit(&arena);- In
Page.c:81:
}
ok = ok && (VecLen(&v) == 1024) && (VecAt(&v, 0) == 0) && (VecAt(&v, 1023) == 1023);
VecDeinit(&v);
PageAllocatorDeinit(&alloc);- In
Type.c:64:
// Check the content of the strings
if (result) {
Str *str1 = &VecAt(&sv, 0);
Str *str2 = &VecAt(&sv, 1);- In
Type.c:65:
if (result) {
Str *str1 = &VecAt(&sv, 0);
Str *str2 = &VecAt(&sv, 1);
result = result && (ZstrCompare(StrBegin(str1), "Hello") == 0);- In
Dwarf.c:1779:
u64 real_rows = 0;
for (u64 i = 0; i < VecLen(&lines.entries); ++i) {
const DwarfLineEntry *e = &VecAt(&lines.entries, i);
if (!e->end_sequence)
++real_rows;- In
Dwarf.c:3102:
static bool first_real_row_address(const DwarfLines *lines, u64 *out) {
for (u64 i = 0; i < VecLen(&lines->entries); ++i) {
const DwarfLineEntry *e = &VecAt(&lines->entries, i);
if (!e->end_sequence) {
*out = e->address;
if (VecLen(&languages) >= 3) {
Str *lang1 = &VecAt(&languages, 0);
Str *lang2 = &VecAt(&languages, 1);
Str *lang3 = &VecAt(&languages, 2); if (VecLen(&languages) >= 3) {
Str *lang1 = &VecAt(&languages, 0);
Str *lang2 = &VecAt(&languages, 1);
Str *lang3 = &VecAt(&languages, 2); Str *lang1 = &VecAt(&languages, 0);
Str *lang2 = &VecAt(&languages, 1);
Str *lang3 = &VecAt(&languages, 2);
if (StrCmp(lang1, "C", 1) != 0) {
if (VecLen(&product.tags) >= 3) {
Str *tag1 = &VecAt(&product.tags, 0);
Str *tag2 = &VecAt(&product.tags, 1);
Str *tag3 = &VecAt(&product.tags, 2); if (VecLen(&product.tags) >= 3) {
Str *tag1 = &VecAt(&product.tags, 0);
Str *tag2 = &VecAt(&product.tags, 1);
Str *tag3 = &VecAt(&product.tags, 2); Str *tag1 = &VecAt(&product.tags, 0);
Str *tag2 = &VecAt(&product.tags, 1);
Str *tag3 = &VecAt(&product.tags, 2);
if (StrCmp(tag1, "electronics", 11) != 0) { // Write dynamic key for source function ID
Str source_key = StrInit(&alloc);
u64 source_id = VecLen(&response.data) > 0 ? VecAt(&response.data, 0).source_function_id : 0;
StrAppendFmt(&source_key, "{}", source_id); JW_OBJ_KV(json, StrBegin(&source_key), {
if (VecLen(&response.data) > 0) {
AnnSymbol *s = &VecAt(&response.data, 0);
Str target_key = StrInit(&alloc);
StrAppendFmt(&target_key, "{}", s->target_function_id);
if (VecLen(&symbols) >= 2) {
AnnSymbol *sym1 = &VecAt(&symbols, 0);
AnnSymbol *sym2 = &VecAt(&symbols, 1); if (VecLen(&symbols) >= 2) {
AnnSymbol *sym1 = &VecAt(&symbols, 0);
AnnSymbol *sym2 = &VecAt(&symbols, 1);
if (!(sym1->source_function_id == 12345 || sym1->source_function_id == 54321)) {
if (VecLen(&response.data) > 0) {
AnnSymbol *sym = &VecAt(&response.data, 0);
// Debug individual symbol checks
if (VecLen(&response.data) > 0) {
AnnSymbol *sym = &VecAt(&response.data, 0);
if (sym->source_function_id != 12345) {
if (VecLen(&response.data) > 0) {
AnnSymbol *sym = &VecAt(&response.data, 0);
if (sym->source_function_id != 12345) { });
if (obj.x_value == 1 && VecLen(&obj.filled_items) == 2 && VecAt(&obj.filled_items, 0) == 1 &&
VecAt(&obj.filled_items, 1) == 2) {
WriteFmt(
if (obj.x_value == 1 && VecLen(&obj.filled_items) == 2 && VecAt(&obj.filled_items, 0) == 1 &&
VecAt(&obj.filled_items, 1) == 2) {
WriteFmt(
"[DEBUG] Mixed empty and filled test passed - x: {}, items: {}\n", );
if (VecLen(&obj.filled_items) > 0) {
WriteFmt("[DEBUG] First item: {}\n", VecAt(&obj.filled_items, 0));
}
success = false;- In
RoundTrip.c:80:
for (size i = 0; i < VecLen(&a->features); i++) {
if (StrCmp((Str *)&VecAt(&a->features, i), (Str *)&VecAt(&b->features, i)) != 0) {
return false;
}- In
RoundTrip.c:418:
if (numbers_match) {
for (size i = 0; i < VecLen(&original_numbers); i++) {
if (VecAt(&original_numbers, i) != VecAt(&parsed_numbers, i)) {
numbers_match = false;
break;- In
RoundTrip.c:629:
if (numbers_match) {
for (size i = 0; i < VecLen(&original.numbers); i++) {
if (VecAt(&original.numbers, i) != VecAt(&parsed.numbers, i)) {
numbers_match = false;
break;- In
RoundTrip.c:639:
if (flags_match) {
for (size i = 0; i < VecLen(&original.flags); i++) {
if (VecAt(&original.flags, i) != VecAt(&parsed.flags, i)) {
flags_match = false;
break;
Last updated on