schemagen: support objects with more than 32 properties
Replace the 32-bit `uint32_t seen` bitmask with a `std::vector<uint64_t>` bitset sized to the actual field count. `requiredMask` is now a vector of the same word count, and required-field checks use per-word masking so that optional fields do not cause false rejections. Adds big.schema.json + test_big.cpp regression tests covering the issue reproducer (40 required properties, missing/duplicate at index 32), plus run_tests.sh to exercise both test_gen.cpp and test_big.cpp. Fixes #3
This commit is contained in:
Executable
+22
@@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
# Build and run the schemagen regression tests.
|
||||
# Expects weaseljson to be built at ../../build (the default CMake build dir).
|
||||
set -euo pipefail
|
||||
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
python3 weaseljson_schemagen.py example.schema.json -o gen.h --namespace weasel_schema
|
||||
python3 weaseljson_schemagen.py big.schema.json -o big.h --namespace big_schema
|
||||
|
||||
g++ -std=c++20 -I../../include -I. test_gen.cpp \
|
||||
-L../../build -lweaseljson \
|
||||
-Wl,-rpath,'$ORIGIN'/../../build \
|
||||
-o test_gen
|
||||
|
||||
g++ -std=c++20 -I../../include -I. test_big.cpp \
|
||||
-L../../build -lweaseljson \
|
||||
-Wl,-rpath,'$ORIGIN'/../../build \
|
||||
-o test_big
|
||||
|
||||
./test_gen
|
||||
./test_big
|
||||
Reference in New Issue
Block a user