| 20 | static const int update_index = 5; |
| 21 | |
| 22 | void 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 | |
| 46 | static void write_table(char ***names, struct reftable_buf *buf, int N, |
| 47 | int block_size, enum reftable_hash hash_id) |
nothing calls this directly
no test coverage detected