From ce15230f4796ddd57c8de075aece398f7fa96f2e Mon Sep 17 00:00:00 2001 From: Will Estes Date: Sun, 1 Jun 2014 19:59:18 -0400 Subject: refactor array-r test for new test suite layout --- tests/.gitignore | 2 ++ tests/Makefile.am | 3 ++ tests/array-r.l | 62 ++++++++++++++++++++++++++++++++++++++++++ tests/array-r.txt | 2 ++ tests/test-array-r/.gitignore | 7 ----- tests/test-array-r/Makefile.am | 45 ------------------------------ tests/test-array-r/scanner.l | 62 ------------------------------------------ tests/test-array-r/test.input | 2 -- 8 files changed, 69 insertions(+), 116 deletions(-) create mode 100644 tests/array-r.l create mode 100644 tests/array-r.txt delete mode 100644 tests/test-array-r/.gitignore delete mode 100644 tests/test-array-r/Makefile.am delete mode 100644 tests/test-array-r/scanner.l delete mode 100644 tests/test-array-r/test.input diff --git a/tests/.gitignore b/tests/.gitignore index 3609b85..2f3113a 100644 --- a/tests/.gitignore +++ b/tests/.gitignore @@ -4,6 +4,8 @@ alloc-extra alloc-extra.c array-nr array-nr.c +array-r +array-r.c basic-nr basic-nr.c basic-r diff --git a/tests/Makefile.am b/tests/Makefile.am index 4742435..63bbadd 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -27,11 +27,13 @@ AM_LOG_FLAGS = $(srcdir) check_PROGRAMS = \ alloc-extra \ array-nr \ + array-r \ basic-nr \ basic-r alloc_extra_SOURCES = alloc-extra.l array_nr_SOURCES = array-nr.l +array_r_SOURCES = array-r.l basic_nr_SOURCES = basic-nr.l basic_r_SOURCES = basic-r.l @@ -40,6 +42,7 @@ EXTRA_DIST = \ testwrapper.sh \ alloc-extra.txt \ array-nr.txt \ + array-r.txt \ basic-nr.txt \ basic-r.txt diff --git a/tests/array-r.l b/tests/array-r.l new file mode 100644 index 0000000..0285240 --- /dev/null +++ b/tests/array-r.l @@ -0,0 +1,62 @@ +/* + * This file is part of flex. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE. + */ + +%{ +/* A template scanner file to build "scanner.c". */ +#include +#include +#include "config.h" +/*#include "parser.h" */ + +%} + +%option 8bit prefix="test" +%option nounput nomain noyywrap +%option warn array reentrant + + +%% + +.|\n { } + + +%% + +int main(void); + +int +main () +{ + 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/array-r.txt b/tests/array-r.txt new file mode 100644 index 0000000..7288a40 --- /dev/null +++ b/tests/array-r.txt @@ -0,0 +1,2 @@ +0000 foo 1111 foo 0000 bar +0000 foo 1111 foo 0000 bar diff --git a/tests/test-array-r/.gitignore b/tests/test-array-r/.gitignore deleted file mode 100644 index 267397d..0000000 --- a/tests/test-array-r/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -Makefile -parser.c -parser.h -scanner.c -test-array-r -OUTPUT -Makefile.in diff --git a/tests/test-array-r/Makefile.am b/tests/test-array-r/Makefile.am deleted file mode 100644 index b60c917..0000000 --- a/tests/test-array-r/Makefile.am +++ /dev/null @@ -1,45 +0,0 @@ -# This file is part of flex. - -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: - -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. - -# Neither the name of the University nor the names of its contributors -# may be used to endorse or promote products derived from this software -# without specific prior written permission. - -# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR -# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED -# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -# PURPOSE. - - -FLEX = $(top_builddir)/flex - -EXTRA_DIST = scanner.l test.input -CLEANFILES = scanner.c $(testname)$(EXEEXT) OUTPUT $(OBJS) -OBJS = scanner.o - -AM_CPPFLAGS = -I$(srcdir) -I$(top_srcdir) -I$(top_builddir) -#LDFLAGS = $(top_srcdir)/libfl.a -#YFLAGS = --defines --output=parser.c - -testname = test-array-r - -scanner.c: $(srcdir)/scanner.l - $(FLEX) $< - -$(testname)$(EXEEXT): $(OBJS) - $(CC) $(CFLAGS) -o $@ $(LDFLAGS) $(OBJS) $(LOADLIBES) - -test: $(testname)$(EXEEXT) - ./$(testname)$(EXEEXT) < $(srcdir)/test.input - -.c.o: - $(CC) -c -o $@ $(AM_CPPFLAGS) $(CPPFLAGS) $(CFLAGS) $< diff --git a/tests/test-array-r/scanner.l b/tests/test-array-r/scanner.l deleted file mode 100644 index 2d4c1b1..0000000 --- a/tests/test-array-r/scanner.l +++ /dev/null @@ -1,62 +0,0 @@ -/* - * This file is part of flex. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE. - */ - -%{ -/* 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(void); - -int -main () -{ - 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 deleted file mode 100644 index 7288a40..0000000 --- a/tests/test-array-r/test.input +++ /dev/null @@ -1,2 +0,0 @@ -0000 foo 1111 foo 0000 bar -0000 foo 1111 foo 0000 bar -- cgit v1.2.3