1 #!/bin/bash
2 3 # Run p256k1 tests using Node.js WASM runtime
4 # This script builds the test binary and runs it in Node.js
5 6 set -e
7 8 SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
9 TESTDATA_DIR="$SCRIPT_DIR/testdata"
10 WASM_FILE="$TESTDATA_DIR/p256k1_test.wasm"
11 12 # Build the test binary
13 echo "Building WASM test binary..."
14 GOOS=js GOARCH=wasm CGO_ENABLED=0 go test -c -o "$WASM_FILE" "$SCRIPT_DIR"
15 16 # Run the tests
17 echo "Running tests in Node.js..."
18 node "$TESTDATA_DIR/run_wasm_tests.mjs" "$WASM_FILE" "$@"
19