From: Will Estes Date: Thu, 3 Jan 2002 20:17:34 +0000 (+0000) Subject: add this test suite X-Git-Tag: flex-2-5-10~210 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ff4293f2d0d6c3027eba19e4dddafcc1f34a40a1;p=flex add this test suite --- diff --git a/tests/test-array-r/.cvsignore b/tests/test-array-r/.cvsignore new file mode 100644 index 0000000..2671ef9 --- /dev/null +++ b/tests/test-array-r/.cvsignore @@ -0,0 +1,5 @@ +Makefile +parser.c +parser.h +scanner.c +test-array-r diff --git a/tests/test-array-r/Makefile.in b/tests/test-array-r/Makefile.in new file mode 100644 index 0000000..2c5a706 --- /dev/null +++ b/tests/test-array-r/Makefile.in @@ -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-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) + $(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-r/scanner.l b/tests/test-array-r/scanner.l new file mode 100644 index 0000000..2b55598 --- /dev/null +++ b/tests/test-array-r/scanner.l @@ -0,0 +1,37 @@ +%{ +/* A template scanner file to build "scanner.c". */ +#include +#include +#include "config.h" +/*#include "parser.h" */ + +%} + +%option 8bit outfile="scanner.c" prefix="test" +%option nounput nomain noyywrap +%option warn array reentrant + + +%% + +.|\n { } + + +%% + +int +main ( int argc, char** argv ) +{ + yyscan_t lexer; + + yylex_init(&lexer); + yyset_in(stdin, lexer); + yyset_out(stdout, lexer); + + yylex( lexer ); + + yylex_destroy( lexer); + printf("TEST RETURNING OK.\n"); + + return 0; +} diff --git a/tests/test-array-r/test.input b/tests/test-array-r/test.input new file mode 100644 index 0000000..7288a40 --- /dev/null +++ b/tests/test-array-r/test.input @@ -0,0 +1,2 @@ +0000 foo 1111 foo 0000 bar +0000 foo 1111 foo 0000 bar