summaryrefslogtreecommitdiff
path: root/tests/correctness_probe.c
diff options
context:
space:
mode:
authorBerke Güzel <wenekar1@gmail.com>2026-10-15 13:04:01 +0300
committerBerke Güzel <wenekar1@gmail.com>2026-10-15 13:04:01 +0300
commitdcebf9c7f954a55350b68d0ead1935612c4e2e05 (patch)
tree3eb3e9f6154c6760bcb89a565f8ddc8f8b66cb90 /tests/correctness_probe.c
parentbd8222e615134c3ec5e7a07b6b1fa97c9bd4a471 (diff)
Rename the library to wsap_vtcore
ncurses installs <term.h> and defines struct term. In a file that includes both headers, an ncurses TERMINAL * and this library's terminal are silently the same type. The name wsap_vtcore avoids the clash. The public header is now <wsap_vtcore/wsap_vtcore.h>. Every global symbol uses the wsap_vtcore_ prefix, every macro uses WSAP_VTCORE_, and the shared library is libwsap_vtcore.so.0. The default terminal name is now "wsap_vtcore". The ISA override variable is WSAP_VTCORE_ISA. No other behavior changes. The amalgamation writes wsap_vtcore.c and wsap_vtcore.h. Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Diffstat (limited to 'tests/correctness_probe.c')
-rw-r--r--tests/correctness_probe.c68
1 files changed, 34 insertions, 34 deletions
diff --git a/tests/correctness_probe.c b/tests/correctness_probe.c
index 9ac74ca..47548a3 100644
--- a/tests/correctness_probe.c
+++ b/tests/correctness_probe.c
@@ -27,60 +27,60 @@ void *__wrap_realloc(void *ptr, size_t size)
int main(void)
{
bool failed = false;
- struct term_options options = { .size = { 8, 3 }, .scrollback = 5 };
- struct term *t = term_new(&options);
- struct term_snapshot *s = term_snapshot_new();
- assert(t && s && term_snapshot_update(s, t));
+ struct wsap_vtcore_options options = { .size = { 8, 3 }, .scrollback = 5 };
+ struct wsap_vtcore *t = wsap_vtcore_new(&options);
+ struct wsap_vtcore_snapshot *s = wsap_vtcore_snapshot_new();
+ assert(t && s && wsap_vtcore_snapshot_update(s, t));
const char accented[] = "e\xcc\x81";
- term_feed(t, accented, sizeof(accented) - 1, 0);
+ wsap_vtcore_feed(t, accented, sizeof(accented) - 1, 0);
fail_realloc = 1;
- bool ok = term_snapshot_update(s, t);
+ bool ok = wsap_vtcore_snapshot_update(s, t);
uint32_t cps[16];
printf("snapshot arena allocation failure: update=%d size=%dx%d (expected false and the previous 8x3 view)\n",
- ok, term_snapshot_view(s)->size.x, term_snapshot_view(s)->size.y);
- failed |= ok || term_snapshot_view(s)->size.x != 8 || term_snapshot_view(s)->size.y != 3;
- assert(term_snapshot_update(s, t));
- int n = term_snapshot_cluster(s, term_snapshot_row(s, 0)[0].text, cps, 16);
+ ok, wsap_vtcore_snapshot_view(s)->size.x, wsap_vtcore_snapshot_view(s)->size.y);
+ failed |= ok || wsap_vtcore_snapshot_view(s)->size.x != 8 || wsap_vtcore_snapshot_view(s)->size.y != 3;
+ assert(wsap_vtcore_snapshot_update(s, t));
+ int n = wsap_vtcore_snapshot_cluster(s, wsap_vtcore_snapshot_row(s, 0)[0].text, cps, 16);
printf("retry after allocation recovers: cluster_length=%d (expected 2)\n", n);
failed |= n != 2 || cps[0] != 'e' || cps[1] != 0x301;
- term_snapshot_free(s);
- term_free(t);
+ wsap_vtcore_snapshot_free(s);
+ wsap_vtcore_free(t);
options.size.y = 24;
- t = term_new(&options);
- s = term_snapshot_new();
+ t = wsap_vtcore_new(&options);
+ s = wsap_vtcore_snapshot_new();
assert(t && s);
const char line[] = "e\xcc\x81\r\n";
for (int i = 1; i <= 10000; i++) {
- term_feed(t, line, sizeof(line) - 1, 0);
- assert(term_snapshot_update(s, t));
+ wsap_vtcore_feed(t, line, sizeof(line) - 1, 0);
+ assert(wsap_vtcore_snapshot_update(s, t));
if (i == 1000 || i == 10000)
printf("after %d lines: arena_words=%u dead_words=%u history_rows=%d\n",
- i, s->arena_len, s->arena_dead, term_history_rows(t));
+ i, s->arena_len, s->arena_dead, wsap_vtcore_history_rows(t));
}
- failed |= s->arena_len >= 8192 || term_history_rows(t) != 5;
- term_snapshot_free(s);
- term_free(t);
+ failed |= s->arena_len >= 8192 || wsap_vtcore_history_rows(t) != 5;
+ wsap_vtcore_snapshot_free(s);
+ wsap_vtcore_free(t);
- options.size = (struct term_vector2i){ 8, 4 };
- t = term_new(&options);
- s = term_snapshot_new();
+ options.size = (struct wsap_vtcore_vector2i){ 8, 4 };
+ t = wsap_vtcore_new(&options);
+ s = wsap_vtcore_snapshot_new();
assert(t && s);
const char rows[] = "A\r\nB\r\nC\r\nD";
- term_feed(t, rows, sizeof(rows) - 1, 0);
- assert(term_snapshot_update(s, t));
+ wsap_vtcore_feed(t, rows, sizeof(rows) - 1, 0);
+ assert(wsap_vtcore_snapshot_update(s, t));
printf("before failed height shrink: top=%c cursor_y=%d history=%d\n",
- (char)term_snapshot_row(s, 0)[0].text, term_cursor(t).pos.y, term_history_rows(t));
+ (char)wsap_vtcore_snapshot_row(s, 0)[0].text, wsap_vtcore_cursor(t).pos.y, wsap_vtcore_history_rows(t));
fail_resize_calloc = 1;
- ok = term_resize(t, (struct term_vector2i){ 8, 2 });
+ ok = wsap_vtcore_resize(t, (struct wsap_vtcore_vector2i){ 8, 2 });
assert(!fail_resize_calloc);
- assert(term_snapshot_update(s, t));
+ assert(wsap_vtcore_snapshot_update(s, t));
printf("after failed height shrink: resize=%d height=%d top=%c cursor_y=%d history=%d\n",
- ok, term_size(t).y, (char)term_snapshot_row(s, 0)[0].text,
- term_cursor(t).pos.y, term_history_rows(t));
- failed |= ok || term_size(t).y != 4 || term_snapshot_row(s, 0)[0].text != 'A' ||
- term_cursor(t).pos.y != 3 || term_history_rows(t) != 0;
- term_snapshot_free(s);
- term_free(t);
+ ok, wsap_vtcore_size(t).y, (char)wsap_vtcore_snapshot_row(s, 0)[0].text,
+ wsap_vtcore_cursor(t).pos.y, wsap_vtcore_history_rows(t));
+ failed |= ok || wsap_vtcore_size(t).y != 4 || wsap_vtcore_snapshot_row(s, 0)[0].text != 'A' ||
+ wsap_vtcore_cursor(t).pos.y != 3 || wsap_vtcore_history_rows(t) != 0;
+ wsap_vtcore_snapshot_free(s);
+ wsap_vtcore_free(t);
return failed ? 1 : 0;
}