summaryrefslogtreecommitdiff
path: root/tests/test-c-cpp-r
diff options
context:
space:
mode:
authorJohn Millaway <john43@users.sourceforge.net>2002-02-21 05:12:10 +0000
committerJohn Millaway <john43@users.sourceforge.net>2002-02-21 05:12:10 +0000
commitea3edb34c48829d66a225f23077d6d0e29eb2746 (patch)
treef8c9a794755ee612045025e9ddb9af5c49034ca0 /tests/test-c-cpp-r
parentde30476ad1683c9b00ede70a8076effb0e44dec5 (diff)
Added test-c-cpp-nr and test-c-cpp-r.
Diffstat (limited to 'tests/test-c-cpp-r')
-rw-r--r--tests/test-c-cpp-r/.cvsignore4
-rw-r--r--tests/test-c-cpp-r/Makefile.in61
-rw-r--r--tests/test-c-cpp-r/scanner.l36
-rw-r--r--tests/test-c-cpp-r/test.input2
4 files changed, 103 insertions, 0 deletions
diff --git a/tests/test-c-cpp-r/.cvsignore b/tests/test-c-cpp-r/.cvsignore
new file mode 100644
index 0000000..d13057e
--- /dev/null
+++ b/tests/test-c-cpp-r/.cvsignore
@@ -0,0 +1,4 @@
+Makefile
+scanner.c
+test-c-cpp-r
+OUTPUT
diff --git a/tests/test-c-cpp-r/Makefile.in b/tests/test-c-cpp-r/Makefile.in
new file mode 100644
index 0000000..50281f9
--- /dev/null
+++ b/tests/test-c-cpp-r/Makefile.in
@@ -0,0 +1,61 @@
+# Makefile.in for a single TEST.
+#
+# By default this Makefile will build the target "$(TESTNAME)"
+# from the sources "scanner.l" and "parser.y".
+#
+# $(TESTNAME) is supplied by the calling Makefile.
+# "parser.y" is not necessary. You may delete this file
+# if you do not require a parser.
+# "scanner.l" is necessary. It should build "scanner.c".
+#
+
+@SET_MAKE@
+
+CFLAGS = @CFLAGS@
+CPPFLAGS = @CPPFLAGS@ -I. -I"@srcdir@" -I..
+DEFS = @DEFS@
+LDFLAGS = @LDFLAGS@
+LIBS = @LIBS@
+SHELL = /bin/sh
+srcdir = @srcdir@
+VPATH = @srcdir@
+LN_S = @LN_S@
+YACC = @YACC@
+CC = @CC@
+CXX = @CXX@
+CXXFLAGS = @CXXFLAGS@ -I. -I"@srcdir@" -I..
+AR = ar
+RANLIB = @RANLIB@
+YACC = @YACC@
+
+# Edit these if necessary for your specific test.
+TESTNAME = test-c-cpp-r
+FLEX = ../../flex
+YFLAGS = --defines --output-file="parser.c" --name-prefix="test"
+OBJS = scanner.o # parser.o
+
+# Force YACC to be bison (autoconf generates 'bison -y')
+YACC = @BISON@
+
+all: $(TESTNAME)
+
+$(TESTNAME): $(OBJS)
+ $(CXX) $(CXXFLAGS) -o $(TESTNAME) $(OBJS) $(LDFLAGS) $(LIBS)
+
+scanner.c: $(srcdir)/scanner.l
+ $(FLEX) $(srcdir)/scanner.l
+
+scanner.o: scanner.c
+ $(CXX) $(CXXFLAGS) -c scanner.c
+
+test: check
+
+check: $(TESTNAME)
+ ./$(TESTNAME) < $(srcdir)/test.input
+
+distclean: clean
+ rm -f Makefile
+
+clean:
+ rm -f scanner.o scanner.c parser.o parser.c parser.h parser.h $(TESTNAME) OUTPUT
+
diff --git a/tests/test-c-cpp-r/scanner.l b/tests/test-c-cpp-r/scanner.l
new file mode 100644
index 0000000..e4e0749
--- /dev/null
+++ b/tests/test-c-cpp-r/scanner.l
@@ -0,0 +1,36 @@
+%{
+/* A template scanner file to build "scanner.c".
+ The scanner is not really important -- we only care if
+ it compiles under a c++ compiler, and runs. */
+#include <stdio.h>
+#include <stdlib.h>
+#include "config.h"
+/*#include "parser.h" */
+
+%}
+
+%option 8bit outfile="scanner.c" prefix="test"
+%option nounput nomain noyywrap
+%option warn reentrant
+
+
+%%
+
+. { }
+
+%%
+
+int
+main ( int argc, char** argv )
+{
+ yyscan_t lexer;
+ yylex_init( &lexer );
+ yyset_out ( stdout,lexer);
+ yyset_in ( stdin, lexer);
+ while( yylex(lexer) )
+ {
+ }
+ yylex_destroy( lexer );
+ printf("TEST RETURNING OK.\n");
+ return 0;
+}
diff --git a/tests/test-c-cpp-r/test.input b/tests/test-c-cpp-r/test.input
new file mode 100644
index 0000000..7288a40
--- /dev/null
+++ b/tests/test-c-cpp-r/test.input
@@ -0,0 +1,2 @@
+0000 foo 1111 foo 0000 bar
+0000 foo 1111 foo 0000 bar