Skip to content

Commit

Permalink
up sanity checks
Browse files Browse the repository at this point in the history
  • Loading branch information
kvoss committed Jun 9, 2021
1 parent b563f8d commit 0c33084
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ clean:
-rm *.so

test:
sh ./testit.sh
@sh ./testit.sh

30 changes: 30 additions & 0 deletions sanity-test-golden.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
-> ackley: 3.194178743769641
-> alpine: 0.6941110026558399
-> axis_parallel_hyperellipsoid: 2.3005
-> bukin_f6: 44.811177812216314
-> cross_in_tray: -1.4777274811045142
-> deceptive3: -0.0009897909414337454
-> dejong5: 12.670567474629571
-> drop_wave: -0.958928083376883
-> easom: -1.6344141224711163e-08
-> eggholder: -26.34161710307163
-> goldstein_price: 899.4140086400001
-> gramacy_lee: 0.6561
-> griewank: 0.07377871010504211
-> holder_table: -0.24769346068827464
-> levy: 0.7980912375904945
-> levy13: 3.4160458181093105
-> michalewicz: -8.515970871437583e-11
-> non_cont_rastrigin: 60.55
-> parabola: 0.5601
-> penalty1: 5.880180416027215
-> rastrigin: 60.54036728428271
-> rosenbrock: 34.53
-> schaffers_f6: 0.049217281823751846
-> schwefels_p222: 1.511224
-> shubert: 1.3647030563948594
-> six_hump_camel_back: -0.09380966666666667
-> sphere: 0.5601
-> step: 1.25
-> trefethen4: -0.13771083406418394
-> tripod: 101.69999999999999
12 changes: 8 additions & 4 deletions testit.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
echo "Sanity tests.."
python -c 'import cbench as cb
#!/bin/sh

echo "=> Running sanity tests.."
python3 -c 'import cbench as cb
xs = [0.1, 0.2, 0.3, 0.4, 0.51]
for el in dir(cb):
Expand All @@ -10,8 +12,10 @@ for el in dir(cb):
ans = fn(xs)
print(ans)
'
' > sanity-test-instance.log

diff -u sanity-test-golden.log sanity-test-instance.log

# echo "Timing test.."
# python -m timeit -s 'from cbench import michalewicz; xs = [0.1, 0.2, 0.3, 0.4, 0.51]' 'michalewicz(xs)'

echo "=> Done."

0 comments on commit 0c33084

Please sign in to comment.