From: Bruno Haible Date: Mon, 4 Dec 2006 13:35:38 +0000 (+0000) Subject: New module 'moo-tests'. X-Git-Tag: v0.17~610 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=720535066aef552d5171d04db2327d413b92c6ca;p=thirdparty%2Fgettext.git New module 'moo-tests'. --- diff --git a/gnulib-local/ChangeLog b/gnulib-local/ChangeLog index 5a713bac9..efde65c60 100644 --- a/gnulib-local/ChangeLog +++ b/gnulib-local/ChangeLog @@ -1,3 +1,19 @@ +2006-12-01 Bruno Haible + + * 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 * modules/term-ostream-tests: New file. diff --git a/gnulib-local/Makefile.am b/gnulib-local/Makefile.am index ff1182893..04c644c6e 100644 --- a/gnulib-local/Makefile.am +++ b/gnulib-local/Makefile.am @@ -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 index 000000000..77fb33583 --- /dev/null +++ b/gnulib-local/modules/moo-tests @@ -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 index 000000000..ba67742db --- /dev/null +++ b/gnulib-local/tests/test-moo-aroot.oo.c @@ -0,0 +1,6 @@ +#include + +/* 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 index 000000000..ef07447bb --- /dev/null +++ b/gnulib-local/tests/test-moo-aroot.oo.h @@ -0,0 +1,10 @@ +#include +#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 index 000000000..079668b77 --- /dev/null +++ b/gnulib-local/tests/test-moo-assign.c @@ -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 index 000000000..bb5da8381 --- /dev/null +++ b/gnulib-local/tests/test-moo-asub1.oo.c @@ -0,0 +1,17 @@ +#include + +/* 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 index 000000000..3a6620d0b --- /dev/null +++ b/gnulib-local/tests/test-moo-asub1.oo.h @@ -0,0 +1,10 @@ +#include "test-moo-aroot.h" + +#include + +/* 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 index 000000000..00a72fe4d --- /dev/null +++ b/gnulib-local/tests/test-moo-root.oo.c @@ -0,0 +1,19 @@ +#include + +/* Specification. */ +#include "test-moo-root.h" + +#include + +#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 index 000000000..4fe9d3fea --- /dev/null +++ b/gnulib-local/tests/test-moo-root.oo.h @@ -0,0 +1,10 @@ +#include +#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 index 000000000..bc928da0f --- /dev/null +++ b/gnulib-local/tests/test-moo-sub1.oo.c @@ -0,0 +1,13 @@ +#include + +/* 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 index 000000000..581439424 --- /dev/null +++ b/gnulib-local/tests/test-moo-sub1.oo.h @@ -0,0 +1,10 @@ +#include "test-moo-root.h" + +#include + +/* 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 index 000000000..7b615078b --- /dev/null +++ b/gnulib-local/tests/test-moo-sub2.oo.c @@ -0,0 +1,20 @@ +#include + +/* Specification. */ +#include "test-moo-sub2.h" + +#include + +#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 index 000000000..d03b36aae --- /dev/null +++ b/gnulib-local/tests/test-moo-sub2.oo.h @@ -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); +};