scool r85: Add tests on functions

URL: https://svn.lrde.epita.fr/svn/scool/branches/scool-ng ChangeLog: 2008-09-17 Maxime van Noppen <yabo@lrde.epita.fr> Add tests on functions * check.sh: Add the possibility to choose which tests to execute. * function/c++_ast/call_001.aterm: New. * function/c++_ast/call_002.aterm: New. * function/c++_ast/call_003.aterm: New. * function/c++_ast/call_004.aterm: New. * function/c++_ast/call_005.aterm: New. * function/c++_ast/call_006.aterm: New. * function/c++_ast/declaration_008.aterm: New. * function/c++_ast/parameters_arguments_001.aterm: New. * function/c++_ast/parameters_arguments_002.aterm: New. * function/c++_ast/parameters_arguments_003.aterm: New. * function/c++_ast/parameters_arguments_005.aterm: New. * variable/scool_ast/declaration_005.aterm, * function/scool_ast/call_001.aterm, * function/scool_ast/call_002.aterm, * function/scool_ast/call_003.aterm: Update regarding grammar changes. * function/scool_ast/call_004.aterm: New. * function/scool_ast/call_005.aterm: New. * function/scool_ast/call_006.aterm: New. * function/scool_ast/static_parameter_001.aterm: Remove. * function/scool_src/call_004.scl: New. * function/scool_src/call_005.scl: New. * function/scool_src/call_006.scl: New. * function/scool_src/static_parameter_001.scl: Remove. check.sh | 20 +++++++++++++++++--- function/c++_ast/call_001.aterm | 1 + function/c++_ast/call_002.aterm | 1 + function/c++_ast/call_003.aterm | 1 + function/c++_ast/call_004.aterm | 1 + function/c++_ast/call_005.aterm | 1 + function/c++_ast/call_006.aterm | 1 + function/c++_ast/declaration_008.aterm | 1 + function/c++_ast/parameters_arguments_001.aterm | 1 + function/c++_ast/parameters_arguments_002.aterm | 1 + function/c++_ast/parameters_arguments_003.aterm | 1 + function/c++_ast/parameters_arguments_005.aterm | 1 + function/scool_ast/call_001.aterm | 2 +- function/scool_ast/call_002.aterm | 2 +- function/scool_ast/call_003.aterm | 2 +- function/scool_ast/call_004.aterm | 1 + function/scool_ast/call_005.aterm | 1 + function/scool_ast/call_006.aterm | 1 + function/scool_src/call_004.scl | 4 ++++ function/scool_src/call_005.scl | 4 ++++ function/scool_src/call_006.scl | 4 ++++ variable/scool_ast/declaration_005.aterm | 2 +- 22 files changed, 47 insertions(+), 7 deletions(-) Index: branches/scool-ng/tests/function/c++_ast/parameters_arguments_001.aterm =================================================================== --- branches/scool-ng/tests/function/c++_ast/parameters_arguments_001.aterm (revision 0) +++ branches/scool-ng/tests/function/c++_ast/parameters_arguments_001.aterm (revision 85) @@ -0,0 +1 @@ +CxxProgram([CxxFun([(CxxType("typename"),CxxId("T"))],CxxType("T"),CxxId("f"),[(CxxConstType(CxxRefType(CxxType("T"))),CxxId("a"))],CxxId("a"))]) Index: branches/scool-ng/tests/function/c++_ast/parameters_arguments_002.aterm =================================================================== --- branches/scool-ng/tests/function/c++_ast/parameters_arguments_002.aterm (revision 0) +++ branches/scool-ng/tests/function/c++_ast/parameters_arguments_002.aterm (revision 85) @@ -0,0 +1 @@ +CxxProgram([CxxFun([(CxxType("typename"),CxxId("T"))],CxxType("void"),CxxId("f"),[(CxxConstType(CxxRefType(CxxType("T"))),CxxId("a"))],[CxxExpStm(CxxKeyword("return",CxxId("a")))])]) Index: branches/scool-ng/tests/function/c++_ast/parameters_arguments_003.aterm =================================================================== --- branches/scool-ng/tests/function/c++_ast/parameters_arguments_003.aterm (revision 0) +++ branches/scool-ng/tests/function/c++_ast/parameters_arguments_003.aterm (revision 85) @@ -0,0 +1 @@ +CxxProgram([CxxFun([(CxxType("typename"),CxxId("T"))],CxxType("void"),CxxId("f"),[(CxxConstType(CxxRefType(CxxType("T"))),CxxId("a"))],CxxId("a"))]) Index: branches/scool-ng/tests/function/c++_ast/declaration_008.aterm =================================================================== --- branches/scool-ng/tests/function/c++_ast/declaration_008.aterm (revision 0) +++ branches/scool-ng/tests/function/c++_ast/declaration_008.aterm (revision 85) @@ -0,0 +1 @@ +CxxProgram([CxxFun([(CxxType("bool"),CxxId("B"))],CxxType("void"),CxxId("foo"),[])]) Index: branches/scool-ng/tests/function/c++_ast/parameters_arguments_005.aterm =================================================================== --- branches/scool-ng/tests/function/c++_ast/parameters_arguments_005.aterm (revision 0) +++ branches/scool-ng/tests/function/c++_ast/parameters_arguments_005.aterm (revision 85) @@ -0,0 +1 @@ +CxxProgram([CxxFun([(CxxType("typename"),CxxId("T")),(CxxType("typename"),CxxId("U"))],CxxType("T"),CxxId("f"),[(CxxConstType(CxxRefType(CxxType("T"))),CxxId("a")),(CxxConstType(CxxRefType(CxxType("U"))),CxxId("b"))],CxxId("a"))]) Index: branches/scool-ng/tests/function/c++_ast/call_001.aterm =================================================================== --- branches/scool-ng/tests/function/c++_ast/call_001.aterm (revision 0) +++ branches/scool-ng/tests/function/c++_ast/call_001.aterm (revision 85) @@ -0,0 +1 @@ +CxxProgram([CxxFun([],CxxType("void"),CxxId("doit"),[],[CxxExpStm(CxxFunCall([],CxxId("foo"),[]))])]) Index: branches/scool-ng/tests/function/c++_ast/call_002.aterm =================================================================== --- branches/scool-ng/tests/function/c++_ast/call_002.aterm (revision 0) +++ branches/scool-ng/tests/function/c++_ast/call_002.aterm (revision 85) @@ -0,0 +1 @@ +CxxProgram([CxxFun([],CxxType("void"),CxxId("doit"),[],[CxxExpStm(CxxFunCall([],CxxId("foo"),[CxxInt("42")]))])]) Index: branches/scool-ng/tests/function/c++_ast/call_003.aterm =================================================================== --- branches/scool-ng/tests/function/c++_ast/call_003.aterm (revision 0) +++ branches/scool-ng/tests/function/c++_ast/call_003.aterm (revision 85) @@ -0,0 +1 @@ +CxxProgram([CxxFun([],CxxType("void"),CxxId("doit"),[],[CxxExpStm(CxxFunCall([],CxxId("foo"),["bar",CxxInt("42")]))])]) Index: branches/scool-ng/tests/function/c++_ast/call_004.aterm =================================================================== --- branches/scool-ng/tests/function/c++_ast/call_004.aterm (revision 0) +++ branches/scool-ng/tests/function/c++_ast/call_004.aterm (revision 85) @@ -0,0 +1 @@ +CxxProgram([CxxFun([],CxxType("void"),CxxId("doit"),[],[CxxExpStm(CxxFunCall([CxxType("int")],CxxId("foo"),[]))])]) Index: branches/scool-ng/tests/function/c++_ast/call_005.aterm =================================================================== --- branches/scool-ng/tests/function/c++_ast/call_005.aterm (revision 0) +++ branches/scool-ng/tests/function/c++_ast/call_005.aterm (revision 85) @@ -0,0 +1 @@ +CxxProgram([CxxFun([],CxxType("void"),CxxId("doit"),[],[CxxExpStm(CxxFunCall([CxxInt("42")],CxxId("foo"),[]))])]) Index: branches/scool-ng/tests/function/c++_ast/call_006.aterm =================================================================== --- branches/scool-ng/tests/function/c++_ast/call_006.aterm (revision 0) +++ branches/scool-ng/tests/function/c++_ast/call_006.aterm (revision 85) @@ -0,0 +1 @@ +CxxProgram([CxxFun([],CxxType("void"),CxxId("doit"),[],[CxxExpStm(CxxFunCall([CxxType("int"),CxxInt("42")],CxxId("foo"),[CxxInt("42")]))])]) Index: branches/scool-ng/tests/function/scool_ast/static_parameter_001.aterm (deleted) =================================================================== Index: branches/scool-ng/tests/function/scool_ast/call_001.aterm =================================================================== --- branches/scool-ng/tests/function/scool_ast/call_001.aterm (revision 84) +++ branches/scool-ng/tests/function/scool_ast/call_001.aterm (revision 85) @@ -1 +1 @@ -Program([FunctionDefinition(None,Identifier("doit"),FunctionType(None,ArgumentsDeclaration([]),SimpleType("void")),FunctionBlock([ExpressionStatement(FunctionCall(Identifier("foo"),None,DynamicArguments([])))]))]) +Program([FunctionDefinition(None,Identifier("doit"),FunctionType(None,ArgumentsDeclaration([]),SimpleType("void")),FunctionBlock([ExpressionStatement(FunctionCall(Identifier("foo"),None,Arguments([])))]))]) Index: branches/scool-ng/tests/function/scool_ast/call_002.aterm =================================================================== --- branches/scool-ng/tests/function/scool_ast/call_002.aterm (revision 84) +++ branches/scool-ng/tests/function/scool_ast/call_002.aterm (revision 85) @@ -1 +1 @@ -Program([FunctionDefinition(None,Identifier("doit"),FunctionType(None,ArgumentsDeclaration([]),SimpleType("void")),FunctionBlock([ExpressionStatement(FunctionCall(Identifier("foo"),None,DynamicArguments([Integer("42")])))]))]) +Program([FunctionDefinition(None,Identifier("doit"),FunctionType(None,ArgumentsDeclaration([]),SimpleType("void")),FunctionBlock([ExpressionStatement(FunctionCall(Identifier("foo"),None,Arguments([Integer("42")])))]))]) Index: branches/scool-ng/tests/function/scool_ast/call_003.aterm =================================================================== --- branches/scool-ng/tests/function/scool_ast/call_003.aterm (revision 84) +++ branches/scool-ng/tests/function/scool_ast/call_003.aterm (revision 85) @@ -1 +1 @@ -Program([FunctionDefinition(None,Identifier("doit"),FunctionType(None,ArgumentsDeclaration([]),SimpleType("void")),FunctionBlock([ExpressionStatement(FunctionCall(Identifier("foo"),None,DynamicArguments([String("\"bar\""),Integer("42")])))]))]) +Program([FunctionDefinition(None,Identifier("doit"),FunctionType(None,ArgumentsDeclaration([]),SimpleType("void")),FunctionBlock([ExpressionStatement(FunctionCall(Identifier("foo"),None,Arguments([String("\"bar\""),Integer("42")])))]))]) Index: branches/scool-ng/tests/function/scool_ast/call_004.aterm =================================================================== --- branches/scool-ng/tests/function/scool_ast/call_004.aterm (revision 0) +++ branches/scool-ng/tests/function/scool_ast/call_004.aterm (revision 85) @@ -0,0 +1 @@ +Program([FunctionDefinition(None,Identifier("doit"),FunctionType(None,ArgumentsDeclaration([]),SimpleType("void")),FunctionBlock([ExpressionStatement(FunctionCall(Identifier("foo"),Some(Parameters([SimpleType("int")])),Arguments([])))]))]) Index: branches/scool-ng/tests/function/scool_ast/call_005.aterm =================================================================== --- branches/scool-ng/tests/function/scool_ast/call_005.aterm (revision 0) +++ branches/scool-ng/tests/function/scool_ast/call_005.aterm (revision 85) @@ -0,0 +1 @@ +Program([FunctionDefinition(None,Identifier("doit"),FunctionType(None,ArgumentsDeclaration([]),SimpleType("void")),FunctionBlock([ExpressionStatement(FunctionCall(Identifier("foo"),Some(Parameters([Integer("42")])),Arguments([])))]))]) Index: branches/scool-ng/tests/function/scool_ast/call_006.aterm =================================================================== --- branches/scool-ng/tests/function/scool_ast/call_006.aterm (revision 0) +++ branches/scool-ng/tests/function/scool_ast/call_006.aterm (revision 85) @@ -0,0 +1 @@ +Program([FunctionDefinition(None,Identifier("doit"),FunctionType(None,ArgumentsDeclaration([]),SimpleType("void")),FunctionBlock([ExpressionStatement(FunctionCall(Identifier("foo"),Some(Parameters([SimpleType("int"),Integer("42")])),Arguments([Integer("42")])))]))]) Index: branches/scool-ng/tests/function/scool_src/static_parameter_001.scl (deleted) =================================================================== Index: branches/scool-ng/tests/function/scool_src/call_005.scl =================================================================== --- branches/scool-ng/tests/function/scool_src/call_005.scl (revision 0) +++ branches/scool-ng/tests/function/scool_src/call_005.scl (revision 85) @@ -0,0 +1,4 @@ +doit : () -> void = +{ + foo[42](); +} Index: branches/scool-ng/tests/function/scool_src/call_006.scl =================================================================== --- branches/scool-ng/tests/function/scool_src/call_006.scl (revision 0) +++ branches/scool-ng/tests/function/scool_src/call_006.scl (revision 85) @@ -0,0 +1,4 @@ +doit : () -> void = +{ + foo[int, 42](42); +} Index: branches/scool-ng/tests/function/scool_src/call_004.scl =================================================================== --- branches/scool-ng/tests/function/scool_src/call_004.scl (revision 0) +++ branches/scool-ng/tests/function/scool_src/call_004.scl (revision 85) @@ -0,0 +1,4 @@ +doit : () -> void = +{ + foo[int](); +} Index: branches/scool-ng/tests/variable/scool_ast/declaration_005.aterm =================================================================== --- branches/scool-ng/tests/variable/scool_ast/declaration_005.aterm (revision 84) +++ branches/scool-ng/tests/variable/scool_ast/declaration_005.aterm (revision 85) @@ -1 +1 @@ -Program([SimpleDeclaration(Some("var"),Identifier("l"),StaticFunctionCall(Identifier("list"),StaticArguments([Identifier("int")])),None)]) +Program([SimpleDeclaration(Some("var"),Identifier("l"),StaticFunctionCall(Identifier("list"),Parameters([SimpleType("int")])),None)]) Index: branches/scool-ng/tests/check.sh =================================================================== --- branches/scool-ng/tests/check.sh (revision 84) +++ branches/scool-ng/tests/check.sh (revision 85) @@ -124,7 +124,13 @@ indent $test_name_indent echo -e "${bblue}`basename ${dir}`" - for testnb in `seq 1 $number_of_tests` + if [ "$2" = "0" ]; then + test_list=`seq 1 $number_of_tests` + else + test_list="$2" + fi + + for testnb in $test_list do test_config="test_$testnb" eval $test_config @@ -201,6 +207,7 @@ -p | --print Print the input of the command -pa | --print-all Print all inputs -pc | --print-command Prints the command used for the test + -t tests Execute only these tests (e.g. \"1 3 6\") -h | --help Print this help message " } @@ -211,6 +218,7 @@ print_all=0 print_cmd=0 print=0 +tests=0 # Parse command line options while [ $# -gt 0 ] do @@ -239,6 +247,12 @@ print_cmd=1 ;; + -t) + shift + tests="$1" + echo "XTEST: " $1 + ;; + -h | --help) print_help exit 0 @@ -275,7 +289,7 @@ if [ $# -gt 0 ]; then while [ $# -gt 0 ]; do - perform_test_suite $1 + perform_test_suite $1 "$tests" shift done @@ -285,5 +299,5 @@ # Execute all testsuites we find for dir in `find . -maxdepth 1 -type d -regex './[^.].*'` do - perform_test_suite $dir + perform_test_suite $dir "$tests" done -- \__/ \__/ (00) Maxime `yabo` van Noppen (00) ___) \ Epita 2009 / (___ (_____/ \_____)
participants (1)
-
Maxime van Noppen