]> granicus.if.org Git - flex/commitdiff
Refactor multiple_scanners_r test for new test suite layout.
authorWill Estes <westes575@gmail.com>
Mon, 16 Jun 2014 00:52:03 +0000 (20:52 -0400)
committerWill Estes <westes575@gmail.com>
Wed, 12 Nov 2014 10:14:27 +0000 (05:14 -0500)
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.

tests/.gitignore
tests/Makefile.am
tests/multiple_scanners_r_1.l [moved from tests/test-multiple-scanners-r/scanner-1.l with 92% similarity]
tests/multiple_scanners_r_2.l [moved from tests/test-multiple-scanners-r/scanner-2.l with 92% similarity]
tests/multiple_scanners_r_main.c [moved from tests/test-multiple-scanners-r/main.c with 72% similarity]
tests/test-multiple-scanners-r/.gitignore [deleted file]
tests/test-multiple-scanners-r/Makefile.am [deleted file]

index 78d46c20f798d2cc3905190917d22794faf9b792..08c3818fd215d495cb46a3dcef292a611264ab4f 100644 (file)
@@ -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
index d785e0ac3ddd4accf6d506b110285e7285fa8b8b..5343af44344054a56c40e3bfb1c5b53d253aa766 100644 (file)
@@ -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 $@ $<
 
similarity index 92%
rename from tests/test-multiple-scanners-r/scanner-1.l
rename to tests/multiple_scanners_r_1.l
index 84f87192b5219fe122241637d6fa4c05be0dfd1a..1725e3e2dd18c2a1617e91f16b790dc48b83a781 100644 (file)
 
 %}
 
-%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
similarity index 92%
rename from tests/test-multiple-scanners-r/scanner-2.l
rename to tests/multiple_scanners_r_2.l
index f0d5c2dd0c7ade93a29fee556b83d4f53ba04c4e..9b69816fc68c068a3f35a348881a87e75f381c6e 100644 (file)
 
 %}
 
-%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
similarity index 72%
rename from tests/test-multiple-scanners-r/main.c
rename to tests/multiple_scanners_r_main.c
index 3c07266dc3fd65e395597d00725b7bf4bd0a8bec..1b3ea0a7318013498ad20dd3c6b1a08916ef0b9b 100644 (file)
@@ -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 (file)
index 552f931..0000000
+++ /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 (file)
index 5f0df8c..0000000
+++ /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