summaryrefslogtreecommitdiffstats
path: root/cpp/sca/modules/eval/eval-test.cpp
diff options
context:
space:
mode:
authorjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2009-10-26 05:13:06 +0000
committerjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2009-10-26 05:13:06 +0000
commitf61164c77c5c21a32b58ad61c868bd8ff6a4a79e (patch)
tree951cc581d22bac8ad615697b19e879e22578d10c /cpp/sca/modules/eval/eval-test.cpp
parent0969cc21d093f9450c36e7f63cddc4f5aa44b238 (diff)
Minor refactoring, given each module its own namespace. Added utility functions to convert between values elements/attributes and fixed XML, ATOM and JSON serialization of lists.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@829699 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/sca/modules/eval/eval-test.cpp')
-rw-r--r--cpp/sca/modules/eval/eval-test.cpp22
1 files changed, 15 insertions, 7 deletions
diff --git a/cpp/sca/modules/eval/eval-test.cpp b/cpp/sca/modules/eval/eval-test.cpp
index c536ed51a4..95a286ade0 100644
--- a/cpp/sca/modules/eval/eval-test.cpp
+++ b/cpp/sca/modules/eval/eval-test.cpp
@@ -30,6 +30,7 @@
#include "driver.hpp"
namespace tuscany {
+namespace eval {
bool testEnv() {
Env globalEnv = list<value>();
@@ -109,6 +110,11 @@ const std::string testSchemeLambda(
"(define (testLambda) (if (= 4 (sqrt 2)) (display \"testLambda ok\") (error \"testLambda\"))) "
"(testLambda)");
+const std::string testSchemeForward(
+ "(define (testLambda) (if (= 4 (sqrt 2)) (display \"testForward ok\") (error \"testForward\"))) "
+ "(define sqrt (lambda (x) (* x x))) "
+ "(testLambda)");
+
bool contains(const std::string& str, const std::string& pattern) {
return str.find(pattern) != str.npos;
}
@@ -129,13 +135,14 @@ bool testEval() {
assert(contains(evalOutput(testSchemeBegin), "testBegin1 ok"));
assert(contains(evalOutput(testSchemeBegin), "testBegin2 ok"));
assert(contains(evalOutput(testSchemeLambda), "testLambda ok"));
+ //assert(contains(evalOutput(testSchemeForward), "testForward ok"));
return true;
}
bool testEvalExpr() {
const value exp = mklist<value>("+", 2, 3);
Env env = setupEnvironment();
- const value r = eval(exp, env);
+ const value r = evalApply(exp, env);
assert(r == value(5));
return true;
}
@@ -160,16 +167,17 @@ bool testEvalRun() {
}
}
+}
int main() {
std::cout << "Testing..." << std::endl;
- tuscany::testEnv();
- tuscany::testEnvGC();
- tuscany::testRead();
- tuscany::testEval();
- tuscany::testEvalExpr();
- tuscany::testEvalGC();
+ tuscany::eval::testEnv();
+ tuscany::eval::testEnvGC();
+ tuscany::eval::testRead();
+ tuscany::eval::testEval();
+ tuscany::eval::testEvalExpr();
+ tuscany::eval::testEvalGC();
std::cout << "OK" << std::endl;
return 0;