mirror of
https://github.com/boostorg/wave.git
synced 2026-02-21 03:22:16 +00:00
Added more unit tests.
[SVN r27959]
This commit is contained in:
@@ -5,40 +5,8 @@
|
||||
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.
|
||||
*/
|
||||
|
||||
|
||||
62
test/testwave/testfiles/005_008.cpp
Normal file
62
test/testwave/testfiles/005_008.cpp
Normal file
@@ -0,0 +1,62 @@
|
||||
/*=============================================================================
|
||||
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 directive.
|
||||
|
||||
// 7.1: Line number and filename.
|
||||
//R #line 1234 "cpp"
|
||||
#line 1234 "cpp"
|
||||
__LINE__ //R 1234
|
||||
__FILE__ //R "cpp"
|
||||
|
||||
// 7.2: Filename argument is optional.
|
||||
//R #line 2345 "cpp"
|
||||
#line 2345
|
||||
__LINE__ //R 2345
|
||||
__FILE__ //R "cpp"
|
||||
|
||||
// 7.3: Argument with macro.
|
||||
//R #line 1234 "005_008.cpp"
|
||||
#define LINE_AND_FILENAME 1234 "005_008.cpp"
|
||||
#line LINE_AND_FILENAME
|
||||
__LINE__ //R 1234
|
||||
__FILE__ //R "005_008.cpp"
|
||||
|
||||
/*-
|
||||
* 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.
|
||||
*/
|
||||
|
||||
57
test/testwave/testfiles/005_009.cpp
Normal file
57
test/testwave/testfiles/005_009.cpp
Normal file
@@ -0,0 +1,57 @@
|
||||
/*=============================================================================
|
||||
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 #error directive.
|
||||
|
||||
// 8.1: The original mcpp validation suite claims:
|
||||
// Argument of #error directive is not a subject of macro expansion.
|
||||
//
|
||||
// But the Standard doesn't say anything about this (neither the C99 nor
|
||||
// the C++ Standard), so Wave allows to be configured at compile time
|
||||
// whether to macro expand the arguments to an #error directive.
|
||||
// This test assumes that macro expansion is enabled.
|
||||
|
||||
//E 005_009.cpp(29): fatal error: encountered #error directive or #pragma wave stop(): 0 is not a positive number.
|
||||
#define MACRO 0
|
||||
#if MACRO <= 0
|
||||
#error MACRO is not a positive number.
|
||||
#endif
|
||||
|
||||
/*-
|
||||
* 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.
|
||||
*/
|
||||
|
||||
47
test/testwave/testfiles/005_010.cpp
Normal file
47
test/testwave/testfiles/005_010.cpp
Normal file
@@ -0,0 +1,47 @@
|
||||
/*=============================================================================
|
||||
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 the argument of #error is optional
|
||||
|
||||
// 8.2: #error should be executed even without argument.
|
||||
//E 005_010.cpp(20): fatal error: encountered #error directive or #pragma wave stop()
|
||||
#error
|
||||
|
||||
/*-
|
||||
* 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.
|
||||
*/
|
||||
|
||||
54
test/testwave/testfiles/005_011.cpp
Normal file
54
test/testwave/testfiles/005_011.cpp
Normal file
@@ -0,0 +1,54 @@
|
||||
/*=============================================================================
|
||||
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 the argument of #error is optional
|
||||
|
||||
// 9.1: Any #pragma directive should be processed or ignored, should not
|
||||
// be diagnosed as an error.
|
||||
// Wave allows to be configured at compile time, whether unknown #pragmas
|
||||
// are left untouched or skipped entirely (see the
|
||||
// BOOST_WAVE_EMIT_PRAGMA_DIRECTIVES pp constant)
|
||||
|
||||
//R #line 27 "005_011.cpp"
|
||||
//R #pragma who knows ?
|
||||
#pragma once
|
||||
#pragma who knows ?
|
||||
|
||||
/*-
|
||||
* 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.
|
||||
*/
|
||||
|
||||
74
test/testwave/testfiles/005_012.cpp
Normal file
74
test/testwave/testfiles/005_012.cpp
Normal file
@@ -0,0 +1,74 @@
|
||||
/*=============================================================================
|
||||
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 #if, #elif, #else and #endif pp-directives.
|
||||
|
||||
#define MACRO_0 0
|
||||
#define MACRO_1 1
|
||||
|
||||
// 10.1:
|
||||
// Note: an undefined identifier in #if expression is replaced to 0.
|
||||
//R #line 30 "005_012.cpp"
|
||||
//R true
|
||||
#if a
|
||||
false
|
||||
#elif MACRO_0
|
||||
false
|
||||
#elif MACRO_1 /* Valid block */
|
||||
true
|
||||
#else
|
||||
false
|
||||
#endif
|
||||
|
||||
// 10.2: Comments must be processed even if in skipped #if block.
|
||||
// At least tokenization of string literal and character constant is
|
||||
// necessary to process comments, e.g. /* is not a comment mark in string
|
||||
// literal.
|
||||
|
||||
//R #line 46 "005_012.cpp"
|
||||
//R true
|
||||
#ifdef UNDEFINED
|
||||
/* Comment */
|
||||
"in literal /* is not a comment"
|
||||
#else
|
||||
true
|
||||
#endif
|
||||
|
||||
/*-
|
||||
* 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.
|
||||
*/
|
||||
|
||||
82
test/testwave/testfiles/005_013.cpp
Normal file
82
test/testwave/testfiles/005_013.cpp
Normal file
@@ -0,0 +1,82 @@
|
||||
/*=============================================================================
|
||||
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 operator "defined" in #if or #elif directives.
|
||||
|
||||
#define MACRO_abc abc
|
||||
#define MACRO_0 2
|
||||
#define ZERO_TOKEN
|
||||
|
||||
// 11.1:
|
||||
//R #line 28 "005_013.cpp"
|
||||
//R true
|
||||
#if defined a
|
||||
false
|
||||
#else
|
||||
true
|
||||
#endif
|
||||
|
||||
//R #line 34 "005_013.cpp"
|
||||
//R true
|
||||
#if defined (MACRO_abc)
|
||||
true
|
||||
#else
|
||||
false
|
||||
#endif
|
||||
|
||||
// 11.2: "defined" is an unary operator whose result is 1 or 0.
|
||||
|
||||
//R #line 46 "005_013.cpp"
|
||||
//R true
|
||||
#if defined MACRO_0 * 3 != 3
|
||||
false
|
||||
#else
|
||||
true
|
||||
#endif
|
||||
|
||||
//R #line 54 "005_013.cpp"
|
||||
//R true
|
||||
#if (!defined ZERO_TOKEN != 0) || (-defined ZERO_TOKEN != -1)
|
||||
false
|
||||
#else
|
||||
true
|
||||
#endif
|
||||
|
||||
/*-
|
||||
* 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.
|
||||
*/
|
||||
|
||||
118
test/testwave/testfiles/005_014.cpp
Normal file
118
test/testwave/testfiles/005_014.cpp
Normal file
@@ -0,0 +1,118 @@
|
||||
/*=============================================================================
|
||||
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 integer preprocessing number token and type of #if expression.
|
||||
|
||||
#define LONG_MIN (-2147483647L - 1) /* minimum (signed) long value */
|
||||
#define LONG_MAX 2147483647L /* maximum (signed) long value */
|
||||
#define ULONG_MAX 0xffffffffUL /* maximum unsigned long value */
|
||||
|
||||
// 12.1:
|
||||
//R #line 28 "005_014.cpp"
|
||||
//R true
|
||||
#if LONG_MAX <= LONG_MIN
|
||||
"Bad evaluation of long."
|
||||
#else
|
||||
true
|
||||
#endif
|
||||
|
||||
//R #line 36 "005_014.cpp"
|
||||
//R true
|
||||
#if LONG_MAX <= 1073741823 /* 0x3FFFFFFF */
|
||||
"Bad evaluation of long."
|
||||
#else
|
||||
true
|
||||
#endif
|
||||
|
||||
// 12.2:
|
||||
//R #line 45 "005_014.cpp"
|
||||
//R true
|
||||
#if ULONG_MAX / 2 < LONG_MAX
|
||||
"Bad evaluation of unsigned long."
|
||||
#else
|
||||
true
|
||||
#endif
|
||||
|
||||
// 12.3: Octal number.
|
||||
//R #line 54 "005_014.cpp"
|
||||
//R true
|
||||
#if 0177777 != 65535
|
||||
"Bad evaluation of octal number."
|
||||
#else
|
||||
true
|
||||
#endif
|
||||
|
||||
// 12.4: Hexadecimal number.
|
||||
//R #line 63 "005_014.cpp"
|
||||
//R true
|
||||
#if 0Xffff != 65535 || 0xFfFf != 65535
|
||||
"Bad evaluation of hexadecimal number."
|
||||
#else
|
||||
true
|
||||
#endif
|
||||
|
||||
// 12.5: Suffix 'L' or 'l'.
|
||||
//R #line 72 "005_014.cpp"
|
||||
//R true
|
||||
#if 0L != 0 || 0l != 0
|
||||
"Bad evaluation of 'L' suffix."
|
||||
#else
|
||||
true
|
||||
#endif
|
||||
|
||||
// 12.6: Suffix 'U' or 'u'.
|
||||
//R #line 81 "005_014.cpp"
|
||||
//R true
|
||||
#if 1U != 1 || 1u != 1
|
||||
"Bad evaluation of 'U' suffix."
|
||||
#else
|
||||
true
|
||||
#endif
|
||||
|
||||
// 12.7: Negative integer.
|
||||
//R #line 90 "005_014.cpp"
|
||||
//R true
|
||||
#if 0 <= -1
|
||||
"Bad evaluation of negative number."
|
||||
#else
|
||||
true
|
||||
#endif
|
||||
|
||||
/*-
|
||||
* 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.
|
||||
*/
|
||||
|
||||
93
test/testwave/testfiles/005_015.cpp
Normal file
93
test/testwave/testfiles/005_015.cpp
Normal file
@@ -0,0 +1,93 @@
|
||||
/*=============================================================================
|
||||
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 valid operators in #if expression.
|
||||
|
||||
// Valid operators are (precedence in this order) :
|
||||
// defined, (unary)+, (unary)-, ~, !,
|
||||
// *, /, %,
|
||||
// +, -,
|
||||
// <<, >>,
|
||||
// <, >, <=, >=,
|
||||
// ==, !=,
|
||||
// &,
|
||||
// ^,
|
||||
// |,
|
||||
// &&,
|
||||
// ||,
|
||||
// ? :
|
||||
|
||||
// 13.1: Bit shift.
|
||||
//R #line 38 "005_015.cpp"
|
||||
//R true
|
||||
#if 1 << 2 != 4 || 8 >> 1 != 4
|
||||
"Bad arithmetic of <<, >> operators."
|
||||
#else
|
||||
true
|
||||
#endif
|
||||
|
||||
// 13.2: Bitwise operators.
|
||||
//R #line 47 "005_015.cpp"
|
||||
//R true
|
||||
#if (3 ^ 5) != 6 || (3 | 5) != 7 || (3 & 5) != 1
|
||||
"Bad arithmetic of ^, |, & operators."
|
||||
#else
|
||||
true
|
||||
#endif
|
||||
|
||||
// 13.3: Result of ||, && operators is either of 1 or 0.
|
||||
//R #line 56 "005_015.cpp"
|
||||
//R true
|
||||
#if (2 || 3) != 1 || (2 && 3) != 1 || (0 || 4) != 1 || (0 && 5) != 0
|
||||
"Bad arithmetic of ||, && operators."
|
||||
#else
|
||||
true
|
||||
#endif
|
||||
|
||||
// 13.4: ?, : operator.
|
||||
//R #line 65 "005_015.cpp"
|
||||
//R true
|
||||
#if (0 ? 1 : 2) != 2
|
||||
"Bad arithmetic of ?: operator.";
|
||||
#else
|
||||
true
|
||||
#endif
|
||||
|
||||
/*-
|
||||
* 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.
|
||||
*/
|
||||
|
||||
79
test/testwave/testfiles/005_016.cpp
Normal file
79
test/testwave/testfiles/005_016.cpp
Normal file
@@ -0,0 +1,79 @@
|
||||
/*=============================================================================
|
||||
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 arithmetic conversion in #if expressions.
|
||||
|
||||
// 13.5: The usual arithmetic conversion is not performed on bit shift.
|
||||
//R #line 24 "005_016.cpp"
|
||||
//R true
|
||||
#if -1 << 3U > 0
|
||||
"Bad conversion of bit shift operands."
|
||||
#else
|
||||
true
|
||||
#endif
|
||||
|
||||
// 13.6: Usual arithmetic conversions.
|
||||
//R #line 33 "005_016.cpp"
|
||||
//R true
|
||||
#if -1 <= 0U /* -1 is converted to unsigned long. */
|
||||
"Bad arithmetic conversion."
|
||||
#else
|
||||
true
|
||||
#endif
|
||||
|
||||
//R #line 41 "005_016.cpp"
|
||||
//R true
|
||||
#if -1 * 1U <= 0
|
||||
"Bad arithmetic conversion."
|
||||
#else
|
||||
true
|
||||
#endif
|
||||
|
||||
// Second and third operands of conditional operator are converted to the
|
||||
// same type, thus -1 is converted to unsigned long.
|
||||
//R #line 51 "005_016.cpp"
|
||||
//R true
|
||||
#if (1 ? -1 : 0U) <= 0
|
||||
"Bad arithmetic conversion.";
|
||||
#else
|
||||
true
|
||||
#endif
|
||||
|
||||
/*-
|
||||
* 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.
|
||||
*/
|
||||
|
||||
88
test/testwave/testfiles/005_017.cpp
Normal file
88
test/testwave/testfiles/005_017.cpp
Normal file
@@ -0,0 +1,88 @@
|
||||
/*=============================================================================
|
||||
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 short-circuit evaluation of #if expression.
|
||||
|
||||
#define MACRO_0 0
|
||||
|
||||
// 13.7: 10/0 or 10/MACRO_0 are never evaluated, "divide by zero" error
|
||||
// cannot occur.
|
||||
|
||||
//R #line 28 "005_017.cpp"
|
||||
//R true
|
||||
#if 0 && 10 / 0
|
||||
false
|
||||
#else
|
||||
true
|
||||
#endif
|
||||
|
||||
//R #line 36 "005_017.cpp"
|
||||
//R true
|
||||
#if not_defined && 10 / not_defined
|
||||
false
|
||||
#else
|
||||
true
|
||||
#endif
|
||||
|
||||
//R #line 44 "005_017.cpp"
|
||||
//R true
|
||||
#if MACRO_0 && 10 / MACRO_0 > 1
|
||||
false
|
||||
#else
|
||||
true
|
||||
#endif
|
||||
|
||||
//R #line 52 "005_017.cpp"
|
||||
//R true
|
||||
#if MACRO_0 ? 10 / MACRO_0 : 0
|
||||
false
|
||||
#else
|
||||
true
|
||||
#endif
|
||||
|
||||
//R #line 58 "005_017.cpp"
|
||||
//R true
|
||||
#if MACRO_0 == 0 || 10 / MACRO_0 > 1 /* Valid block */
|
||||
true
|
||||
#else
|
||||
false
|
||||
#endif
|
||||
|
||||
/*-
|
||||
* 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.
|
||||
*/
|
||||
|
||||
91
test/testwave/testfiles/005_018.cpp
Normal file
91
test/testwave/testfiles/005_018.cpp
Normal file
@@ -0,0 +1,91 @@
|
||||
/*=============================================================================
|
||||
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 grouping of sub-expressions in #if expression.
|
||||
|
||||
// 13.8: Unary operators are grouped from right to left.
|
||||
//R #line 24 "005_018.cpp"
|
||||
//R true
|
||||
#if (- -1 != 1) || (!!9 != 1) || (-!+!9 != -1) || (~~1 != 1)
|
||||
"Bad grouping of -, +, !, ~ in #if expression."
|
||||
#else
|
||||
true
|
||||
#endif
|
||||
|
||||
// 13.9: ?: operators are grouped from right to left.
|
||||
//R #line 33 "005_018.cpp"
|
||||
//R true
|
||||
#if (1 ? 2 ? 3 ? 3 : 2 : 1 : 0) != 3
|
||||
"Bad grouping of ? : in #if expression."
|
||||
#else
|
||||
true
|
||||
#endif
|
||||
|
||||
// 13.10: Other operators are grouped from left to right.
|
||||
//R #line 42 "005_018.cpp"
|
||||
//R true
|
||||
#if (15 >> 2 >> 1 != 1) || (3 << 2 << 1 != 24)
|
||||
"Bad grouping of >>, << in #if expression."
|
||||
#else
|
||||
true
|
||||
#endif
|
||||
|
||||
// 13.11: Test of precedence.
|
||||
//R #line 51 "005_018.cpp"
|
||||
//R true
|
||||
#if 3*10/2 >> !0*2 >> !+!-9 != 1
|
||||
"Bad grouping of -, +, !, *, /, >> in #if expression."
|
||||
#else
|
||||
true
|
||||
#endif
|
||||
|
||||
// 13.12: Overall test. Grouped as:
|
||||
// ((((((+1 - -1 - ~~1 - -!0) & 6) | ((8 % 9) ^ (-2 * -2))) >> 1) == 7)
|
||||
// ? 7 : 0) != 7
|
||||
// evaluates to false.
|
||||
//R #line 63 "005_018.cpp"
|
||||
//R true
|
||||
#if (((+1- -1-~~1- -!0&6|8%9^-2*-2)>>1)==7?7:0)!=7
|
||||
"Bad arithmetic of #if expression."
|
||||
#else
|
||||
true
|
||||
#endif
|
||||
|
||||
/*-
|
||||
* 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.
|
||||
*/
|
||||
|
||||
72
test/testwave/testfiles/005_019.cpp
Normal file
72
test/testwave/testfiles/005_019.cpp
Normal file
@@ -0,0 +1,72 @@
|
||||
/*=============================================================================
|
||||
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 #if expressions with macros.
|
||||
|
||||
#define ZERO_TOKEN
|
||||
#define MACRO_0 0
|
||||
#define MACRO_1 1
|
||||
|
||||
#define and_op &&
|
||||
#define or_op ||
|
||||
#define not_eq_op !=
|
||||
#define bitor_op |
|
||||
|
||||
// 13.13: With macros expanding to operators.
|
||||
//R #line 32 "005_019.cpp"
|
||||
//R true
|
||||
#if (1 bitor_op 2) == 3 and_op 4 not_eq_op 5 or_op 0
|
||||
// #if (1 | 2) == 3 && 4 != 5 || 0
|
||||
true
|
||||
#else
|
||||
"Bad evaluation of macros expanding to operators in #if expression."
|
||||
#endif
|
||||
|
||||
// 13.14: With macros expanding to nothing, nonsence but legal.
|
||||
//R #line 42 "005_019.cpp"
|
||||
//R true
|
||||
#if ZERO_TOKEN MACRO_1 ZERO_TOKEN > ZERO_TOKEN MACRO_0 ZERO_TOKEN
|
||||
// #if 1 > 0
|
||||
true
|
||||
#else
|
||||
"Bad evaluation of macros expanding to 0 token in #if expression."
|
||||
#endif
|
||||
|
||||
/*-
|
||||
* 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.
|
||||
*/
|
||||
|
||||
@@ -95,6 +95,18 @@
|
||||
005_005.cpp
|
||||
005_006.cpp
|
||||
005_007.cpp
|
||||
005_008.cpp
|
||||
005_009.cpp
|
||||
005_010.cpp
|
||||
005_011.cpp
|
||||
005_012.cpp
|
||||
005_013.cpp
|
||||
005_014.cpp
|
||||
005_015.cpp
|
||||
005_016.cpp
|
||||
005_017.cpp
|
||||
005_018.cpp
|
||||
005_019.cpp
|
||||
|
||||
#
|
||||
# 999: General preprocessing problems
|
||||
|
||||
Reference in New Issue
Block a user