summaryrefslogtreecommitdiffstats
path: root/cpp/sca/modules/eval/eval-test.cpp
diff options
context:
space:
mode:
authorjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2009-11-01 05:24:54 +0000
committerjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2009-11-01 05:24:54 +0000
commit9f187b46ae761e8275362d6c1533e9fe79028c7b (patch)
treee2625f63e0c84f172c877e1fe2cbe75adf678208 /cpp/sca/modules/eval/eval-test.cpp
parent24021bd09a0d5c9664565a244c24e0bdef0908b8 (diff)
Improved memory management using APR memory pools, changed frame allocation in eval library to support forward references and fixed memory leak in XML parsing code. Also simplified a bit the printing of lists to make them easier to read.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@831639 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r--cpp/sca/modules/eval/eval-test.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/cpp/sca/modules/eval/eval-test.cpp b/cpp/sca/modules/eval/eval-test.cpp
index 95a286ade0..584c8470b1 100644
--- a/cpp/sca/modules/eval/eval-test.cpp
+++ b/cpp/sca/modules/eval/eval-test.cpp
@@ -33,11 +33,13 @@ namespace tuscany {
namespace eval {
bool testEnv() {
+ gc_pool pool;
Env globalEnv = list<value>();
- Env env = extendEnvironment(mklist<value>("a"), mklist<value>(1), globalEnv);
+ Env env = extendEnvironment(mklist<value>("a"), mklist<value>(1), globalEnv, pool);
defineVariable("x", env, env);
- //assert(lookupVariableValue(value("x"), env) == env);
+ assert(lookupVariableValue(value("x"), env) == env);
assert(lookupVariableValue("a", env) == value(1));
+ cleanupEnvironment(env);
return true;
}
@@ -135,14 +137,15 @@ 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"));
+ assert(contains(evalOutput(testSchemeForward), "testForward ok"));
return true;
}
bool testEvalExpr() {
+ gc_pool pool;
const value exp = mklist<value>("+", 2, 3);
- Env env = setupEnvironment();
- const value r = evalApply(exp, env);
+ Env env = setupEnvironment(pool);
+ const value r = evalExpr(exp, env, pool);
assert(r == value(5));
return true;
}