summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorWill Estes <westes575@gmail.com>2014-06-15 20:52:03 -0400
committerWill Estes <westes575@gmail.com>2014-11-12 05:14:27 -0500
commit98d9a5af2b7e4895253e8854407b5455373e3b8a (patch)
tree6ec957236f229271bdf542da8b9563d63f52c2b9 /tests
parent323c11e8aef18a09aa40d11a4fabf6b8c787d782 (diff)
Refactor multiple_scanners_r test for new test suite layout.
Also, remove the use of table files from this test as that tests two features at once and we want to be as close to testing one feature at a time as we can be.
Diffstat (limited to 'tests')
-rw-r--r--tests/.gitignore2
-rw-r--r--tests/Makefile.am10
-rw-r--r--tests/multiple_scanners_r_1.l (renamed from tests/test-multiple-scanners-r/scanner-1.l)5
-rw-r--r--tests/multiple_scanners_r_2.l (renamed from tests/test-multiple-scanners-r/scanner-2.l)5
-rw-r--r--tests/multiple_scanners_r_main.c (renamed from tests/test-multiple-scanners-r/main.c)27
-rw-r--r--tests/test-multiple-scanners-r/.gitignore10
-rw-r--r--tests/test-multiple-scanners-r/Makefile.am56
7 files changed, 18 insertions, 97 deletions
diff --git a/tests/.gitignore b/tests/.gitignore
index 78d46c2..08c3818 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -46,6 +46,8 @@ mem_r
mem_r.c
multiple_scanners_nr
multiple_scanners_nr_[12].[ch]
+multiple_scanners_r
+multiple_scanners_r_[12].[ch]
noansi_nr
noansi_nr.c
noansi_r
diff --git a/tests/Makefile.am b/tests/Makefile.am
index d785e0a..5343af4 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -48,6 +48,7 @@ check_PROGRAMS = \
mem_nr \
mem_r \
multiple_scanners_nr \
+ multiple_scanners_r \
noansi_nr \
noansi_r \
posix \
@@ -80,6 +81,7 @@ header_r_SOURCES = header_r_scanner.l header_r_main.c
mem_nr_SOURCES = mem_nr.l
mem_r_SOURCES = mem_r.l
multiple_scanners_nr_SOURCES = multiple_scanners_nr_main.c multiple_scanners_nr_1.l multiple_scanners_nr_2.l
+multiple_scanners_r_SOURCES = multiple_scanners_r_main.c multiple_scanners_r_1.l multiple_scanners_r_2.l
noansi_nr_SOURCES = noansi_nr.l
noansi_r_SOURCES = noansi_r.l
posix_SOURCES = posix.l
@@ -104,6 +106,8 @@ BUILT_SOURCES = \
header_r_scanner.h \
multiple_scanners_nr_1.h \
multiple_scanners_nr_2.h \
+ multiple_scanners_r_1.h \
+ multiple_scanners_r_2.h \
top.h
EXTRA_DIST = \
@@ -139,6 +143,8 @@ basic_nr.txt \
noansi_nr.txt \
multiple_scanners_nr_1.h \
multiple_scanners_nr_2.h \
+ multiple_scanners_r_1.h \
+ multiple_scanners_r_2.h \
noansi_r.txt \
prefix_nr.txt \
prefix_r.txt \
@@ -181,6 +187,10 @@ multiple_scanners_nr_main.$(OBJEXT): multiple_scanners_nr_1.h multiple_scanners_
multiple_scanners_nr_1.h: multiple_scanners_nr_1.c
multiple_scanners_nr_2.h: multiple_scanners_nr_2.c
+multiple_scanners_r_main.$(OBJEXT): multiple_scanners_r_1.h multiple_scanners_r_2.h
+multiple_scanners_r_1.h: multiple_scanners_r_1.c
+multiple_scanners_r_2.h: multiple_scanners_r_2.c
+
posixly_correct.c: posixly_correct.l
POSIXLY_CORRECT=1 $(FLEX) -o $@ $<
diff --git a/tests/test-multiple-scanners-r/scanner-1.l b/tests/multiple_scanners_r_1.l
index 84f8719..1725e3e 100644
--- a/tests/test-multiple-scanners-r/scanner-1.l
+++ b/tests/multiple_scanners_r_1.l
@@ -29,11 +29,10 @@
%}
-%option header="scanner-1.h"
-%option 8bit outfile="scanner-1.c" prefix="S1_"
+%option header="multiple_scanners_r_1.h"
+%option 8bit prefix="S1_"
%option nounput nomain noyywrap noyy_top_state
%option warn stack reentrant
-%option tables-file="scanner-1.tables"
%x ON
%x OFF
diff --git a/tests/test-multiple-scanners-r/scanner-2.l b/tests/multiple_scanners_r_2.l
index f0d5c2d..9b69816 100644
--- a/tests/test-multiple-scanners-r/scanner-2.l
+++ b/tests/multiple_scanners_r_2.l
@@ -29,11 +29,10 @@
%}
-%option header="scanner-2.h"
-%option 8bit outfile="scanner-2.c" prefix="S2_"
+%option header="multiple_scanners_r_2.h"
+%option 8bit prefix="S2_"
%option nounput nomain noyywrap
%option warn stack reentrant noyy_top_state
-%option tables-file="scanner-2.tables"
%x OFF
%x ON
diff --git a/tests/test-multiple-scanners-r/main.c b/tests/multiple_scanners_r_main.c
index 3c07266..1b3ea0a 100644
--- a/tests/test-multiple-scanners-r/main.c
+++ b/tests/multiple_scanners_r_main.c
@@ -21,8 +21,8 @@
* PURPOSE.
*/
-#include "scanner-1.h"
-#include "scanner-2.h"
+#include "multiple_scanners_r_1.h"
+#include "multiple_scanners_r_2.h"
int
main ( int argc, char** argv )
@@ -35,26 +35,6 @@ main ( int argc, char** argv )
S1_lex_init(&scan1);
S2_lex_init(&scan2);
- if((fp = fopen("scanner-1.tables","r")) == 0){
- fprintf(stderr,"Could not open scanner-1.tables.\n");
- exit(1);
- }
- if(S1_tables_fload(fp,scan1) != 0){
- fprintf(stderr,"Could not load scanner-1.tables.\n");
- exit(1);
- }
- fclose(fp);
-
- if((fp = fopen("scanner-2.tables","r")) == 0){
- fprintf(stderr,"Could not open scanner-2.tables.\n");
- exit(1);
- }
- if(S2_tables_fload(fp,scan2) != 0){
- fprintf(stderr,"Could not load scanner-2.tables.\n");
- exit(1);
- }
- fclose(fp);
-
S1_set_out(stdout,scan1);
S2_set_out(S1_get_out(scan1),scan2);
@@ -72,9 +52,6 @@ main ( int argc, char** argv )
S1__delete_buffer(buff1, scan1);
S2__delete_buffer(buff2, scan2);
- S1_tables_destroy(scan1);
- S2_tables_destroy(scan2);
-
S1_lex_destroy(scan1);
S2_lex_destroy(scan2);
printf("TEST RETURNING OK.\n");
diff --git a/tests/test-multiple-scanners-r/.gitignore b/tests/test-multiple-scanners-r/.gitignore
deleted file mode 100644
index 552f931..0000000
--- a/tests/test-multiple-scanners-r/.gitignore
+++ /dev/null
@@ -1,10 +0,0 @@
-Makefile
-Makefile.in
-scanner-1.c
-scanner-1.h
-scanner-2.c
-scanner-2.h
-test-multiple-scanners-r
-OUTPUT
-scanner-1.tables
-scanner-2.tables
diff --git a/tests/test-multiple-scanners-r/Makefile.am b/tests/test-multiple-scanners-r/Makefile.am
deleted file mode 100644
index 5f0df8c..0000000
--- a/tests/test-multiple-scanners-r/Makefile.am
+++ /dev/null
@@ -1,56 +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
-
-builddir = @builddir@
-
-EXTRA_DIST = scanner-1.l scanner-2.l main.c
-CLEANFILES = scanner-1.c scanner-1.h $(testname)$(EXEEXT) OUTPUT\
- $(OBJS) scanner-2.c scanner-2.h scanner-1.tables \
- scanner-2.tables
-OBJS = scanner-1.o scanner-2.o main.o
-
-AM_CPPFLAGS = -I$(srcdir) -I$(top_srcdir) -I$(top_builddir) -I$(builddir)
-#LDFLAGS = $(top_srcdir)/libfl.a
-#YFLAGS = --defines --output=parser.c
-
-testname = test-multiple-scanners-r
-
-scanner-1.c: $(srcdir)/scanner-1.l
- $(FLEX) $(LFLAGS) --header=scanner-1.h $<
-
-scanner-2.c: $(srcdir)/scanner-2.l
- $(FLEX) $(LFLAGS) --header=scanner-2.h $<
-
-$(testname)$(EXEEXT): $(OBJS)
- $(CC) $(CFLAGS) -o $@ $(LDFLAGS) $(OBJS) $(LOADLIBES)
-
-test: $(testname)$(EXEEXT)
- ./$(testname)$(EXEEXT)
-
-.c.o:
- $(CC) -c -o $@ $(AM_CPPFLAGS) $(CPPFLAGS) $(CFLAGS) $<
-
-main.o: scanner-1.h scanner-2.h
-scanner-1.h: scanner-1.c
-scanner-2.h: scanner-2.c