From 89ce7484e69691a3bd1c1ea879569d52c155a1f8 Mon Sep 17 00:00:00 2001 From: Will Estes Date: Wed, 21 Aug 2002 13:41:41 +0000 Subject: add test-c++-basic --- tests/Makefile.am | 1 + tests/test-c++-basic/.cvsignore | 6 +++++ tests/test-c++-basic/Makefile.am | 46 ++++++++++++++++++++++++++++++++++ tests/test-c++-basic/scanner.l | 53 ++++++++++++++++++++++++++++++++++++++++ tests/test-c++-basic/test.input | 2 ++ 5 files changed, 108 insertions(+) create mode 100644 tests/test-c++-basic/.cvsignore create mode 100644 tests/test-c++-basic/Makefile.am create mode 100644 tests/test-c++-basic/scanner.l create mode 100644 tests/test-c++-basic/test.input (limited to 'tests') diff --git a/tests/Makefile.am b/tests/Makefile.am index 109bd5c..e9a6488 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -26,6 +26,7 @@ noinst_SCRIPTS = \ create-test SUBDIRS = \ + test-c++-basic \ test-table-opts \ test-posixly-correct \ test-posix \ diff --git a/tests/test-c++-basic/.cvsignore b/tests/test-c++-basic/.cvsignore new file mode 100644 index 0000000..aa90b44 --- /dev/null +++ b/tests/test-c++-basic/.cvsignore @@ -0,0 +1,6 @@ +Makefile +Makefile.in +scanner.cpp +OUTPUT +.deps +test-c++-basic diff --git a/tests/test-c++-basic/Makefile.am b/tests/test-c++-basic/Makefile.am new file mode 100644 index 0000000..ad57cf7 --- /dev/null +++ b/tests/test-c++-basic/Makefile.am @@ -0,0 +1,46 @@ +# 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. + +BISON = @BISON@ +FLEX = $(top_builddir)/flex + +EXTRA_DIST = scanner.l test.input +CLEANFILES = scanner.c scanner.h parser.c parser.h test-c++-basic OUTPUT $(OBJS) +OBJS = scanner.o # parser.o + +INCLUDES = -I $(srcdir) -I $(top_srcdir) -I $(top_builddir) -I . +#LDFLAGS = $(top_srcdir)/libfl.a +LFLAGS = -+ +#YFLAGS = --defines --output=parser.c + +testname = test-c++-basic + +scanner.cpp: $(srcdir)/scanner.l + $(FLEX) $(LFLAGS) $< + +$(testname)$(EXEEXT): $(OBJS) + $(CC) -o $@ $(LDFLAGS) $(OBJS) $(LOADLIBES) + +test: $(testname)$(EXEEXT) + ./$(testname)$(EXEEXT) < $(srcdir)/test.input + +.cpp.o: + $(CXX) -c -o $@ $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $< diff --git a/tests/test-c++-basic/scanner.l b/tests/test-c++-basic/scanner.l new file mode 100644 index 0000000..4955acb --- /dev/null +++ b/tests/test-c++-basic/scanner.l @@ -0,0 +1,53 @@ +/* + * 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. + */ + +%{ + +#include +#include +#include "config.h" + +%} + +%option 8bit outfile="scanner.cpp" prefix="test" +%option nounput nomain noyywrap +%option warn + + +%% + +. { } + +%% + +int main(void); + +int +main () +{ + yyin = stdin; + yyout = stdout; + yylex(); + printf("TEST RETURNING OK.\n"); + return 0; +} diff --git a/tests/test-c++-basic/test.input b/tests/test-c++-basic/test.input new file mode 100644 index 0000000..7288a40 --- /dev/null +++ b/tests/test-c++-basic/test.input @@ -0,0 +1,2 @@ +0000 foo 1111 foo 0000 bar +0000 foo 1111 foo 0000 bar -- cgit v1.2.3