diff options
| author | Chandra Pratap <chandrapratap3519@gmail.com> | 2024-05-29 22:29:30 +0530 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2024-05-30 07:30:10 -0700 |
| commit | e31efffc28b2d22137587ba9c0c71f03713df4b9 (patch) | |
| tree | e3578bc208fe6a8799ca6805f8ef71fe66392f2d | |
| parent | afe5b9e7ec6dcc92751cae7f58a37457e3da96ac (diff) | |
| download | git-e31efffc28b2d22137587ba9c0c71f03713df4b9.tar.gz | |
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 <ps@pks.im>
Mentored-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Chandra Pratap <chandrapratap3519@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
| -rw-r--r-- | t/unit-tests/t-reftable-basics.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/t/unit-tests/t-reftable-basics.c b/t/unit-tests/t-reftable-basics.c index b02ca02040..3c08218257 100644 --- a/t/unit-tests/t-reftable-basics.c +++ b/t/unit-tests/t-reftable-basics.c @@ -133,6 +133,16 @@ static void test_u24_roundtrip(void) check_int(in, ==, out); } +static void test_u16_roundtrip(void) +{ + uint32_t in = 0xfef1; + uint8_t dest[3]; + uint32_t out; + put_be16(dest, in); + out = get_be16(dest); + check_int(in, ==, out); +} + int cmd_main(int argc, const char *argv[]) { TEST(test_common_prefix(), "common_prefix_size works"); @@ -142,6 +152,7 @@ int cmd_main(int argc, const char *argv[]) TEST(test_names_length(), "names_length retuns size of a NULL-terminated string array"); TEST(test_names_equal(), "names_equal compares NULL-terminated string arrays"); TEST(test_u24_roundtrip(), "put_be24 and get_be24 work"); + TEST(test_u16_roundtrip(), "put_be16 and get_be16 work"); return test_done(); } |
