Add small testing script
This commit is contained in:
parent
798b29c0e6
commit
df6b1beb93
1 changed files with 30 additions and 0 deletions
30
AspectedRouting/IO/lua/test.sh
Executable file
30
AspectedRouting/IO/lua/test.sh
Executable 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
|
Loading…
Add table
Add a link
Reference in a new issue