Skip to content
Snippets Groups Projects
Commit d2032f36 authored by Wuttke, Joachim's avatar Wuttke, Joachim Committed by Wuttke, Joachim
Browse files

ftest now under cmake

- ftests return 0 on success;
- throw_if -> exit_if
parent debc64fa
No related branches found
No related tags found
No related merge requests found
...@@ -3,5 +3,5 @@ fm 3 3 h ...@@ -3,5 +3,5 @@ fm 3 3 h
cc p0*t cc p0*t
op0 j+.77 op0 j+.77
oi p0 oi p0
throw_unless(y[,,2]==2.77,"final_result_wrong") exit_unless(y[,,2]==2.77,"final_result_wrong")
exit(1) exit(0)
\ No newline at end of file \ No newline at end of file
...@@ -4,5 +4,5 @@ ox! i ...@@ -4,5 +4,5 @@ ox! i
oy! j+i oy! j+i
oz0! j oz0! j
oy x+z0 oy x+z0
throw_unless(y[0,2,7]==9&&y[1,2,7]==9,"final_result_wrong") exit_unless(y[0,2,7]==9&&y[1,2,7]==9,"final_result_wrong")
exit(1) exit(0)
\ No newline at end of file \ No newline at end of file
...@@ -5,5 +5,5 @@ fm 7 1 h ...@@ -5,5 +5,5 @@ fm 7 1 h
oy! i oy! i
0 oy y/y[1,0] 0 oy y/y[1,0]
df df
throw_unless(y[2,2,6]==3,"final_result_wrong") exit_unless(y[2,2,6]==3,"final_result_wrong")
exit(1) exit(0)
\ No newline at end of file \ No newline at end of file
...@@ -2,4 +2,5 @@ ...@@ -2,4 +2,5 @@
fm 7 3 h fm 7 3 h
oz+ 100*j oz+ 100*j
mz- 0 mz- 0
exit(z0[,2]==200) exit_unless(z0[,2]==200,"failed")
\ No newline at end of file exit(0)
\ No newline at end of file
...@@ -2,5 +2,5 @@ ...@@ -2,5 +2,5 @@
fm 1 1 h fm 1 1 h
or+ 77 or+ 77
oy r0[1+i] oy r0[1+i]
throw_unless(y==77,"result_wrong") exit_unless(y==77,"result_wrong")
exit(1) exit(0)
\ No newline at end of file \ No newline at end of file
...@@ -4,11 +4,11 @@ COUNTER=0 ...@@ -4,11 +4,11 @@ COUNTER=0
rm -f log.tmp rm -f log.tmp
for I in *.f2t; do for I in *.f2t; do
./$I >> log.tmp ./$I >> log.tmp
if [ $? = 1 ]; then if [ $? = 0 ]; then
echo "passed $I" echo "passed $I"
else else
echo "FAILED $I" echo "FAILED $I"
let COUNTER=COUNTER+1 let COUNTER=COUNTER+1
fi fi
done done
echo "=> $COUNTER failures. See log.tmp for full dialogs." echo "=> $COUNTER failures. See log.tmp for full dialogs."
#!/usr/bin/env frida #!/usr/bin/env frida
ry8 spheres_raw ry8 spheres_raw
0 0
throw_unless(nk==8,"failed") exit_unless(nk==8,"failed")
exit(1) exit(0)
#!/usr/bin/env frida #!/usr/bin/env frida
throw_unless(0?2:3==3,"cond_expr_failed") exit_unless(0?2:3==3,"cond_expr_failed")
throw_unless(1?4:5==4,"cond_expr_failed") exit_unless(1?4:5==4,"cond_expr_failed")
exit(1) exit(0)
...@@ -169,8 +169,8 @@ double func_diehl( double a ) { ...@@ -169,8 +169,8 @@ double func_diehl( double a ) {
int func_exit( int a ) { exit(a); return 0; } int func_exit( int a ) { exit(a); return 0; }
int func_throw_if( int a, string s ) { if(a) throw s; return 0; } int func_exit_if( int a, string s ) { if(a) { cerr << s << "\n"; exit(1); } return 0; }
int func_throw_unless( int a, string s ) { if(!a) throw s; return 0; } int func_exit_unless( int a, string s ) { return func_exit_if( !a, s ); }
//************************************************************************************************** //**************************************************************************************************
//* Functions of two arguments //* Functions of two arguments
...@@ -591,10 +591,10 @@ void fbase_initialize() ...@@ -591,10 +591,10 @@ void fbase_initialize()
G->register_fct_d_d ( "lndiehl", func_lndiehl ); G->register_fct_d_d ( "lndiehl", func_lndiehl );
// f(2 args) // f(2 args)
G->register_fct_meta ( "throw_if", 2, "(x,s): throw s if x" ); G->register_fct_meta ( "exit_if", 2, "(x,s): throw s if x" );
G->register_fct_i_is ( "throw_if", func_throw_if ); G->register_fct_i_is ( "exit_if", func_exit_if );
G->register_fct_meta ( "throw_unless", 1, "(x,s): throw s if !x" ); G->register_fct_meta ( "exit_unless", 1, "(x,s): throw s if !x" );
G->register_fct_i_is ( "throw_unless", func_throw_unless ); G->register_fct_i_is ( "exit_unless", func_exit_unless );
G->register_fct_meta ( "min2", 2, "(x,y): the smaller of the two arguments x and y" ); G->register_fct_meta ( "min2", 2, "(x,y): the smaller of the two arguments x and y" );
G->register_fct_i_ii ( "min2", func_min ); G->register_fct_i_ii ( "min2", func_min );
G->register_fct_d_dd ( "min2", func_min ); G->register_fct_d_dd ( "min2", func_min );
......
# CMake build script for Tests # To run the tests on Linux, use 'make test' or 'ctest'.
# To select which tests to run, use 'ctest -R regex'.
# To see output from the individual tests, use 'ctest -V'.
# For more options, run 'ctest --help'.
include(cmake/utils.cmake) # defines cxx_executable, cxx_test include(cmake/utils.cmake) # defines cxx_executable, cxx_test
enable_testing() enable_testing()
# To run the tests on Linux, use 'make test' or 'ctest'.
# You can select which tests to run using 'ctest -R regex'.
# For more options, run 'ctest --help'.
include_directories( include_directories(
${gtest_SOURCE_DIR}/include ${gtest_SOURCE_DIR}/include
${gtest_SOURCE_DIR} ${gtest_SOURCE_DIR}
...@@ -32,7 +31,7 @@ set(test_link_libs ...@@ -32,7 +31,7 @@ set(test_link_libs
) )
# We glob test sources, though this is often considered evil. # We glob test sources, though this is often considered evil.
# Just touch Tests/CMakeLists.txt each time a test is added or withdrawn. # Just touch CMakeLists.txt each time a test is added or withdrawn.
file(GLOB test_sources "test[0-9]*.cpp") file(GLOB test_sources "test[0-9]*.cpp")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment