summaryrefslogtreecommitdiff
path: root/tests/piece-table-insert.c
diff options
context:
space:
mode:
authorEkaitz Zarraga <ekaitz@elenq.tech>2025-08-16 21:55:36 +0200
committerEkaitz Zarraga <ekaitz@elenq.tech>2025-08-16 21:55:36 +0200
commit9f3874d4549b648f54fb1274cd7ff4505491e6db (patch)
tree824c9061f8e2a138c57e934745cc748b9d240af2 /tests/piece-table-insert.c
parentf9611cba7ded5c10419cd92a512e57044340f5e8 (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.c11
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;
}