]> gitweb.factorcode.org Git - factor.git/commitdiff
source file for testing c++ stuff
authorJoe Groff <arcata@gmail.com>
Wed, 14 Apr 2010 22:41:40 +0000 (15:41 -0700)
committerJoe Groff <arcata@gmail.com>
Wed, 14 Apr 2010 22:46:23 +0000 (15:46 -0700)
extra/alien/cxx/tests/test.cpp [new file with mode: 0644]

diff --git a/extra/alien/cxx/tests/test.cpp b/extra/alien/cxx/tests/test.cpp
new file mode 100644 (file)
index 0000000..d4a6995
--- /dev/null
@@ -0,0 +1,31 @@
+namespace Namespace {
+    int namespaced(int x, int y) { return x + y; }
+}
+
+double toplevel(double x, double y) { return x + y; }
+double toplevel(double x, double y, double z) { return x + y + z; }
+
+class Class
+{
+    unsigned x;
+
+    Class();
+    Class(unsigned _x);
+
+    unsigned member(unsigned y);
+    unsigned member(unsigned y) const;
+
+    unsigned static_member(unsigned x, unsigned y);
+};
+
+Class::Class() : x(42) { }
+Class::Class(unsigned _x) : x(_x) { }
+unsigned Class::member(unsigned y) { return x += y; }
+unsigned Class::member(unsigned y) const { return x + y; }
+unsigned Class::static_member(unsigned x, unsigned y) { return Class(x).member(y); }
+
+template<typename T>
+T templated(T x, T y) { return x + y; }
+
+template int templated<int>(int x, int y);
+template double templated<double>(double x, double y);