Every section banner dies (103 -> 0) across test/lang, the observer suites, the C carriers, and the five comment-heavy corpus fixtures; banner provenance (#N cites, carrier numbers, repair-cluster labels) folded into headers or adjacent WHY comments. Narration deleted; row provenance, ref cites, divergence pins, and layout contracts kept (fwd-ref decl-order guards and bootstrap-gate corpus rationale restored where the sweep over-cut). Comment-only proven: all 3742 wwbuild workdir .s byte-identical before/after; test-commit and test-byteid (161 lang + 1399 data, 0 pinned-divergent) green.
48 lines
849 B
C
48 lines
849 B
C
/* Driver behavior belongs to the driver integration tests. */
|
|
#include "ww.h"
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
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;
|
|
}
|