Mercurial > libbuf
diff test/test-puts.c @ 26:0cc98943f6e2
tests: switch to rexo
author | David Demelier <markand@malikania.fr> |
---|---|
date | Tue, 12 Oct 2021 09:24:18 +0200 |
parents | d87e84936795 |
children | dbdc17e11648 |
line wrap: on
line diff
--- a/test/test-puts.c Thu Sep 16 13:59:56 2021 +0200 +++ b/test/test-puts.c Tue Oct 12 09:24:18 2021 +0200 @@ -16,38 +16,30 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#define GREATEST_USE_ABBREVS 0 -#include <greatest.h> +#include <rexo.h> #include "buf.h" -GREATEST_TEST -puts_empty(void) +RX_TEST_CASE(puts, empty) { struct buf b = {0}; /* This will allocate an initial buffer of 10. */ - GREATEST_ASSERT_EQ(0, buf_puts(&b, "abcdefghij")); - GREATEST_ASSERT_STR_EQ(b.data, "abcdefghij"); - GREATEST_ASSERT_EQ(b.length, 10U); - GREATEST_ASSERT_EQ(b.capacity, 10U); + RX_INT_REQUIRE_EQUAL(buf_puts(&b, "abcdefghij"), 0); + RX_STR_REQUIRE_EQUAL(b.data, "abcdefghij"); + RX_UINT_REQUIRE_EQUAL(b.length, 10U); + RX_UINT_REQUIRE_EQUAL(b.capacity, 10U); /* This will multiply the capacity to 20 and increase length to 14. */ - GREATEST_ASSERT_EQ(0, buf_puts(&b, "klmn")); - GREATEST_ASSERT_STR_EQ(b.data, "abcdefghijklmn"); - GREATEST_ASSERT_EQ(b.length, 14U); - GREATEST_ASSERT_EQ(b.capacity, 20U); + RX_INT_REQUIRE_EQUAL(buf_puts(&b, "klmn"), 0); + RX_STR_REQUIRE_EQUAL(b.data, "abcdefghijklmn"); + RX_UINT_REQUIRE_EQUAL(b.length, 14U); + RX_UINT_REQUIRE_EQUAL(b.capacity, 20U); buf_finish(&b); - - GREATEST_PASS(); } -GREATEST_MAIN_DEFS(); - int main(int argc, char **argv) { - GREATEST_MAIN_BEGIN(); - GREATEST_RUN_TEST(puts_empty); - GREATEST_MAIN_END(); + return rx_main(0, NULL, argc, (const char **)argv) == RX_SUCCESS ? 0 : 1; }