r3929 - in trunk/sfi: . tests
- From: timj svn gnome org
- To: svn-commits-list gnome org
- Subject: r3929 - in trunk/sfi: . tests
- Date: Tue, 3 Oct 2006 11:59:11 -0400 (EDT)
Author: timj
Date: 2006-10-03 11:59:10 -0400 (Tue, 03 Oct 2006)
New Revision: 3929
Added:
trunk/sfi/tests/testcxx.cc
Removed:
trunk/sfi/testcxx.cc
Modified:
trunk/sfi/ChangeLog
trunk/sfi/Makefile.am
trunk/sfi/tests/Makefile.am
Log:
Tue Oct 3 17:57:59 2006 Tim Janik <timj gtk org>
* tests/testcxx.cc: moved here from sfi/.
Modified: trunk/sfi/ChangeLog
===================================================================
--- trunk/sfi/ChangeLog 2006-10-03 15:43:19 UTC (rev 3928)
+++ trunk/sfi/ChangeLog 2006-10-03 15:59:10 UTC (rev 3929)
@@ -1,3 +1,7 @@
+Tue Oct 3 17:57:59 2006 Tim Janik <timj gtk org>
+
+ * tests/testcxx.cc: moved here from sfi/.
+
Tue Oct 3 17:42:51 2006 Tim Janik <timj gtk org>
* testsfi.c: removed ring tests which are in tests/ring.c now.
Modified: trunk/sfi/Makefile.am
===================================================================
--- trunk/sfi/Makefile.am 2006-10-03 15:43:19 UTC (rev 3928)
+++ trunk/sfi/Makefile.am 2006-10-03 15:59:10 UTC (rev 3929)
@@ -79,16 +79,13 @@
EXTRA_DIST += sfidl-generator.hh sfidl-namespace.hh sfidl-options.hh sfidl-parser.hh sfidl-factory.hh sfidl-typelist.hh
EXTRA_DIST += sfidl-cbase.hh sfidl-clientc.hh sfidl-clientcxx.hh sfidl-corec.hh sfidl-corecxx.hh sfidl-cxxbase.hh sfidl-hostc.hh
-noinst_PROGRAMS = testsfi testcxx testsfidl
+noinst_PROGRAMS = testsfi testsfidl
progs_nosfi_LDADD = $(top_builddir)/birnet/libbirnet.o $(SFI_LIBS) -lm
progs_LDADD = $(top_builddir)/birnet/libbirnet.o libsfi.o $(SFI_LIBS) -lm
$(srcdir)/testsfi.c: testidl.h testidl.c
testsfi_SOURCES = testsfi.c dummy.cc
testsfi_LDADD = $(progs_LDADD)
testsfi_LDFLAGS =
-$(srcdir)/testcxx.cc: testidl.h testidl.c
-testcxx_SOURCES = testcxx.cc
-testcxx_LDADD = $(progs_LDADD)
$(srcdir)/testsfidl.cc: testidl.h testidl.c
testsfidl_SOURCES = testsfidl.cc $(common_idl_sources)
testsfidl_CFLAGS = $(AM_CFLAGS) # hack to cause glib-extra.c to be compiled twice (work around automake)
@@ -97,7 +94,7 @@
#
# TESTS
#
-TESTS = testsfi testcxx testsfidl
+TESTS = testsfi testsfidl
#
# TOYPROF: poor man's profiling toy
Deleted: trunk/sfi/testcxx.cc
===================================================================
--- trunk/sfi/testcxx.cc 2006-10-03 15:43:19 UTC (rev 3928)
+++ trunk/sfi/testcxx.cc 2006-10-03 15:59:10 UTC (rev 3929)
@@ -1,115 +0,0 @@
-/* SFI - Synthesis Fusion Kit Interface
- * Copyright (C) 2004 Tim Janik
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General
- * Public License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-#undef G_LOG_DOMAIN
-#define G_LOG_DOMAIN __FILE__
-// #define TEST_VERBOSE
-#include <birnet/birnettests.h>
-#include "sficxx.hh"
-#include <stdio.h>
-
-using namespace Sfi;
-
-struct Bar {
- int i;
-};
-typedef Sequence<Bar> BarSeq;
-typedef Sequence<Int> IntSeq;
-typedef struct {
- guint n_elements;
- Int *elements;
-} CIntSeq;
-
-int
-main (int argc,
- char *argv[])
-{
- TSTART ("Test String");
- TASSERT (sizeof (String) == sizeof (const char*));
- String s1 = "huhu";
- String s2;
- s2 += "huhu";
- TASSERT (strcmp (s1.c_str(), "huhu") == 0);
- TASSERT (s1 == s2);
- TASSERT (s1 + "HAHA" == std::string ("huhuHAHA"));
- s2 += "1";
- TASSERT (s1 != s2);
- String s3 = "huhu1";
- TASSERT (s2 == s3);
- TDONE();
-
- TSTART ("Test RecordHandle<>");
- TASSERT (sizeof (RecordHandle<Bar>) == sizeof (void*));
- RecordHandle<Bar> b1;
- TASSERT (b1.c_ptr() == NULL);
- TASSERT (b1.is_null());
- TASSERT (!b1);
- RecordHandle<Bar> b2 (INIT_DEFAULT);
- TASSERT (b2->i == 0);
- RecordHandle<Bar> b3 (INIT_EMPTY);
- Bar b;
- b.i = 5;
- RecordHandle<Bar> b4 = b;
- TASSERT (b4->i == 5);
- TASSERT (b2[0].i == 0);
- TDONE();
-
- TSTART ("Test IntSeq");
- TASSERT (sizeof (IntSeq) == sizeof (void*));
- IntSeq is (9);
- for (guint i = 0; i < 9; i++)
- is[i] = i;
- for (int i = 0; i < 9; i++)
- TASSERT (is[i] == i);
- is.resize (0);
- TASSERT (is.length() == 0);
- is.resize (12);
- TASSERT (is.length() == 12);
- for (guint i = 0; i < 12; i++)
- is[i] = 2147483600 + i;
- for (int i = 0; i < 12; i++)
- TASSERT (is[i] == 2147483600 + i);
- TDONE();
-
- TSTART ("Test IntSeq in C");
- CIntSeq *cis = *(CIntSeq**) &is;
- TASSERT (cis->n_elements == 12);
- for (int i = 0; i < 12; i++)
- TASSERT (cis->elements[i] == 2147483600 + i);
- TDONE();
-
- TSTART ("Test BarSeq");
- TASSERT (sizeof (BarSeq) == sizeof (void*));
- BarSeq bs (7);
- TASSERT (bs.length() == 7);
- for (guint i = 0; i < 7; i++)
- bs[i].i = i;
- for (int i = 0; i < 7; i++)
- TASSERT (bs[i].i == i);
- bs.resize (22);
- TASSERT (bs.length() == 22);
- for (guint i = 0; i < 22; i++)
- bs[i].i = 2147483600 + i;
- for (int i = 0; i < 22; i++)
- TASSERT (bs[i].i == 2147483600 + i);
- bs.resize (0);
- TASSERT (bs.length() == 0);
- TDONE();
-
- return 0;
-}
Modified: trunk/sfi/tests/Makefile.am
===================================================================
--- trunk/sfi/tests/Makefile.am 2006-10-03 15:43:19 UTC (rev 3928)
+++ trunk/sfi/tests/Makefile.am 2006-10-03 15:59:10 UTC (rev 3929)
@@ -15,3 +15,9 @@
TESTS += ring
ring_SOURCES = ring.c dummy.cc
ring_LDADD = $(progs_ldadd)
+
+# testcxx
+TESTS += testcxx
+testcxx_SOURCES = testcxx.cc
+testcxx_LDADD = $(progs_ldadd)
+$(srcdir)/testcxx.cc: ../testidl.h ../testidl.c
Copied: trunk/sfi/tests/testcxx.cc (from rev 3925, trunk/sfi/testcxx.cc)
===================================================================
--- trunk/sfi/testcxx.cc 2006-10-03 11:19:35 UTC (rev 3925)
+++ trunk/sfi/tests/testcxx.cc 2006-10-03 15:59:10 UTC (rev 3929)
@@ -0,0 +1,115 @@
+/* SFI - Synthesis Fusion Kit Interface
+ * Copyright (C) 2004 Tim Janik
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+#undef G_LOG_DOMAIN
+#define G_LOG_DOMAIN __FILE__
+// #define TEST_VERBOSE
+#include <birnet/birnettests.h>
+#include "../sficxx.hh"
+#include <stdio.h>
+
+using namespace Sfi;
+
+struct Bar {
+ int i;
+};
+typedef Sequence<Bar> BarSeq;
+typedef Sequence<Int> IntSeq;
+typedef struct {
+ guint n_elements;
+ Int *elements;
+} CIntSeq;
+
+int
+main (int argc,
+ char *argv[])
+{
+ TSTART ("Test String");
+ TASSERT (sizeof (String) == sizeof (const char*));
+ String s1 = "huhu";
+ String s2;
+ s2 += "huhu";
+ TASSERT (strcmp (s1.c_str(), "huhu") == 0);
+ TASSERT (s1 == s2);
+ TASSERT (s1 + "HAHA" == std::string ("huhuHAHA"));
+ s2 += "1";
+ TASSERT (s1 != s2);
+ String s3 = "huhu1";
+ TASSERT (s2 == s3);
+ TDONE();
+
+ TSTART ("Test RecordHandle<>");
+ TASSERT (sizeof (RecordHandle<Bar>) == sizeof (void*));
+ RecordHandle<Bar> b1;
+ TASSERT (b1.c_ptr() == NULL);
+ TASSERT (b1.is_null());
+ TASSERT (!b1);
+ RecordHandle<Bar> b2 (INIT_DEFAULT);
+ TASSERT (b2->i == 0);
+ RecordHandle<Bar> b3 (INIT_EMPTY);
+ Bar b;
+ b.i = 5;
+ RecordHandle<Bar> b4 = b;
+ TASSERT (b4->i == 5);
+ TASSERT (b2[0].i == 0);
+ TDONE();
+
+ TSTART ("Test IntSeq");
+ TASSERT (sizeof (IntSeq) == sizeof (void*));
+ IntSeq is (9);
+ for (guint i = 0; i < 9; i++)
+ is[i] = i;
+ for (int i = 0; i < 9; i++)
+ TASSERT (is[i] == i);
+ is.resize (0);
+ TASSERT (is.length() == 0);
+ is.resize (12);
+ TASSERT (is.length() == 12);
+ for (guint i = 0; i < 12; i++)
+ is[i] = 2147483600 + i;
+ for (int i = 0; i < 12; i++)
+ TASSERT (is[i] == 2147483600 + i);
+ TDONE();
+
+ TSTART ("Test IntSeq in C");
+ CIntSeq *cis = *(CIntSeq**) &is;
+ TASSERT (cis->n_elements == 12);
+ for (int i = 0; i < 12; i++)
+ TASSERT (cis->elements[i] == 2147483600 + i);
+ TDONE();
+
+ TSTART ("Test BarSeq");
+ TASSERT (sizeof (BarSeq) == sizeof (void*));
+ BarSeq bs (7);
+ TASSERT (bs.length() == 7);
+ for (guint i = 0; i < 7; i++)
+ bs[i].i = i;
+ for (int i = 0; i < 7; i++)
+ TASSERT (bs[i].i == i);
+ bs.resize (22);
+ TASSERT (bs.length() == 22);
+ for (guint i = 0; i < 22; i++)
+ bs[i].i = 2147483600 + i;
+ for (int i = 0; i < 22; i++)
+ TASSERT (bs[i].i == 2147483600 + i);
+ bs.resize (0);
+ TASSERT (bs.length() == 0);
+ TDONE();
+
+ return 0;
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]