summaryrefslogtreecommitdiffstats
path: root/sca-cpp/trunk/components/filedb/file-test.cpp
diff options
context:
space:
mode:
authorjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2012-12-11 06:13:02 +0000
committerjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2012-12-11 06:13:02 +0000
commit36adc76235fb0a38e7042bc751f988b71627e2a0 (patch)
treefc83b3f4e0afeb3932c8d200f5493f0a8d6c4619 /sca-cpp/trunk/components/filedb/file-test.cpp
parent86b1de85536e93c59a25702a5a2d3e384202ffd2 (diff)
Changes to get successful C++11 based build. Code cleanup, dependency upgrades, and const + inline optimizations in components, samples, and app hosting server.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1420007 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-cpp/trunk/components/filedb/file-test.cpp')
-rw-r--r--sca-cpp/trunk/components/filedb/file-test.cpp32
1 files changed, 11 insertions, 21 deletions
diff --git a/sca-cpp/trunk/components/filedb/file-test.cpp b/sca-cpp/trunk/components/filedb/file-test.cpp
index ff57bd79ce..5270967ccb 100644
--- a/sca-cpp/trunk/components/filedb/file-test.cpp
+++ b/sca-cpp/trunk/components/filedb/file-test.cpp
@@ -32,12 +32,12 @@
namespace tuscany {
namespace filedb {
-bool testFileDB(const string& dbname, const string& format) {
- FileDB db(dbname, format);
+const bool testFileDB(const string& dbname, const string& format) {
+ const FileDB db(dbname, format);
const value k = mklist<value>("a", "b");
- const list<value> a = mklist<value>(list<value>() + "ns1:a" + (list<value>() + "@xmlns:ns1" + string("http://aaa")) + (list<value>() + "text" + string("Hey!")));
- const list<value> b = mklist<value>(list<value>() + "ns1:b" + (list<value>() + "@xmlns:ns1" + string("http://bbb")) + (list<value>() + "text" + string("Hey!")));
+ const list<value> a = mklist<value>(nilListValue + "ns1:a" + (nilListValue + "@xmlns:ns1" + string("http://aaa")) + (nilListValue + "text" + string("Hey!")));
+ const list<value> b = mklist<value>(nilListValue + "ns1:b" + (nilListValue + "@xmlns:ns1" + string("http://bbb")) + (nilListValue + "text" + string("Hey!")));
assert(hasContent(post(k, a, db)));
assert((get(k, db)) == value(a));
@@ -50,27 +50,17 @@ bool testFileDB(const string& dbname, const string& format) {
return true;
}
-struct getLoop {
- const value k;
- FileDB& db;
- const list<value> c;
- getLoop(const value& k, FileDB& db) : k(k), db(db),
- c(mklist<value>(list<value>() + "ns1:c" + (list<value>() + "@xmlns:ns1" + string("http://ccc")) + (list<value>() + "text" + string("Hey!")))) {
- }
- const bool operator()() const {
- assert((get(k, db)) == value(c));
- return true;
- }
-};
-
-bool testGetPerf(const string& dbname, const string& format) {
- FileDB db(dbname, format);
+const bool testGetPerf(const string& dbname, const string& format) {
+ const FileDB db(dbname, format);
const value k = mklist<value>("c");
- const list<value> c = mklist<value>(list<value>() + "ns1:c" + (list<value>() + "@xmlns:ns1" + string("http://ccc")) + (list<value>() + "text" + string("Hey!")));
+ const list<value> c = mklist<value>(nilListValue + "ns1:c" + (nilListValue + "@xmlns:ns1" + string("http://ccc")) + (nilListValue + "text" + string("Hey!")));
assert(hasContent(post(k, c, db)));
- const lambda<bool()> gl = getLoop(k, db);
+ const blambda gl = [k, c, db]() -> const bool {
+ assert((get(k, db)) == value(c));
+ return true;
+ };
cout << "FileDB get test " << time(gl, 5, 5000) << " ms" << endl;
return true;
}