Add small testing script

This commit is contained in:
Pieter Vander Vennet 2022-06-01 14:15:53 +02:00
parent 798b29c0e6
commit df6b1beb93

30
AspectedRouting/IO/lua/test.sh Executable file
View file

@ -0,0 +1,30 @@
#! /bin/bash
echo "" > temp.lua
for f in `ls`
do
if [[ $f != "temp.lua" && $f != "test.sh" && $f != "not.lua" ]]
then
cat $f >> temp.lua
echo -e "\n\n" >> temp.lua
fi
done
cat << TESTCODE >> temp.lua
print("------------ TESTS --------------")
function expect(expected, actual)
if (actual ~= expected) then
print("Expected "..expected.." but got "..actual)
else
print("OK")
end
end
expect(-1, calculate_turn_cost_factor({["type"] = "restriction", restriction = "no_left_turn"}, {}))
expect(0, calculate_turn_cost_factor({["type"] = "restriction", restriction = "no_left_turn", except="bicycle;cargo_bike"}, {"bicycle"}))
TESTCODE
lua temp.lua