aboutsummaryrefslogtreecommitdiff
path: root/src/tests/formula.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/tests/formula.cpp')
-rw-r--r--src/tests/formula.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/tests/formula.cpp b/src/tests/formula.cpp
index 429c306..b3b0d5c 100644
--- a/src/tests/formula.cpp
+++ b/src/tests/formula.cpp
@@ -6,6 +6,7 @@
6 */ 6 */
7 7
8#include "bu/formula.h" 8#include "bu/formula.h"
9#include <math.h>
9 10
10int main( int argc, char *argv[] ) 11int main( int argc, char *argv[] )
11{ 12{
@@ -17,7 +18,18 @@ int main( int argc, char *argv[] )
17 Bu::Formula<uint32_t> uForm; 18 Bu::Formula<uint32_t> uForm;
18 Bu::Formula<double> dForm; 19 Bu::Formula<double> dForm;
19 20
20 printf("u: %s = %u\n", argv[1], uForm.run( argv[1] ) ); 21 class CeilFunc : public Bu::Formula<double>::Func
22 {
23 public:
24 virtual double operator()( double x )
25 {
26 return ceil( x );
27 }
28 };
29
30 dForm.hFunc.insert( "ceil", new CeilFunc() );
31
32// printf("u: %s = %u\n", argv[1], uForm.run( argv[1] ) );
21 printf("d: %s = %f\n", argv[1], dForm.run( argv[1] ) ); 33 printf("d: %s = %f\n", argv[1], dForm.run( argv[1] ) );
22 34
23 return 0; 35 return 0;