From 36adc76235fb0a38e7042bc751f988b71627e2a0 Mon Sep 17 00:00:00 2001 From: jsdelfino Date: Tue, 11 Dec 2012 06:13:02 +0000 Subject: 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 --- sca-cpp/trunk/components/filedb/file-test.cpp | 32 +++++++++------------------ 1 file changed, 11 insertions(+), 21 deletions(-) (limited to 'sca-cpp/trunk/components/filedb/file-test.cpp') 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("a", "b"); - const list a = mklist(list() + "ns1:a" + (list() + "@xmlns:ns1" + string("http://aaa")) + (list() + "text" + string("Hey!"))); - const list b = mklist(list() + "ns1:b" + (list() + "@xmlns:ns1" + string("http://bbb")) + (list() + "text" + string("Hey!"))); + const list a = mklist(nilListValue + "ns1:a" + (nilListValue + "@xmlns:ns1" + string("http://aaa")) + (nilListValue + "text" + string("Hey!"))); + const list b = mklist(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 c; - getLoop(const value& k, FileDB& db) : k(k), db(db), - c(mklist(list() + "ns1:c" + (list() + "@xmlns:ns1" + string("http://ccc")) + (list() + "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("c"); - const list c = mklist(list() + "ns1:c" + (list() + "@xmlns:ns1" + string("http://ccc")) + (list() + "text" + string("Hey!"))); + const list c = mklist(nilListValue + "ns1:c" + (nilListValue + "@xmlns:ns1" + string("http://ccc")) + (nilListValue + "text" + string("Hey!"))); assert(hasContent(post(k, c, db))); - const lambda 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; } -- cgit v1.2.3