aboutsummaryrefslogtreecommitdiffstats
path: root/core/test-module.c
diff options
context:
space:
mode:
authoreunhhu <[email protected]>2026-10-18 23:54:06 +0100
committereunhhu <[email protected]>2026-10-18 23:54:06 +0100
commitd7caf4dfb1947d8f804e3d8ae7ef066c6e3b8fb7 (patch)
tree6c5b8bc47b5ce60cb9021377c1d2dc3c3469972e /core/test-module.c
parentff2e0823e97d10477341192d72f5d9e61d9d5bad (diff)
downloadpure-d7caf4dfb1947d8f804e3d8ae7ef066c6e3b8fb7.tar.gz
pure-d7caf4dfb1947d8f804e3d8ae7ef066c6e3b8fb7.zip
027's 4f-3a: no fixed count of inputs, views (the load's columns among them, in u16s), handlers or message fields: the header's u16s alone; a message's fields at most 64 (PURE_MESSAGE_FIELDS: a send pushes them all, as the stored sends' shapes hold them), outputs at most 255 (the store names them in a byte's count: the links and the outbox's image), the numbers of outputs a module dropped carried within it; an app's numbers of each input (last sent, saved, where the event began) in a block sized to its module's inputs (by_input), a replace laying the new one first and filling it by output name; image headers sized to the module (header_room); a view's arguments u32, a made column's field u16; pure-serve's timers grow to the module's inputs, its outlets and known senders its own count (OUTLETS, 32), a list view's JSON keys its columns on the stack for 64, else on the heap; unit test: 40 inputs and 70 views, the last of each used; counts: b40 against b39b within 0.01% with batches and without but BFS +0.09%; the bank's queries (s39b and s40 in turns, three each) in_credit -0.64%, per_branch -0.37%, field +0.34%, the rest within 0.22%; 008 and 027
Diffstat (limited to 'core/test-module.c')
-rw-r--r--core/test-module.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/core/test-module.c b/core/test-module.c
index 14a2335..4eabdfc 100644
--- a/core/test-module.c
+++ b/core/test-module.c
@@ -570,6 +570,26 @@ static void rejections(void) {
CHECK(pure_app_start(&wide, &module_a, (PureData){0}) == PURE_OK && press(&wide, 0) == PURE_OK && press(&wide, 0) == PURE_OK &&
wide.values[MANY - 1].num == 2 && wide.values[0].num == 0);
pure_app_stop(&wide);
+ /* Nor of inputs, views or handlers (027's 4f-3a): 40 messages (the last counted), 70 views (the last its count). */
+ enum { INPUTS = 40, VIEWS = 70 };
+ static I messages[INPUTS];
+ static V views[VIEWS];
+ static char message_names[INPUTS][8], view_names[VIEWS][8];
+ for (unsigned i = 0; i < INPUTS; ++i) {
+ snprintf(message_names[i], 8, "m%u", i);
+ messages[i] = (I){message_names[i], NULL, PURE_KIND_MESSAGE, NULL, 0};
+ }
+ for (unsigned i = 0; i < VIEWS; ++i) snprintf(view_names[i], 8, "v%u", i), views[i] = (V){view_names[i], 4, 1};
+ static const O counted[] = {{L, 0, 0}, {C, 0, 1}, {ADD, 0, 0}, {ST, 0, 0}, {L, 0, 0}};
+ static const H last[] = {{1 + 2 * (INPUTS - 1), 0, 4}};
+ CHECK(load((Spec){s1, 1, messages, INPUTS, views, VIEWS, last, 1, counted, 5, NULL, 0, NULL, 0, NULL, 0, NULL, 0, NULL, 0,
+ NULL, 0}, &module_a) == PURE_OK && module_a.inputs == INPUTS && module_a.views == VIEWS);
+ CHECK(pure_app_start(&wide, &module_a, (PureData){0}) == PURE_OK);
+ CHECK(pure_app_message(&wide, INPUTS - 1, (PureSpan){0}) == PURE_OK && pure_app_message(&wide, 0, (PureSpan){0}) == PURE_OK &&
+ pure_app_view(&wide, VIEWS - 1, &(double){0}));
+ double shown;
+ CHECK(pure_app_view(&wide, VIEWS - 1, &shown) && shown == 1);
+ pure_app_stop(&wide);
static unsigned char bytes[65536];
size_t size = build(bytes, (Spec){s1, 1, i1, 0, clash, 0, none, 0, load_a, 0, NULL, 0, NULL, 0, NULL, 0, NULL, 0, NULL, 0, NULL, 0});
CHECK(pure_module_load(bytes, size - 1, &module_a, error, sizeof(error)) == PURE_INVALID);