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
Showing
with 82 additions and 63 deletions
......@@ -56,3 +56,4 @@ add_subdirectory(src)
add_subdirectory(share)
add_subdirectory(man)
add_subdirectory(utest)
add_subdirectory(ftest)
# 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'.
enable_testing()
# We glob test sources, though this is often considered evil.
# Just touch CMakeLists.txt each time a test is added or withdrawn.
file(GLOB test_sources "*.f2t")
foreach(test_src ${test_sources})
# remove directory path and suffix, to retain just the name of the test
string(REGEX REPLACE ".*/" "" test_name "${test_src}")
string(REGEX REPLACE ".f2t$" "" test_name "${test_name}")
add_test(${test_name} "${test_src}")
endforeach(test_src)
#!/usr/bin/env frida
throw_unless(2+3==5,"arithmetic_failure")
throw_unless(0.2+.3==.5,"arithmetic_failure")
throw_unless(0.2+3==3.2,"arithmetic_failure")
throw_unless(2<3,"arithmetic_failure")
throw_unless(!(3<3),"arithmetic_failure")
throw_unless(3<=3,"arithmetic_failure")
throw_unless(3.1>3,"arithmetic_failure")
throw_unless(!(3.>3),"arithmetic_failure")
throw_unless(!(-3.<-3),"arithmetic_failure")
exit(1)
\ No newline at end of file
exit_unless(2+3==5,"arithmetic_failure")
exit_unless(0.2+.3==.5,"arithmetic_failure")
exit_unless(0.2+3==3.2,"arithmetic_failure")
exit_unless(2<3,"arithmetic_failure")
exit_unless(!(3<3),"arithmetic_failure")
exit_unless(3<=3,"arithmetic_failure")
exit_unless(3.1>3,"arithmetic_failure")
exit_unless(!(3.>3),"arithmetic_failure")
exit_unless(!(-3.<-3),"arithmetic_failure")
exit(0)
\ No newline at end of file
#!/usr/bin/env frida
cca sin(t)
throw_unless(abs(integrate(0,pi)-2)<1e-14,"integration_failed")
exit(1)
\ No newline at end of file
exit_unless(abs(integrate(0,pi)-2)<1e-14,"integration_failed")
exit(0)
\ No newline at end of file
#!/usr/bin/env frida
throw_unless(abs(5/3-5.0/3.0)<1e-14,"fp_division_failed")
throw_unless(5//3==1,"int_division_failed")
throw_unless(5%3==2,"modulo_failed")
exit(1)
\ No newline at end of file
exit_unless(abs(5/3-5.0/3.0)<1e-14,"fp_division_failed")
exit_unless(5//3==1,"int_division_failed")
exit_unless(5%3==2,"modulo_failed")
exit(0)
\ No newline at end of file
......@@ -5,6 +5,6 @@ oy! 7*i
cc p0*t
cwc
cf
throw_unless(abs(p0-7)<1e-13,"fit_failed")
throw_unless(abs(f(1.5)-10.5)<1e-13,"curve_eval_failed")
exit(1)
exit_unless(abs(p0-7)<1e-13,"fit_failed")
exit_unless(abs(f(1.5)-10.5)<1e-13,"curve_eval_failed")
exit(0)
......@@ -4,4 +4,4 @@ oy 100*(j+x^1.1)
ody! sqrt(1+y)
cc p0+p1*t
cf
exit(1)
exit(0)
......@@ -10,4 +10,4 @@ cp
cg 1
cf
cp
exit(1)
exit(0)
......@@ -5,4 +5,4 @@ fl dat-qel dat-res
cp
cf
cp
exit(1)
exit(0)
......@@ -11,4 +11,4 @@ cg 1
m/ 0
cf
cp
exit(1)
exit(0)
......@@ -5,4 +5,4 @@ cc p0+p1*(t-p2)
cwc
cr y>.1
cf
exit(1)
exit(0)
......@@ -11,6 +11,6 @@ op1 40
op2 1e-8
cv 2
cf
throw_unless(abs(p0[4,0]-.15)<.05,"shifted_resol_fit_failed")
throw_unless(abs(p1[4,0]-80)<1,"shifted_resol_fit_failed")
exit(1)
exit_unless(abs(p0[4,0]-.15)<.05,"shifted_resol_fit_failed")
exit_unless(abs(p1[4,0]-80)<1,"shifted_resol_fit_failed")
exit(0)
......@@ -9,4 +9,4 @@ cwc
cf
4:7 mfj
cp
exit(1)
exit(0)
......@@ -3,14 +3,14 @@ fm 1 1000 h
oy! 1
m/ 33,100:300:10
oy! 0
throw_unless(y[,32,0]==0,"failed")
throw_unless(y[,33,0]==1,"failed")
throw_unless(y[,100,0]==1,"failed")
throw_unless(y[,101,0]==0,"failed")
exit_unless(y[,32,0]==0,"failed")
exit_unless(y[,33,0]==1,"failed")
exit_unless(y[,100,0]==1,"failed")
exit_unless(y[,101,0]==0,"failed")
m/-
oy! 2
throw_unless(y[,32,0]==2,"failed")
throw_unless(y[,33,0]==2,"failed")
throw_unless(y[,100,0]==2,"failed")
throw_unless(y[,101,0]==2,"failed")
exit(1)
\ No newline at end of file
exit_unless(y[,32,0]==2,"failed")
exit_unless(y[,33,0]==2,"failed")
exit_unless(y[,100,0]==2,"failed")
exit_unless(y[,101,0]==2,"failed")
exit(0)
\ No newline at end of file
......@@ -4,6 +4,6 @@ oy! 10*j+i
oz0! 100*j
0 oi y[,,1]
1 oy z0[0,i]
throw_unless(x[2,0,1]==100,"x_wrong")
throw_unless(y[2,0,1]==100,"y_wrong")
exit(1)
\ No newline at end of file
exit_unless(x[2,0,1]==100,"x_wrong")
exit_unless(y[2,0,1]==100,"y_wrong")
exit(0)
\ No newline at end of file
#!/usr/bin/env frida
fm 1000 1 h
throw_unless(ni==1000,"mpr_failed")
exit_unless(ni==1000,"mpr_failed")
mpr 0:899
throw_unless(ni==900,"mpr_failed")
exit_unless(ni==900,"mpr_failed")
mpr 50:
throw_unless(ni==850,"mpr_failed")
exit_unless(ni==850,"mpr_failed")
mpr :799
throw_unless(ni==800,"mpr_failed")
exit_unless(ni==800,"mpr_failed")
mpr ::4
throw_unless(ni==200,"mpr_failed")
exit_unless(ni==200,"mpr_failed")
mpd ::4
throw_unless(ni==150,"mpr_failed")
exit_unless(ni==150,"mpr_failed")
mpr 0:119:3
throw_unless(ni==40,"mpr_failed")
exit_unless(ni==40,"mpr_failed")
mpd 0:39:4
throw_unless(ni==30,"mpr_failed")
exit(1)
\ No newline at end of file
exit_unless(ni==30,"mpr_failed")
exit(0)
\ No newline at end of file
......@@ -2,14 +2,14 @@
fm 9 1 h
0 oy 3+i
1 mpa 0,3
throw_unless(abs(y[2,0,0]-(3+1))<1e-15,"mpa_test11")
throw_unless(abs(y[2,0,1]-(3+5.5))<1e-15,"mpa_test12")
exit_unless(abs(y[2,0,0]-(3+1))<1e-15,"mpa_test11")
exit_unless(abs(y[2,0,1]-(3+5.5))<1e-15,"mpa_test12")
1 mpaf 3
throw_unless(ni[3,0]==3,"mpa_test20")
throw_unless(abs(y[3,0,0]-(3+1))<1e-15,"mpa_test21")
throw_unless(abs(y[3,0,2]-(3+7))<1e-15,"mpa_test22")
exit_unless(ni[3,0]==3,"mpa_test20")
exit_unless(abs(y[3,0,0]-(3+1))<1e-15,"mpa_test21")
exit_unless(abs(y[3,0,2]-(3+7))<1e-15,"mpa_test22")
1 mpaf 4
throw_unless(ni[4,0]==2,"mpa_test30")
throw_unless(abs(y[4,0,0]-(3+1.5))<1e-15,"mpa_test31")
throw_unless(abs(y[4,0,1]-(3+5.5))<1e-15,"mpa_test32")
exit(1)
exit_unless(ni[4,0]==2,"mpa_test30")
exit_unless(abs(y[4,0,0]-(3+1.5))<1e-15,"mpa_test31")
exit_unless(abs(y[4,0,1]-(3+5.5))<1e-15,"mpa_test32")
exit(0)
......@@ -3,4 +3,4 @@ fm 7 7 h
oy j+i
oi avge
1 mr y[2,0,j]>7
exit(1)
exit(0)
......@@ -4,5 +4,5 @@ fm 1 2 h2
fm 1 3 h3
fm 3 1 out
oy nj[i]
throw_unless(sum==6,"sum_wrong")
exit(1)
\ No newline at end of file
exit_unless(sum==6,"sum_wrong")
exit(0)
\ No newline at end of file
#!/usr/bin/env frida
fm 11 1 h
oy i
throw_unless(avge==5,"final_result_wrong")
exit(1)
\ No newline at end of file
exit_unless(avge==5,"final_result_wrong")
exit(0)
\ No newline at end of file
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