/* Driver behavior belongs to the driver integration tests. */ #include "ww.h" #include #include static void test_arena(void) { Arena *a = newarena(); if (a == NULL) { fprintf(stderr, "smoke: newarena returned NULL\n"); exit(1); } int *p = amalloc(a, sizeof *p); *p = 42; if (*p != 42) { fprintf(stderr, "smoke: arena alloc bad\n"); exit(1); } /* force several growths */ for (int i = 0; i < 10000; i++) { char *s = aprintf(a, "hello-%d", i); if (s == NULL || strncmp(s, "hello-", 6) != 0) { fprintf(stderr, "smoke: aprintf bad\n"); exit(1); } } freearena(a); } static void test_version(void) { if (WW_VERSION == NULL || WW_VERSION[0] == '\0') { fprintf(stderr, "smoke: empty WW_VERSION\n"); exit(1); } } int main(void) { test_arena(); test_version(); puts("smoke: ok"); return 0; }