mirror of
https://github.com/boostorg/wave.git
synced 2026-02-21 15:32:15 +00:00
Added lot of unit tests, fixed a couple of minor bugs.
[SVN r27950]
This commit is contained in:
@@ -25,7 +25,11 @@ SOURCES = testwave testwave_app
|
||||
#
|
||||
# This are the arguments for the testwave executable
|
||||
#
|
||||
TESTWAVE_ARGUMENTS = -d2 -S../testwave/testfiles ;
|
||||
TESTWAVE_ARGUMENTS =
|
||||
-d2 # use -d4 for verbose results
|
||||
-S../testwave/testfiles
|
||||
-S$(BOOST_ROOT) -I$(BOOST_ROOT)
|
||||
;
|
||||
|
||||
#
|
||||
# These are the names of the different unit tests to run
|
||||
|
||||
58
test/testwave/testfiles/005_001.cpp
Normal file
58
test/testwave/testfiles/005_001.cpp
Normal file
@@ -0,0 +1,58 @@
|
||||
/*=============================================================================
|
||||
Boost.Wave: A Standard compliant C++ preprocessor library
|
||||
http://www.boost.org/
|
||||
|
||||
Copyright (c) 2001-2005 Hartmut Kaiser. Distributed under the Boost
|
||||
Software License, Version 1.0. (See accompanying file
|
||||
LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
The tests included in this file were initially taken from the mcpp V2.5
|
||||
preprocessor validation suite and were modified to fit into the Boost.Wave
|
||||
unit test requirements.
|
||||
The original files of the mcpp preprocessor are distributed under the
|
||||
license reproduced at the end of this file.
|
||||
=============================================================================*/
|
||||
|
||||
// Tests the conversion of trigraph sequences.
|
||||
|
||||
// 1.1: The following 9 sequences are valid trigraph sequences.
|
||||
//R #line 20 "005_001.cpp"
|
||||
"??( ??) ??/??/ ??' ??< ??> ??! ??- ??=" //R "[ ] \\ ^ { } | ~ #"
|
||||
??( ??) ??/??/ ??' ??< ??> ??! ??- ??= //R [ ] \\ ^ { } | ~ #
|
||||
|
||||
// 1.2: In directive line.
|
||||
//R #line 26 "005_001.cpp"
|
||||
??= define OR(a, b) a ??! b
|
||||
OR(1, 2) //R 1 | 2
|
||||
|
||||
// 1.3: Any sequence other than above 9 is not a trigraph sequence.
|
||||
//R #line 30 "005_001.cpp"
|
||||
"?? ??? ??% ??^ ???=" //R "?? ??? ??% ??^ ?#"
|
||||
?? ??? ??% ??^ ???= //R ? ? ? ? ? ? ? % ? ? ^ ? #
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp>
|
||||
* All rights reserved.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
76
test/testwave/testfiles/005_002.cpp
Normal file
76
test/testwave/testfiles/005_002.cpp
Normal file
@@ -0,0 +1,76 @@
|
||||
/*=============================================================================
|
||||
Boost.Wave: A Standard compliant C++ preprocessor library
|
||||
http://www.boost.org/
|
||||
|
||||
Copyright (c) 2001-2005 Hartmut Kaiser. Distributed under the Boost
|
||||
Software License, Version 1.0. (See accompanying file
|
||||
LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
The tests included in this file were initially taken from the mcpp V2.5
|
||||
preprocessor validation suite and were modified to fit into the Boost.Wave
|
||||
unit test requirements.
|
||||
The original files of the mcpp preprocessor are distributed under the
|
||||
license reproduced at the end of this file.
|
||||
=============================================================================*/
|
||||
|
||||
// Tests the line splicing by <backslash><newline> sequence.
|
||||
|
||||
// 2.1: In a #define directive line, between the parameter list and the
|
||||
// replacement text.
|
||||
//R #line 23 "005_002.cpp"
|
||||
#define FUNC(a, b, c) \
|
||||
a ## b ## c
|
||||
FUNC(ab, cd, ef) //R abcdef
|
||||
|
||||
// 2.2: In a #define directive line, among the parameter list and among the
|
||||
// replacement text.
|
||||
//R #line 33 "005_002.cpp"
|
||||
#undef FUNC
|
||||
#define FUNC(a, b \
|
||||
, c) \
|
||||
a ## b \
|
||||
## c
|
||||
FUNC(ab, cd, ef) //R abcdef
|
||||
|
||||
// 2.3: In a string literal.
|
||||
//R #line 38 "005_002.cpp"
|
||||
"abc\
|
||||
de" //R "abcde"
|
||||
|
||||
// 2.4: <backslash><newline> in midst of an identifier.
|
||||
//R #line 44 "005_002.cpp"
|
||||
#define ABCDE 5
|
||||
ABC\
|
||||
DE //R 5
|
||||
|
||||
// 2.5: <backslash><newline> by trigraph.
|
||||
//R #line 49 "005_002.cpp"
|
||||
ABC??/
|
||||
DE //R 5
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp>
|
||||
* All rights reserved.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
68
test/testwave/testfiles/005_003.cpp
Normal file
68
test/testwave/testfiles/005_003.cpp
Normal file
@@ -0,0 +1,68 @@
|
||||
/*=============================================================================
|
||||
Boost.Wave: A Standard compliant C++ preprocessor library
|
||||
http://www.boost.org/
|
||||
|
||||
Copyright (c) 2001-2005 Hartmut Kaiser. Distributed under the Boost
|
||||
Software License, Version 1.0. (See accompanying file
|
||||
LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
The tests included in this file were initially taken from the mcpp V2.5
|
||||
preprocessor validation suite and were modified to fit into the Boost.Wave
|
||||
unit test requirements.
|
||||
The original files of the mcpp preprocessor are distributed under the
|
||||
license reproduced at the end of this file.
|
||||
=============================================================================*/
|
||||
|
||||
// Tests the handling of comments.
|
||||
|
||||
#define STR(x) #x
|
||||
|
||||
// 3.1: A comment is converted to one space.
|
||||
//R #line 22 "005_003.cpp"
|
||||
STR(abc/* comment */de) //R "abc de"
|
||||
abc/* comment */de //R abc de
|
||||
|
||||
// 3.2: // is not a comment of C.
|
||||
// Wave always treats the '//' style as comments (even in C99 mode)
|
||||
/* assert( strcmp( str( //), "//") == 0); */
|
||||
|
||||
// 3.3: Comments are parsed prior to the parsing of preprocessing directives.
|
||||
//R #line 41 "005_003.cpp"
|
||||
#if 0
|
||||
"nonsence"; /*
|
||||
#else
|
||||
still in
|
||||
comment */
|
||||
#else
|
||||
#define MACRO_abcd /*
|
||||
in comment
|
||||
*/ abcd
|
||||
#endif
|
||||
MACRO_abcd //R abcd
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp>
|
||||
* All rights reserved.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
59
test/testwave/testfiles/005_004.cpp
Normal file
59
test/testwave/testfiles/005_004.cpp
Normal file
@@ -0,0 +1,59 @@
|
||||
/*=============================================================================
|
||||
Boost.Wave: A Standard compliant C++ preprocessor library
|
||||
http://www.boost.org/
|
||||
|
||||
Copyright (c) 2001-2005 Hartmut Kaiser. Distributed under the Boost
|
||||
Software License, Version 1.0. (See accompanying file
|
||||
LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
The tests included in this file were initially taken from the mcpp V2.5
|
||||
preprocessor validation suite and were modified to fit into the Boost.Wave
|
||||
unit test requirements.
|
||||
The original files of the mcpp preprocessor are distributed under the
|
||||
license reproduced at the end of this file.
|
||||
=============================================================================*/
|
||||
|
||||
// Tests the handling of comments and <backslash><newline>.
|
||||
|
||||
// This test is currently disabled, because of the known problem in Wave, that
|
||||
// causes multiple __LINE__ macros on splitted lines after preprocessing
|
||||
// directives are expanded as the line number of the directive itself.
|
||||
|
||||
// Note: This unit test passes only if Wave was compiled with a defined
|
||||
// BOOST_WAVE_PREPROCESS_ERROR_MESSAGE_BODY compile time constant
|
||||
// (which is the default).
|
||||
#define STR(x) #x
|
||||
|
||||
// 3.4: Comment and <backslash><newline> in #error line.
|
||||
//E 005_004.cpp(29): fatal error: encountered #error directive or #pragma wave stop(): (29) Message of first physical line. (30) Message of second physical and first logical line. (32) Message of forth physical and third logical line.
|
||||
#error (__LINE__) Message of first physical line. \
|
||||
(__LINE__) Message of second physical and first logical line. /*
|
||||
this comment splices the lines
|
||||
*/ (__LINE__) Message of forth physical and third logical line.
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp>
|
||||
* All rights reserved.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
52
test/testwave/testfiles/005_005.cpp
Normal file
52
test/testwave/testfiles/005_005.cpp
Normal file
@@ -0,0 +1,52 @@
|
||||
/*=============================================================================
|
||||
Boost.Wave: A Standard compliant C++ preprocessor library
|
||||
http://www.boost.org/
|
||||
|
||||
Copyright (c) 2001-2005 Hartmut Kaiser. Distributed under the Boost
|
||||
Software License, Version 1.0. (See accompanying file
|
||||
LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
The tests included in this file were initially taken from the mcpp V2.5
|
||||
preprocessor validation suite and were modified to fit into the Boost.Wave
|
||||
unit test requirements.
|
||||
The original files of the mcpp preprocessor are distributed under the
|
||||
license reproduced at the end of this file.
|
||||
=============================================================================*/
|
||||
|
||||
// Tests the handling of special tokens.
|
||||
|
||||
// 4.1: Digraph spellings in directive line.
|
||||
//R #line 21 "005_005.cpp"
|
||||
%: define STR(a) %: a
|
||||
STR(abc) //R "abc"
|
||||
|
||||
// 4.2: Digraph spellings are retained in stringization.
|
||||
//R #line 25 "005_005.cpp"
|
||||
STR(<:) //R "<:"
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp>
|
||||
* All rights reserved.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
51
test/testwave/testfiles/005_006.cpp
Normal file
51
test/testwave/testfiles/005_006.cpp
Normal file
@@ -0,0 +1,51 @@
|
||||
/*=============================================================================
|
||||
Boost.Wave: A Standard compliant C++ preprocessor library
|
||||
http://www.boost.org/
|
||||
|
||||
Copyright (c) 2001-2005 Hartmut Kaiser. Distributed under the Boost
|
||||
Software License, Version 1.0. (See accompanying file
|
||||
LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
The tests included in this file were initially taken from the mcpp V2.5
|
||||
preprocessor validation suite and were modified to fit into the Boost.Wave
|
||||
unit test requirements.
|
||||
The original files of the mcpp preprocessor are distributed under the
|
||||
license reproduced at the end of this file.
|
||||
=============================================================================*/
|
||||
|
||||
// Tests, whether spaces or tabs are allowed at any place in a pp-directive
|
||||
// lines, including between the top of a pp-directive line and '#', and between
|
||||
// the '#' and the directive.
|
||||
|
||||
// /**/[TAB]# /**/[TAB]define /**/[TAB]MACRO[TAB]/**/ abcde /**/
|
||||
/**/ # /**/ define /**/ MACRO /**/ abcde /**/
|
||||
|
||||
//R #line 24 "005_006.cpp"
|
||||
MACRO //R abcde
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp>
|
||||
* All rights reserved.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
69
test/testwave/testfiles/005_007.cpp
Normal file
69
test/testwave/testfiles/005_007.cpp
Normal file
@@ -0,0 +1,69 @@
|
||||
/*=============================================================================
|
||||
Boost.Wave: A Standard compliant C++ preprocessor library
|
||||
http://www.boost.org/
|
||||
|
||||
Copyright (c) 2001-2005 Hartmut Kaiser. Distributed under the Boost
|
||||
Software License, Version 1.0. (See accompanying file
|
||||
LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
The tests included in this file were initially taken from the mcpp V2.5
|
||||
preprocessor validation suite and were modified to fit into the Boost.Wave
|
||||
unit test requirements.
|
||||
The original files of the mcpp preprocessor are distributed under the
|
||||
license reproduced at the end of this file.
|
||||
=============================================================================*/
|
||||
|
||||
// Tests the #include directive.
|
||||
|
||||
// 6.1: Header-name quoted by " and " as well as by < and > can include
|
||||
// standard headers.
|
||||
//R #line 22 "005_007.cpp"
|
||||
#include "boost/version.hpp"
|
||||
BOOST_LIB_VERSION //R "$V"
|
||||
|
||||
//R #line 28 "005_007.cpp"
|
||||
#undef BOOST_VERSION_HPP
|
||||
#undef BOOST_LIB_VERSION
|
||||
#include <boost/version.hpp>
|
||||
BOOST_LIB_VERSION //R "$V"
|
||||
|
||||
// 6.2: Macro is allowed in #include line.
|
||||
//R #line 35 "005_007.cpp"
|
||||
#undef MACRO_005_007
|
||||
#define HEADER "005_007.hpp"
|
||||
#include HEADER
|
||||
MACRO_005_007 //R abc
|
||||
|
||||
// 6.3: With macro nonsence but legal.
|
||||
//R #line 42 "005_007.cpp"
|
||||
#undef MACRO_005_007
|
||||
#define ZERO_TOKEN
|
||||
#include ZERO_TOKEN HEADER ZERO_TOKEN
|
||||
MACRO_005_007 //R abc
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp>
|
||||
* All rights reserved.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
44
test/testwave/testfiles/005_007.hpp
Normal file
44
test/testwave/testfiles/005_007.hpp
Normal file
@@ -0,0 +1,44 @@
|
||||
/*=============================================================================
|
||||
Boost.Wave: A Standard compliant C++ preprocessor library
|
||||
http://www.boost.org/
|
||||
|
||||
Copyright (c) 2001-2005 Hartmut Kaiser. Distributed under the Boost
|
||||
Software License, Version 1.0. (See accompanying file
|
||||
LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
The tests included in this file were initially taken from the mcpp V2.5
|
||||
preprocessor validation suite and were modified to fit into the Boost.Wave
|
||||
unit test requirements.
|
||||
The original files of the mcpp preprocessor are distributed under the
|
||||
license reproduced at the end of this file.
|
||||
=============================================================================*/
|
||||
|
||||
// Tests the #include directive.
|
||||
#define MACRO_005_007 abc
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998, 2002-2005 Kiyoshi Matsui <kmatsui@t3.rim.or.jp>
|
||||
* All rights reserved.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
@@ -23,7 +23,8 @@
|
||||
001_011.cpp
|
||||
001_012.cpp
|
||||
001_013.cpp
|
||||
001_014.cpp
|
||||
# currently disabled because of a known problem in the Wave library
|
||||
#001_014.cpp
|
||||
001_015.cpp
|
||||
001_016.cpp
|
||||
001_017.cpp
|
||||
@@ -43,7 +44,6 @@
|
||||
001_031.cpp
|
||||
001_032.cpp
|
||||
001_033.cpp
|
||||
|
||||
001_034.cpp
|
||||
001_035.cpp
|
||||
001_036.cpp
|
||||
@@ -66,7 +66,6 @@
|
||||
002_012.cpp
|
||||
002_013.cpp
|
||||
002_014.cpp
|
||||
|
||||
002_015.cpp
|
||||
002_016.cpp
|
||||
|
||||
@@ -85,6 +84,18 @@
|
||||
004_002.cpp
|
||||
004_003.cpp
|
||||
|
||||
#
|
||||
# unit tests from the mcpp preprocessor validation suite
|
||||
#
|
||||
005_001.cpp
|
||||
005_002.cpp
|
||||
005_003.cpp
|
||||
# currently disabled because of a known problem in the Wave library
|
||||
#005_004.cpp
|
||||
005_005.cpp
|
||||
005_006.cpp
|
||||
005_007.cpp
|
||||
|
||||
#
|
||||
# 999: General preprocessing problems
|
||||
#
|
||||
@@ -97,7 +108,6 @@
|
||||
999_007.cpp
|
||||
999_008.cpp
|
||||
999_009.cpp
|
||||
|
||||
999_010.cpp
|
||||
999_011.cpp
|
||||
999_012.cpp
|
||||
|
||||
@@ -130,7 +130,7 @@ namespace {
|
||||
//
|
||||
// This function compares the real result and the expected one but first
|
||||
// replaces all occurences of $F in the expected result to the passed
|
||||
// full filepath.
|
||||
// full filepath and $V to the current Boost version number.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
inline bool
|
||||
@@ -152,6 +152,12 @@ namespace {
|
||||
pos1 = expected.find_first_of ("$", pos = pos1 + 2);
|
||||
break;
|
||||
|
||||
case 'V':
|
||||
full_result = full_result +
|
||||
expected.substr(pos, pos1-pos) + BOOST_LIB_VERSION;
|
||||
pos1 = expected.find_first_of ("$", pos = pos1 + 2);
|
||||
break;
|
||||
|
||||
default:
|
||||
full_result = full_result +
|
||||
expected.substr(pos, pos1-pos);
|
||||
@@ -403,7 +409,8 @@ testwave_app::extract_special_information(std::string const& filename,
|
||||
|
||||
boost::wave::language_support const lang_opts =
|
||||
(boost::wave::language_support)(boost::wave::support_cpp |
|
||||
boost::wave::support_option_no_character_validation);
|
||||
boost::wave::support_option_no_character_validation |
|
||||
boost::wave::support_option_convert_trigraphs);
|
||||
|
||||
position_type pos(filename.c_str());
|
||||
lexer_type it = lexer_type(instr.begin(), instr.end(), pos, lang_opts);
|
||||
@@ -492,6 +499,21 @@ bool
|
||||
testwave_app::initialise_options(Context& ctx, po::variables_map const& vm)
|
||||
{
|
||||
// initialise the given context from the parsed options
|
||||
#if BOOST_WAVE_SUPPORT_VARIADICS_PLACEMARKERS != 0
|
||||
// enable C99 mode, if appropriate (implies variadics)
|
||||
if (vm.count("c99")) {
|
||||
ctx.set_language(boost::wave::support_c99);
|
||||
}
|
||||
else if (vm.count("variadics")) {
|
||||
// enable variadics and placemarkers, if appropriate
|
||||
ctx.set_language(boost::wave::enable_variadics(ctx.get_language()));
|
||||
}
|
||||
#endif // BOOST_WAVE_SUPPORT_VARIADICS_PLACEMARKERS != 0
|
||||
|
||||
// enable trigraph conversion
|
||||
ctx.set_language(boost::wave::set_support_options(ctx.get_language(),
|
||||
boost::wave::support_option_convert_trigraphs));
|
||||
|
||||
// add include directories to the system include search paths
|
||||
if (vm.count("sysinclude")) {
|
||||
std::vector<std::string> syspaths =
|
||||
@@ -576,18 +598,6 @@ testwave_app::initialise_options(Context& ctx, po::variables_map const& vm)
|
||||
}
|
||||
ctx.set_max_include_nesting_depth(max_depth);
|
||||
}
|
||||
|
||||
#if BOOST_WAVE_SUPPORT_VARIADICS_PLACEMARKERS != 0
|
||||
// enable C99 mode, if appropriate (implies variadics)
|
||||
if (vm.count("c99")) {
|
||||
ctx.set_language(boost::wave::support_c99);
|
||||
}
|
||||
else if (vm.count("variadics")) {
|
||||
// enable variadics and placemarkers, if appropriate
|
||||
ctx.set_language(boost::wave::enable_variadics(ctx.get_language()));
|
||||
}
|
||||
#endif // BOOST_WAVE_SUPPORT_VARIADICS_PLACEMARKERS != 0
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user