Skip to content

Commit e31efff

Browse files
Chandra Pratapgitster
authored andcommitted
t: add test for put_be16()
put_be16() is a function defined in reftable/basics.{c, h} for which there are no tests in the current setup. Add a test for the same. Mentored-by: Patrick Steinhardt <[email protected]> Mentored-by: Christian Couder <[email protected]> Signed-off-by: Chandra Pratap <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent afe5b9e commit e31efff

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

t/unit-tests/t-reftable-basics.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,16 @@ static void test_u24_roundtrip(void)
133133
check_int(in, ==, out);
134134
}
135135

136+
static void test_u16_roundtrip(void)
137+
{
138+
uint32_t in = 0xfef1;
139+
uint8_t dest[3];
140+
uint32_t out;
141+
put_be16(dest, in);
142+
out = get_be16(dest);
143+
check_int(in, ==, out);
144+
}
145+
136146
int cmd_main(int argc, const char *argv[])
137147
{
138148
TEST(test_common_prefix(), "common_prefix_size works");
@@ -142,6 +152,7 @@ int cmd_main(int argc, const char *argv[])
142152
TEST(test_names_length(), "names_length retuns size of a NULL-terminated string array");
143153
TEST(test_names_equal(), "names_equal compares NULL-terminated string arrays");
144154
TEST(test_u24_roundtrip(), "put_be24 and get_be24 work");
155+
TEST(test_u16_roundtrip(), "put_be16 and get_be16 work");
145156

146157
return test_done();
147158
}

0 commit comments

Comments
 (0)