From 0c33084d7165184ac1cb3152c00b2bd1c6ef4da7 Mon Sep 17 00:00:00 2001 From: kvoss Date: Wed, 9 Jun 2021 16:53:51 -0600 Subject: [PATCH] up sanity checks --- Makefile | 2 +- sanity-test-golden.log | 30 ++++++++++++++++++++++++++++++ testit.sh | 12 ++++++++---- 3 files changed, 39 insertions(+), 5 deletions(-) create mode 100644 sanity-test-golden.log diff --git a/Makefile b/Makefile index 9612021..3574375 100644 --- a/Makefile +++ b/Makefile @@ -10,5 +10,5 @@ clean: -rm *.so test: - sh ./testit.sh + @sh ./testit.sh diff --git a/sanity-test-golden.log b/sanity-test-golden.log new file mode 100644 index 0000000..003e884 --- /dev/null +++ b/sanity-test-golden.log @@ -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 diff --git a/testit.sh b/testit.sh index 94609f5..4fa8d9e 100644 --- a/testit.sh +++ b/testit.sh @@ -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): @@ -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."