summaryrefslogtreecommitdiffstats
path: root/sca-cpp/trunk/kernel
diff options
context:
space:
mode:
authorjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2010-05-29 19:44:35 +0000
committerjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2010-05-29 19:44:35 +0000
commite5a49fff24c79431782da107185431b7835ef492 (patch)
tree8bb6ca1aaad4fed82443dcb7d420533c31eb3eb4 /sca-cpp/trunk/kernel
parent7eef73b80c5f6c4f34f57cc48a46383689acecca (diff)
Fix distribution build, add missing files and samples and fix path to libraries. GCC 4.5 is used if available but not installed automatically.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@949435 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-cpp/trunk/kernel')
-rw-r--r--sca-cpp/trunk/kernel/Makefile.am7
-rw-r--r--sca-cpp/trunk/kernel/kernel-test.cpp2
-rw-r--r--sca-cpp/trunk/kernel/lambda-test.cpp25
3 files changed, 31 insertions, 3 deletions
diff --git a/sca-cpp/trunk/kernel/Makefile.am b/sca-cpp/trunk/kernel/Makefile.am
index 203dfbd269..a112ab5d0d 100644
--- a/sca-cpp/trunk/kernel/Makefile.am
+++ b/sca-cpp/trunk/kernel/Makefile.am
@@ -22,9 +22,12 @@ include_HEADERS = *.hpp
string_test_SOURCES = string-test.cpp
-test_LTLIBRARIES = libdynlib-test.la
-testdir = $(prefix)/test
+noinst_test_LTLIBRARIES = libdynlib-test.la
+noinst_testdir = `pwd`/tmp
libdynlib_test_la_SOURCES = dynlib-test.cpp
+noinst_DATA = libdynlib-test.so
+libdynlib-test.so:
+ ln -s .libs/libdynlib-test.so
kernel_test_SOURCES = kernel-test.cpp
diff --git a/sca-cpp/trunk/kernel/kernel-test.cpp b/sca-cpp/trunk/kernel/kernel-test.cpp
index 44ffe06b7b..177e2904ce 100644
--- a/sca-cpp/trunk/kernel/kernel-test.cpp
+++ b/sca-cpp/trunk/kernel/kernel-test.cpp
@@ -540,7 +540,7 @@ bool testStateMonad() {
}
bool testDynLib() {
- const lib dl(string(".libs/libdynlib-test") + dynlibExt);
+ const lib dl(string("libdynlib-test") + dynlibExt);
const failable<lambda<int(const int)> > sq(dynlambda<int(const int)>("csquare", dl));
assert(hasContent(sq));
lambda<int(const int)> l(content(sq));
diff --git a/sca-cpp/trunk/kernel/lambda-test.cpp b/sca-cpp/trunk/kernel/lambda-test.cpp
index de702b778a..a72f01fb43 100644
--- a/sca-cpp/trunk/kernel/lambda-test.cpp
+++ b/sca-cpp/trunk/kernel/lambda-test.cpp
@@ -27,9 +27,12 @@
#include "function.hpp"
#include "sstream.hpp"
#include "fstream.hpp"
+#include "perf.hpp"
namespace tuscany {
+#ifdef WANT_GCC45
+
const lambda<const int(const int)> inc(const int i) {
return [=](const int x)->const int {
return x + i;
@@ -64,12 +67,34 @@ bool testLambda() {
return true;
}
+const double fib_aux(const double n, const double a, const double b) {
+ return n == 0.0? a : fib_aux(n - 1.0, b, a + b);
+}
+
+const bool fibMapPerf() {
+ list<double> s = seq(0.0, 4999.0);
+ list<double> r = map<double, double>([](const double n)->const double { return fib_aux(n, 0.0, 1.0); }, s);
+ assert(5000 == length(r));
+ return true;
+}
+
+bool testCppPerf() {
+ cout << "Fibonacci map test " << (time([]()->const bool { return fibMapPerf(); }, 1, 1) / 5000) << " ms" << endl;
+ return true;
+}
+
+#endif
}
int main() {
tuscany::cout << "Testing..." << tuscany::endl;
+#ifdef WANT_GCC45
tuscany::testLambda();
+ tuscany::testCppPerf();
+#else
+ tuscany::cout << "Skipped GCC 4.5 tests" << tuscany::endl;
+#endif
tuscany::cout << "OK" << tuscany::endl;