Skip to content

Commit aef111f

Browse files
committed
test: default benchmark/fuzz suites to Zig + announce impl on load
Both suites now default IMPLEMENTATION_TO_TEST to the Zig build (the reference implementation) instead of Lua, print '==> Implementation under test: <path>' on startup, and hint to run 'zig build' / set IMPLEMENTATION_TO_TEST if missing.
1 parent 8c99ef9 commit aef111f

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

test/benchmark_test

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,13 @@ echo -e "${BLUE}=== PrintableBinary Performance Benchmark ===${NC}"
1212
# Path to the printable_binary script (can be overridden with IMPLEMENTATION_TO_TEST)
1313
# Auto-detect the correct path based on script location
1414
SCRIPT_DIR="$(dirname "$0")"
15-
DEFAULT_IMPLEMENTATION="$SCRIPT_DIR/../bin/printable-binary"
15+
# Default to the Zig implementation (reference build); override with IMPLEMENTATION_TO_TEST.
16+
DEFAULT_IMPLEMENTATION="$SCRIPT_DIR/../zig-out/bin/printable-binary-zig"
1617
SCRIPT="${IMPLEMENTATION_TO_TEST:-$DEFAULT_IMPLEMENTATION}"
18+
echo "==> Implementation under test: $SCRIPT" >&2
19+
if [ ! -e "$SCRIPT" ] && ! command -v "$SCRIPT" >/dev/null 2>&1; then
20+
echo " (not found — run 'zig build' first, or set IMPLEMENTATION_TO_TEST=<path>)" >&2
21+
fi
1722
echo -e "${YELLOW}Testing implementation: $SCRIPT${NC}"
1823

1924
# Test sizes

test/fuzz_test

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,13 @@ NC='\033[0m' # No Color
5656

5757
# Auto-detect the correct path based on script location
5858
SCRIPT_DIR="$(dirname "$0")"
59-
DEFAULT_IMPLEMENTATION="$SCRIPT_DIR/../bin/printable-binary"
59+
# Default to the Zig implementation (reference build); override with IMPLEMENTATION_TO_TEST.
60+
DEFAULT_IMPLEMENTATION="$SCRIPT_DIR/../zig-out/bin/printable-binary-zig"
6061
SCRIPT="${IMPLEMENTATION_TO_TEST:-$DEFAULT_IMPLEMENTATION}"
62+
echo "==> Implementation under test: $SCRIPT" >&2
63+
if [ ! -e "$SCRIPT" ] && ! command -v "$SCRIPT" >/dev/null 2>&1; then
64+
echo " (not found — run 'zig build' first, or set IMPLEMENTATION_TO_TEST=<path>)" >&2
65+
fi
6166
TEST_SIZE_MB="${TEST_SIZE_MB:-1}"
6267
TEST_SIZE_BYTES=$((TEST_SIZE_MB * 1024 * 1024))
6368

0 commit comments

Comments
 (0)