diff options
author | Ekaitz Zarraga <ekaitz@elenq.tech> | 2025-08-16 21:55:36 +0200 |
---|---|---|
committer | Ekaitz Zarraga <ekaitz@elenq.tech> | 2025-08-16 21:55:36 +0200 |
commit | 9f3874d4549b648f54fb1274cd7ff4505491e6db (patch) | |
tree | 824c9061f8e2a138c57e934745cc748b9d240af2 /tests/piece-table-insert.c | |
parent | f9611cba7ded5c10419cd92a512e57044340f5e8 (diff) |
Makefile: Add logs for tests and move to assert
This provides a better log system that more clearly states what went
wrong in the test files.
Diffstat (limited to 'tests/piece-table-insert.c')
-rw-r--r-- | tests/piece-table-insert.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/tests/piece-table-insert.c b/tests/piece-table-insert.c index 2f2ef38..7604455 100644 --- a/tests/piece-table-insert.c +++ b/tests/piece-table-insert.c @@ -1,3 +1,4 @@ +#include <assert.h> #include <string.h> #include <stdlib.h> #include "../src/piece-table-internals.h" @@ -10,19 +11,17 @@ main() piece_table_insert (pt, 10, "abcdefgh", 8); piece_table_to_string (pt, tmp, 99); - if (strcmp (tmp, "0123456789abcdefgh")) - return 1; + assert (0 == strcmp (tmp, "0123456789abcdefgh")); piece_table_insert (pt, 18, "abcdefgh", 8); piece_table_to_string (pt, tmp, 99); - if (strcmp (tmp, "0123456789abcdefghabcdefgh")) - return 2; + assert (0 == strcmp (tmp, "0123456789abcdefghabcdefgh")); piece_table_insert (pt, 4, "abcdefgh", 8); piece_table_to_string (pt, tmp, 99); - if (strcmp (tmp, "0123abcdefgh456789abcdefghabcdefgh")) - return 3; + assert (0 == strcmp (tmp, "0123abcdefgh456789abcdefghabcdefgh")); piece_table_destroy (pt); + return 0; } |