2008-08-08 12:35:13 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2008 Andrew Garrett.
|
|
|
|
* Copyright (c) 2008 River Tarnell <river@wikimedia.org>
|
|
|
|
* Derived from public domain code contributed by Victor Vasiliev.
|
|
|
|
*
|
|
|
|
* Permission is granted to anyone to use this software for any purpose,
|
|
|
|
* including commercial applications, and to alter it and redistribute it
|
|
|
|
* freely. This software is provided 'as-is', without any express or
|
|
|
|
* implied warranty.
|
|
|
|
*/
|
|
|
|
|
2008-08-08 00:01:22 +00:00
|
|
|
#include "filter_evaluator.h"
|
2008-08-03 00:36:27 +00:00
|
|
|
#include "affunctions.h"
|
|
|
|
|
|
|
|
int main( int argc, char** argv ) {
|
2008-08-09 16:38:39 +00:00
|
|
|
afp::u32filter_evaluator f;
|
2008-08-03 00:36:27 +00:00
|
|
|
bool result = false;
|
|
|
|
|
2008-08-07 13:53:18 +00:00
|
|
|
for(int i=0;i<=100;i++) {
|
2008-08-08 00:01:22 +00:00
|
|
|
try {
|
2008-08-09 16:38:39 +00:00
|
|
|
f.add_variable(
|
|
|
|
make_u32string("foo"),
|
|
|
|
afp::u32datum::from_string(
|
|
|
|
make_u32string("love")));
|
|
|
|
result = f.evaluate(make_u32string("specialratio(\"foo;\") == 0.25"));
|
2008-08-08 03:23:34 +00:00
|
|
|
} catch (afp::exception* excep) {
|
2008-08-08 00:01:22 +00:00
|
|
|
printf( "Exception: %s\n", excep->what() );
|
|
|
|
}
|
2008-08-03 00:36:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (result) {
|
2008-08-09 16:38:39 +00:00
|
|
|
std::cout << "success\n";
|
2008-08-03 00:36:27 +00:00
|
|
|
} else {
|
2008-08-09 16:38:39 +00:00
|
|
|
std::cout << "failed\n";
|
2008-08-03 00:36:27 +00:00
|
|
|
}
|
|
|
|
}
|