Skip to content

Instantly share code, notes, and snippets.

@munk
Created April 4, 2015 21:05
Show Gist options
  • Save munk/6bc57f7256e92ada73ce to your computer and use it in GitHub Desktop.
Save munk/6bc57f7256e92ada73ce to your computer and use it in GitHub Desktop.
#!/bin/bash
function hacstest {
name=$1
result=$2
expected=$3
if [ $result = $expected ]
then
echo -n "."
else
echo "\nFAIL: $1 | result: " "$result" "is not $expected"
fi
}
runner="./Pr2Base.run"
simple_func="function void main() { return ; }"
hacstest "TestVoidReturnStatementHasTypeTDnil" $("$runner" --scheme=StatementHasTypeTDnil --sort=Statement --term="return ;") "OK"
hacstest "TestVoidReturnStatementHasEmptyName" $("$runner" --scheme=StatementHasNsNnil --sort=Statement --term="return ;") "OK"
hacstest "TestNoOpStatementHasTypeTDnil" $("$runner" --scheme=StatementHasTypeTDnil --sort=Statement --term=";") "OK"
hacstest "TestVarStatementHasTypeInt" $("$runner" --scheme=StatementHasTypeTDint --sort=Statement --term="var int x;") "OK"
hacstest "TestDeclarationHasNameMain" $("$runner" --scheme=DeclarationHasNameMain --sort=Declaration --term="$simple_func") "OK"
hacstest "TestDeclarationHasVoidPsCall" $("$runner" --scheme=DeclarationHasPsCall --sort=Declaration --term="$simple_func") "OK"
hacstest "TestEmptyArgumentSignatureHasEmptyPsList" $("$runner" --scheme=ArgumentSignatureHasEmptyPsList --sort=ArgumentSignature --term="()") "OK"
hacstest "TestEmptyArgumentSignatureHasEmptyNsList" $("$runner" --scheme=ArgumentSignatureHasEmptyNsList --sort=ArgumentSignature --term="()") "OK"
hacstest "TestNdsWorksAsSimpleArgument" $("$runner" --scheme=NdsWorksAsSimpleArgument --sort=Declarations --term="$simple_func") "OK"
hacstest "TestDeclarationHasGoodNds" $("$runner" --scheme=DeclsGoodNdsValue --sort=Declarations --term="$simple_func") "OK"
echo "" # print a newline
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment