feat: add vfreeze/vthaw slots to intf_varray_t; designated initializers (P0-0b)
rtti header already present at rtti-0.0.2 with vfreeze_fn_t, vthaw_fn_t, retain_fn_t, and the two new slots in intf_varray_t. No header modification needed. Convert intf_varray_t compound-literal initializers in zarray.c and kvmgr.c to designated style with explicit .vfreeze = NULL and .vthaw = NULL slots. kv.c has no intf_varray_t initializer. Add test_zarray_cow.c with test_freeze_thaw_slots_exist which verifies the struct layout has the slots accessible and that they are NULL until P0-2 wires the real implementations. Wire test into meson.build and test.c. Full clean rebuild confirmed: 27/28 targets linked, no new test failures. Only the 4 pre-existing failures remain.
This commit is contained in:
parent
e0e2f56c81
commit
c78f9cf91c
5 changed files with 44 additions and 2 deletions
35
src/lib/testsuite/test_zarray_cow.c
Normal file
35
src/lib/testsuite/test_zarray_cow.c
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
#include <assert.h>
|
||||
#include <rtti.h>
|
||||
#include <stdio.h>
|
||||
#include <unity/unity.h>
|
||||
|
||||
#include "zarray.h"
|
||||
|
||||
/* xzarray_type is defined in zarray.c */
|
||||
extern typeinfo_t xzarray_type;
|
||||
|
||||
static void test_freeze_thaw_slots_exist(void)
|
||||
{
|
||||
/* After P0-0b, intf_varray_t has vfreeze and vthaw slots.
|
||||
* They are NULL until P0-2 wires the implementations. */
|
||||
const intf_varray_t* iface
|
||||
= (const intf_varray_t*)xzarray_type.interfaces.varray;
|
||||
|
||||
TEST_ASSERT_NOT_NULL(iface);
|
||||
|
||||
/* Access slots without crash — verifies struct layout has them */
|
||||
(void)iface->vfreeze;
|
||||
(void)iface->vthaw;
|
||||
|
||||
/* Slots must be NULL until P0-2 wires the real implementations */
|
||||
TEST_ASSERT_NULL(iface->vfreeze);
|
||||
TEST_ASSERT_NULL(iface->vthaw);
|
||||
|
||||
printf("test_freeze_thaw_slots_exist: PASS\n");
|
||||
}
|
||||
|
||||
void test_zarray_cow(void)
|
||||
{
|
||||
printf("\n>> zarray COW interface slot test\n\n");
|
||||
RUN_TEST(test_freeze_thaw_slots_exist);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue