MCPcopy Index your code
hub / github.com/git/git / test_reftable_readwrite__buffer

Function test_reftable_readwrite__buffer

t/unit-tests/u-reftable-readwrite.c:22–44  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20static const int update_index = 5;
21
22void test_reftable_readwrite__buffer(void)
23{
24 struct reftable_buf buf = REFTABLE_BUF_INIT;
25 struct reftable_block_source source = { 0 };
26 struct reftable_block_data out = { 0 };
27 int n;
28 uint8_t in[] = "hello";
29 cl_assert_equal_i(reftable_buf_add(&buf, in, sizeof(in)), 0);
30 block_source_from_buf(&source, &buf);
31 cl_assert_equal_i(block_source_size(&source), 6);
32 n = block_source_read_data(&source, &out, 0, sizeof(in));
33 cl_assert_equal_i(n, sizeof(in));
34 cl_assert(!memcmp(in, out.data, n));
35 block_source_release_data(&out);
36
37 n = block_source_read_data(&source, &out, 1, 2);
38 cl_assert_equal_i(n, 2);
39 cl_assert(!memcmp(out.data, "el", 2));
40
41 block_source_release_data(&out);
42 block_source_close(&source);
43 reftable_buf_release(&buf);
44}
45
46static void write_table(char ***names, struct reftable_buf *buf, int N,
47 int block_size, enum reftable_hash hash_id)

Callers

nothing calls this directly

Calls 7

reftable_buf_addFunction · 0.85
block_source_from_bufFunction · 0.85
block_source_sizeFunction · 0.85
block_source_read_dataFunction · 0.85
block_source_closeFunction · 0.85
reftable_buf_releaseFunction · 0.85

Tested by

no test coverage detected