aboutsummaryrefslogtreecommitdiff
path: root/src/tests/formula.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2011-03-30 22:33:41 +0000
committerMike Buland <eichlan@xagasoft.com>2011-03-30 22:33:41 +0000
commit4b9289cfb260f4bcecaf23a810584ef6ef8e8501 (patch)
tree79136af08c7e42ba3322f0d73e9779e4354b318a /src/tests/formula.cpp
parentc7636dc954eddfe58f7959392602fbc9072d77e7 (diff)
downloadlibbu++-4b9289cfb260f4bcecaf23a810584ef6ef8e8501.tar.gz
libbu++-4b9289cfb260f4bcecaf23a810584ef6ef8e8501.tar.bz2
libbu++-4b9289cfb260f4bcecaf23a810584ef6ef8e8501.tar.xz
libbu++-4b9289cfb260f4bcecaf23a810584ef6ef8e8501.zip
Ok, string stuff is working much, much better, a load of new unit tests have
been added, and I deleted a whole slew of stupid old tests that I don't need.
Diffstat (limited to 'src/tests/formula.cpp')
-rw-r--r--src/tests/formula.cpp56
1 files changed, 0 insertions, 56 deletions
diff --git a/src/tests/formula.cpp b/src/tests/formula.cpp
deleted file mode 100644
index a90ddaf..0000000
--- a/src/tests/formula.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
1/*
2 * Copyright (C) 2007-2011 Xagasoft, All rights reserved.
3 *
4 * This file is part of the libbu++ library and is released under the
5 * terms of the license contained in the file LICENSE.
6 */
7
8#include "bu/formula.h"
9#include <math.h>
10
11int main( int argc, char *argv[] )
12{
13 if( argc < 2 )
14 {
15 printf("usage: %s <formula>\n", argv[0] );
16 return -1;
17 }
18 Bu::Formula<uint32_t> uForm;
19 Bu::Formula<double> dForm;
20
21 class DblCeilFunc : 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 DblCeilFunc() );
31
32 class IntCeilFunc : public Bu::Formula<uint32_t>::Func
33 {
34 public:
35 virtual uint32_t operator()( uint32_t x )
36 {
37 return x;
38 }
39 };
40
41 uForm.hFunc.insert( "ceil", new IntCeilFunc() );
42
43 uForm.hVars.insert("x", 10 );
44 dForm.hVars.insert("x", 10.00 );
45 uForm.hVars.insert("y", 10 );
46 dForm.hVars.insert("y", 10.00 );
47
48 for( int j = 1; j < argc; j++ )
49 {
50 printf("u: %s = %u\n", argv[j], uForm.run( argv[j] ) );
51 printf("d: %s = %f\n", argv[j], dForm.run( argv[j] ) );
52 }
53
54 return 0;
55}
56