]> granicus.if.org Git - flex/commitdiff
add this test
authorWill Estes <wlestes@users.sourceforge.net>
Thu, 3 Jan 2002 20:19:06 +0000 (20:19 +0000)
committerWill Estes <wlestes@users.sourceforge.net>
Thu, 3 Jan 2002 20:19:06 +0000 (20:19 +0000)
tests/test-array-nr/.cvsignore [new file with mode: 0644]
tests/test-array-nr/Makefile.in [new file with mode: 0644]
tests/test-array-nr/scanner.l [new file with mode: 0644]
tests/test-array-nr/test.input [new file with mode: 0644]

diff --git a/tests/test-array-nr/.cvsignore b/tests/test-array-nr/.cvsignore
new file mode 100644 (file)
index 0000000..89e9343
--- /dev/null
@@ -0,0 +1,5 @@
+Makefile
+parser.c
+parser.h
+scanner.c
+test-array-nr
diff --git a/tests/test-array-nr/Makefile.in b/tests/test-array-nr/Makefile.in
new file mode 100644 (file)
index 0000000..6cf3155
--- /dev/null
@@ -0,0 +1,59 @@
+# 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@
+AR = ar
+RANLIB = @RANLIB@
+YACC = @YACC@
+
+# Edit these if necessary for your specific test.
+TESTNAME = test-array-nr
+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)
+       $(CC) $(CFLAGS) -o $(TESTNAME) $(OBJS) $(LDFLAGS) $(LIBS)
+
+scanner.c: $(srcdir)/scanner.l
+       $(FLEX) $(srcdir)/scanner.l
+
+scanner.o: scanner.c 
+       $(CC) $(CPPFLAGS) $(CFLAGS) -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-array-nr/scanner.l b/tests/test-array-nr/scanner.l
new file mode 100644 (file)
index 0000000..af84cef
--- /dev/null
@@ -0,0 +1,30 @@
+%{
+/* A template scanner file to build "scanner.c". */
+#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 array
+
+
+%%
+
+.|\n    { }
+
+
+%%
+
+int
+main ( int argc, char** argv )
+{
+    yyin = stdin;
+    yyout = stdout;
+    yylex();
+    printf("TEST RETURNING OK.\n");
+    return 0;
+}
diff --git a/tests/test-array-nr/test.input b/tests/test-array-nr/test.input
new file mode 100644 (file)
index 0000000..7288a40
--- /dev/null
@@ -0,0 +1,2 @@
+0000 foo 1111 foo 0000 bar
+0000 foo 1111 foo 0000 bar