lookup :: proc (use map: ^Map($K, $V), key: K) -> MapLookupResult {
lr := MapLookupResult.{};
- hash := hash_function(key);
+ hash := hash_function(key); // You cannot use this type for the key, unless you add an overload.
lr.hash_index = hash % hashes.count;
lr.entry_index = hashes[lr.hash_index];
#!/bin/sh
-success=1
+failed=0
for test_file in ./tests/*.onyx ; do
filename=$(basename -- "$test_file")
name="${filename%.*}"
if ! ./onyx "$test_file" -o "./tests/$name.wasm" >/dev/null; then
echo "❌ Failed to compile $name.onyx."
- success=0
+ failed=1
continue
fi
if ! node onyxcmd.js "./tests/$name.wasm" > ./tmpoutput; then
echo "❌ Failed to run $name.onyx."
- success=0
+ failed=1
continue
fi
if ! diff ./tmpoutput "./tests/$name" >/dev/null; then
echo "❌ Test output did not match."
diff ./tmpoutput "./tests/$name"
- success=0
+ # failed=0
continue
fi
done
rm ./tmpoutput
-([ $success = 1 ] && echo "✔ All tests passed.") \
+([ $failed = 0 ] && echo "✔ All tests passed.") \
|| echo "❌ Some tests failed."
+
+exit $failed
\ No newline at end of file