]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
New module 'moo-tests'.
authorBruno Haible <bruno@clisp.org>
Mon, 4 Dec 2006 13:35:38 +0000 (13:35 +0000)
committerBruno Haible <bruno@clisp.org>
Tue, 23 Jun 2009 10:14:26 +0000 (12:14 +0200)
14 files changed:
gnulib-local/ChangeLog
gnulib-local/Makefile.am
gnulib-local/modules/moo-tests [new file with mode: 0644]
gnulib-local/tests/test-moo-aroot.oo.c [new file with mode: 0644]
gnulib-local/tests/test-moo-aroot.oo.h [new file with mode: 0644]
gnulib-local/tests/test-moo-assign.c [new file with mode: 0644]
gnulib-local/tests/test-moo-asub1.oo.c [new file with mode: 0644]
gnulib-local/tests/test-moo-asub1.oo.h [new file with mode: 0644]
gnulib-local/tests/test-moo-root.oo.c [new file with mode: 0644]
gnulib-local/tests/test-moo-root.oo.h [new file with mode: 0644]
gnulib-local/tests/test-moo-sub1.oo.c [new file with mode: 0644]
gnulib-local/tests/test-moo-sub1.oo.h [new file with mode: 0644]
gnulib-local/tests/test-moo-sub2.oo.c [new file with mode: 0644]
gnulib-local/tests/test-moo-sub2.oo.h [new file with mode: 0644]

index 5a713bac929913f4c9530c8fcadf528c570efb3c..efde65c60db87e316837b56ddfa6dc99d1e7636e 100644 (file)
@@ -1,3 +1,19 @@
+2006-12-01  Bruno Haible  <bruno@clisp.org>
+
+       * modules/moo-tests: New file.
+       * tests/test-moo-aroot.oo.c: New file.
+       * tests/test-moo-aroot.oo.h: New file.
+       * tests/test-moo-assign.c: New file.
+       * tests/test-moo-asub1.oo.c: New file.
+       * tests/test-moo-asub1.oo.h: New file.
+       * tests/test-moo-root.oo.c: New file.
+       * tests/test-moo-root.oo.h: New file.
+       * tests/test-moo-sub1.oo.c: New file.
+       * tests/test-moo-sub1.oo.h: New file.
+       * tests/test-moo-sub2.oo.c: New file.
+       * tests/test-moo-sub2.oo.h: New file.
+       * Makefile.am (EXTRA_DIST): Add the new files.
+
 2006-12-01  Bruno Haible  <bruno@clisp.org>
 
        * modules/term-ostream-tests: New file.
index ff118289397c8358c657a180c8e7cdea9324e3ec..04c644c6ef2448e1524af879e03c859b46b6397b 100644 (file)
@@ -288,6 +288,7 @@ modules/libglib \
 modules/libxml \
 modules/memory-ostream \
 modules/moo \
+modules/moo-tests \
 modules/no-c++ \
 modules/ostream \
 modules/progreloc \
@@ -306,6 +307,17 @@ modules/xalloc-die \
 modules/xerror \
 modules/xgetcwd \
 modules/xreadlink \
+tests/test-moo-aroot.oo.c \
+tests/test-moo-aroot.oo.h \
+tests/test-moo-assign.c \
+tests/test-moo-asub1.oo.c \
+tests/test-moo-asub1.oo.h \
+tests/test-moo-root.oo.c \
+tests/test-moo-root.oo.h \
+tests/test-moo-sub1.oo.c \
+tests/test-moo-sub1.oo.h \
+tests/test-moo-sub2.oo.c \
+tests/test-moo-sub2.oo.h \
 tests/test-term-ostream.c \
 tests/test-term-ostream-xterm \
 tests/test-term-ostream-xterm.out \
diff --git a/gnulib-local/modules/moo-tests b/gnulib-local/modules/moo-tests
new file mode 100644 (file)
index 0000000..77fb335
--- /dev/null
@@ -0,0 +1,33 @@
+Files:
+tests/test-moo-root.oo.h
+tests/test-moo-root.oo.c
+tests/test-moo-sub1.oo.h
+tests/test-moo-sub1.oo.c
+tests/test-moo-sub2.oo.h
+tests/test-moo-sub2.oo.c
+tests/test-moo-aroot.oo.h
+tests/test-moo-aroot.oo.c
+tests/test-moo-asub1.oo.h
+tests/test-moo-asub1.oo.c
+tests/test-moo-assign.c
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+test-moo-root.h test-moo-root.c root.priv.h root.vt.h : $(top_srcdir)/build-aux/moopp test-moo-root.oo.h test-moo-root.oo.c
+       $(top_srcdir)/build-aux/moopp $(srcdir)/test-moo-root.oo.c $(srcdir)/test-moo-root.oo.h
+
+test-moo-sub1.h test-moo-sub1.c sub1.priv.h sub1.vt.h : $(top_srcdir)/build-aux/moopp test-moo-root.oo.h test-moo-sub1.oo.h test-moo-sub1.oo.c
+       $(top_srcdir)/build-aux/moopp $(srcdir)/test-moo-sub1.oo.c $(srcdir)/test-moo-sub1.oo.h $(srcdir)/test-moo-root.oo.h
+
+test-moo-sub2.h test-moo-sub2.c sub2.priv.h sub2.vt.h : $(top_srcdir)/build-aux/moopp test-moo-root.oo.h test-moo-sub1.oo.h test-moo-sub2.oo.h test-moo-sub2.oo.c
+       $(top_srcdir)/build-aux/moopp $(srcdir)/test-moo-sub2.oo.c $(srcdir)/test-moo-sub2.oo.h $(srcdir)/test-moo-sub1.oo.h $(srcdir)/test-moo-root.oo.h
+
+test-moo-aroot.h test-moo-aroot.c aroot.priv.h aroot.vt.h : $(top_srcdir)/build-aux/moopp test-moo-aroot.oo.h test-moo-aroot.oo.c
+       $(top_srcdir)/build-aux/moopp $(srcdir)/test-moo-aroot.oo.c $(srcdir)/test-moo-aroot.oo.h
+
+test-moo-asub1.h test-moo-asub1.c asub1.priv.h asub1.vt.h : $(top_srcdir)/build-aux/moopp test-moo-aroot.oo.h test-moo-asub1.oo.h test-moo-asub1.oo.c
+       $(top_srcdir)/build-aux/moopp $(srcdir)/test-moo-asub1.oo.c $(srcdir)/test-moo-asub1.oo.h $(srcdir)/test-moo-aroot.oo.h
+
diff --git a/gnulib-local/tests/test-moo-aroot.oo.c b/gnulib-local/tests/test-moo-aroot.oo.c
new file mode 100644 (file)
index 0000000..ba67742
--- /dev/null
@@ -0,0 +1,6 @@
+#include <config.h>
+
+/* Specification.  */
+#include "test-moo-aroot.h"
+
+#pragma implementation
diff --git a/gnulib-local/tests/test-moo-aroot.oo.h b/gnulib-local/tests/test-moo-aroot.oo.h
new file mode 100644 (file)
index 0000000..ef07447
--- /dev/null
@@ -0,0 +1,10 @@
+#include <stdlib.h>
+#include "moo.h"
+
+/* Define an abstract root class. */
+struct aroot
+{
+methods:
+  int write (aroot_t x, void *buf, size_t len);
+  void do_free (aroot_t x);
+};
diff --git a/gnulib-local/tests/test-moo-assign.c b/gnulib-local/tests/test-moo-assign.c
new file mode 100644 (file)
index 0000000..079668b
--- /dev/null
@@ -0,0 +1,32 @@
+/* Test assignments.
+   Errors are signalled in C++ mode only, not by a C compiler.  */
+#include "test-moo-sub2.h"
+
+void foo ()
+{
+  root_t a;
+  sub1_t b;
+  sub2_t c;
+
+  /* Test initializations.  */
+  root_t a1 = a;
+  root_t a2 = b;
+  root_t a3 = c;
+  sub1_t b1 = a;       /* ERROR */
+  sub1_t b2 = b;
+  sub1_t b3 = c;
+  sub2_t c1 = a;       /* ERROR */
+  sub2_t c2 = b;       /* ERROR */
+  sub2_t c3 = c;
+
+  /* Test assignments.  */
+  a = a1;
+  a = b1;
+  a = c1;
+  b = a2;      /* ERROR */
+  b = b2;
+  b = c2;
+  c = a3;      /* ERROR */
+  c = b3;      /* ERROR */
+  c = c3;
+}
diff --git a/gnulib-local/tests/test-moo-asub1.oo.c b/gnulib-local/tests/test-moo-asub1.oo.c
new file mode 100644 (file)
index 0000000..bb5da83
--- /dev/null
@@ -0,0 +1,17 @@
+#include <config.h>
+
+/* Specification.  */
+#include "test-moo-asub1.h"
+
+#pragma implementation
+
+int asub1::write (asub1_t x, void *buf, size_t len)
+{
+  fwrite (buf, 1, len, x->fp);
+  return 0;
+}
+
+void asub1::do_free (asub1_t x)
+{
+  free (x);
+}
diff --git a/gnulib-local/tests/test-moo-asub1.oo.h b/gnulib-local/tests/test-moo-asub1.oo.h
new file mode 100644 (file)
index 0000000..3a6620d
--- /dev/null
@@ -0,0 +1,10 @@
+#include "test-moo-aroot.h"
+
+#include <stdio.h>
+
+/* Define a subclass.  */
+struct asub1 : struct aroot
+{
+  FILE *fp;
+methods:
+};
diff --git a/gnulib-local/tests/test-moo-root.oo.c b/gnulib-local/tests/test-moo-root.oo.c
new file mode 100644 (file)
index 0000000..00a72fe
--- /dev/null
@@ -0,0 +1,19 @@
+#include <config.h>
+
+/* Specification.  */
+#include "test-moo-root.h"
+
+#include <stdio.h>
+
+#pragma implementation
+
+int root::write (root_t x, void *buf, size_t len)
+{
+  fwrite (buf, 1, len, stdout);
+  return 0;
+}
+
+void root::do_free (root_t x)
+{
+  free (x);
+}
diff --git a/gnulib-local/tests/test-moo-root.oo.h b/gnulib-local/tests/test-moo-root.oo.h
new file mode 100644 (file)
index 0000000..4fe9d3f
--- /dev/null
@@ -0,0 +1,10 @@
+#include <stdlib.h>
+#include "moo.h"
+
+/* Define a root class. */
+struct root
+{
+methods:
+  int write (root_t x, void *buf, size_t len);
+  void do_free (root_t x);
+};
diff --git a/gnulib-local/tests/test-moo-sub1.oo.c b/gnulib-local/tests/test-moo-sub1.oo.c
new file mode 100644 (file)
index 0000000..bc928da
--- /dev/null
@@ -0,0 +1,13 @@
+#include <config.h>
+
+/* Specification.  */
+#include "test-moo-sub1.h"
+
+#pragma implementation
+
+/* Test an override.  */
+int sub1::write (sub1_t x, void *buf, size_t len)
+{
+  fwrite (buf, 1, len, x->fp);
+  return 0;
+}
diff --git a/gnulib-local/tests/test-moo-sub1.oo.h b/gnulib-local/tests/test-moo-sub1.oo.h
new file mode 100644 (file)
index 0000000..5814394
--- /dev/null
@@ -0,0 +1,10 @@
+#include "test-moo-root.h"
+
+#include <stdio.h>
+
+/* Define a subclass.  */
+struct sub1 : struct root
+{
+  FILE *fp;
+methods:
+};
diff --git a/gnulib-local/tests/test-moo-sub2.oo.c b/gnulib-local/tests/test-moo-sub2.oo.c
new file mode 100644 (file)
index 0000000..7b61507
--- /dev/null
@@ -0,0 +1,20 @@
+#include <config.h>
+
+/* Specification.  */
+#include "test-moo-sub2.h"
+
+#include <stdio.h>
+
+#pragma implementation
+
+void
+sub2::begin_indent (sub2_t x)
+{
+  x->indent++;
+}
+
+void
+sub2::end_indent (sub2_t x)
+{
+  x->indent--;
+}
diff --git a/gnulib-local/tests/test-moo-sub2.oo.h b/gnulib-local/tests/test-moo-sub2.oo.h
new file mode 100644 (file)
index 0000000..d03b36a
--- /dev/null
@@ -0,0 +1,10 @@
+#include "test-moo-sub1.h"
+
+/* Define a subclass.  */
+struct sub2 : struct sub1
+{
+  int indent;
+methods:
+  void begin_indent (sub2_t x);
+  void end_indent (sub2_t x);
+};