MCPcopy Create free account
hub / github.com/git/git / test_reftable_table__block_iterator

Function test_reftable_table__block_iterator

t/unit-tests/u-reftable-table.c:94–201  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

92}
93
94void test_reftable_table__block_iterator(void)
95{
96 struct reftable_block_source source = { 0 };
97 struct reftable_table_iterator it = { 0 };
98 struct reftable_ref_record *records;
99 const struct reftable_block *block;
100 struct reftable_table *table;
101 struct reftable_buf buf = REFTABLE_BUF_INIT;
102 struct {
103 uint8_t block_type;
104 uint16_t header_off;
105 uint16_t restart_count;
106 uint16_t record_count;
107 } expected_blocks[] = {
108 {
109 .block_type = REFTABLE_BLOCK_TYPE_REF,
110 .header_off = 24,
111 .restart_count = 10,
112 .record_count = 158,
113 },
114 {
115 .block_type = REFTABLE_BLOCK_TYPE_REF,
116 .restart_count = 10,
117 .record_count = 159,
118 },
119 {
120 .block_type = REFTABLE_BLOCK_TYPE_REF,
121 .restart_count = 10,
122 .record_count = 159,
123 },
124 {
125 .block_type = REFTABLE_BLOCK_TYPE_REF,
126 .restart_count = 2,
127 .record_count = 24,
128 },
129 {
130 .block_type = REFTABLE_BLOCK_TYPE_INDEX,
131 .restart_count = 1,
132 .record_count = 4,
133 },
134 {
135 .block_type = REFTABLE_BLOCK_TYPE_OBJ,
136 .restart_count = 1,
137 .record_count = 1,
138 },
139 };
140 const size_t nrecords = 500;
141 int ret;
142
143 REFTABLE_CALLOC_ARRAY(records, nrecords);
144 for (size_t i = 0; i < nrecords; i++) {
145 records[i].value_type = REFTABLE_REF_VAL1;
146 records[i].refname = xstrfmt("refs/heads/branch-%03"PRIuMAX,
147 (uintmax_t) i);
148 }
149
150 cl_reftable_write_to_buf(&buf, records, nrecords, NULL, 0, NULL);
151 block_source_from_buf(&source, &buf);

Callers

nothing calls this directly

Calls 14

xstrfmtFunction · 0.85
cl_reftable_write_to_bufFunction · 0.85
block_source_from_bufFunction · 0.85
reftable_table_newFunction · 0.85
iterator_nextFunction · 0.85
reftable_record_releaseFunction · 0.85
reftable_freeFunction · 0.85

Tested by

no test coverage detected