Skip to content

Instantly share code, notes, and snippets.

@webmaster128
Last active May 27, 2025 08:49
Show Gist options
  • Save webmaster128/4927b750fc5b766852bc0e6d57b279c1 to your computer and use it in GitHub Desktop.
Save webmaster128/4927b750fc5b766852bc0e6d57b279c1 to your computer and use it in GitHub Desktop.
#!/bin/bash
command -v shellcheck >/dev/null && shellcheck "$0"
memory_limit="1M"
# List of tests. Value is lines of JS code generated.
declare -a tests=(
"0"
"1"
"10"
"1000"
"2000"
"3000"
# Errors start here
"4000"
"4111"
"4848"
"4600"
"4242"
"4444"
"5000"
"6000"
"6666"
"7000"
"8648"
"8765"
"9999"
)
for size in "${tests[@]}"; do
path="$size.js"
echo -n "" >"$path"
if [ "$size" != "0" ]; then
for i in $(seq 1 "$size"); do
echo "export var myvar$i = \"foo$i\";" >>"$path"
done
fi
fsize=$(stat -f%z "$path")
echo "Loading $path ($fsize)..."
echo -n " "
./qjs --memory-limit "$memory_limit" "$path"
code="$?"
if [ "$code" = "0" ]; then
echo " ok"
else
echo " Error code: $code"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment