11be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// Copyright 2007, Google Inc. 21be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// All rights reserved. 31be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// 41be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// Redistribution and use in source and binary forms, with or without 51be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// modification, are permitted provided that the following conditions are 61be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// met: 71be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// 81be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// * Redistributions of source code must retain the above copyright 91be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// notice, this list of conditions and the following disclaimer. 101be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// * Redistributions in binary form must reproduce the above 111be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// copyright notice, this list of conditions and the following disclaimer 121be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// in the documentation and/or other materials provided with the 131be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// distribution. 141be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// * Neither the name of Google Inc. nor the names of its 151be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// contributors may be used to endorse or promote products derived from 161be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// this software without specific prior written permission. 171be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// 181be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 191be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 201be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 211be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 221be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 231be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 241be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 251be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 261be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 271be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 281be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 291be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// 301be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// Author: wan@google.com (Zhanyong Wan) 311be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 321be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// This file is the input to a negative-compilation test for Google 331be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// Test. Code here is NOT supposed to compile. Its purpose is to 341be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// verify that certain incorrect usages of the Google Test API are 351be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// indeed rejected by the compiler. 361be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// 371be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// We still need to write the negative-compilation test itself, which 381be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// will be tightly coupled with the build environment. 391be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// 401be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// TODO(wan@google.com): finish the negative-compilation test. 411be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 421be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania#ifdef TEST_CANNOT_IGNORE_RUN_ALL_TESTS_RESULT 431be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// Tests that the result of RUN_ALL_TESTS() cannot be ignored. 441be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 451be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania#include <gtest/gtest.h> 461be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 471be2c9def7187e4e643c00a31dd9986395795d7dNicolas Cataniaint main(int argc, char** argv) { 481be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania testing::InitGoogleTest(&argc, argv); 491be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania RUN_ALL_TESTS(); // This line shouldn't compile. 501be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania} 511be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 521be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania#elif defined(TEST_USER_CANNOT_INCLUDE_GTEST_INTERNAL_INL_H) 531be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// Tests that a user cannot include gtest-internal-inl.h in his code. 541be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 551be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania#include "src/gtest-internal-inl.h" 561be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 571be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania#elif defined(TEST_CATCHES_DECLARING_SETUP_IN_TEST_FIXTURE_WITH_TYPO) 581be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// Tests that the compiler catches the typo when a user declares a 591be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// Setup() method in a test fixture. 601be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 611be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania#include <gtest/gtest.h> 621be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 631be2c9def7187e4e643c00a31dd9986395795d7dNicolas Cataniaclass MyTest : public testing::Test { 641be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania protected: 651be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania void Setup() {} 661be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania}; 671be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 681be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania#elif defined(TEST_CATCHES_CALLING_SETUP_IN_TEST_WITH_TYPO) 691be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// Tests that the compiler catches the typo when a user calls Setup() 701be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// from a test fixture. 711be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 721be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania#include <gtest/gtest.h> 731be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 741be2c9def7187e4e643c00a31dd9986395795d7dNicolas Cataniaclass MyTest : public testing::Test { 751be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania protected: 761be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania virtual void SetUp() { 771be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania testing::Test::Setup(); // Tries to call SetUp() in the parent class. 781be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania } 791be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania}; 801be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 811be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania#elif defined(TEST_CATCHES_DECLARING_SETUP_IN_ENVIRONMENT_WITH_TYPO) 821be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// Tests that the compiler catches the typo when a user declares a 831be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// Setup() method in a subclass of Environment. 841be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 851be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania#include <gtest/gtest.h> 861be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 871be2c9def7187e4e643c00a31dd9986395795d7dNicolas Cataniaclass MyEnvironment : public testing::Environment { 881be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania public: 891be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania void Setup() {} 901be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania}; 911be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 921be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania#elif defined(TEST_CATCHES_CALLING_SETUP_IN_ENVIRONMENT_WITH_TYPO) 931be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// Tests that the compiler catches the typo when a user calls Setup() 941be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// in an Environment. 951be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 961be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania#include <gtest/gtest.h> 971be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 981be2c9def7187e4e643c00a31dd9986395795d7dNicolas Cataniaclass MyEnvironment : public testing::Environment { 991be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania protected: 1001be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania virtual void SetUp() { 1011be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania // Tries to call SetUp() in the parent class. 1021be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania testing::Environment::Setup(); 1031be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania } 1041be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania}; 1051be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 1061be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania#elif defined(TEST_CATCHES_WRONG_CASE_IN_TYPED_TEST_P) 1071be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// Tests that the compiler catches using the wrong test case name in 1081be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// TYPED_TEST_P. 1091be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 1101be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania#include <gtest/gtest.h> 1111be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 1121be2c9def7187e4e643c00a31dd9986395795d7dNicolas Cataniatemplate <typename T> 1131be2c9def7187e4e643c00a31dd9986395795d7dNicolas Cataniaclass FooTest : public testing::Test { 1141be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania}; 1151be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 1161be2c9def7187e4e643c00a31dd9986395795d7dNicolas Cataniatemplate <typename T> 1171be2c9def7187e4e643c00a31dd9986395795d7dNicolas Cataniaclass BarTest : public testing::Test { 1181be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania}; 1191be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 1201be2c9def7187e4e643c00a31dd9986395795d7dNicolas CataniaTYPED_TEST_CASE_P(FooTest); 1211be2c9def7187e4e643c00a31dd9986395795d7dNicolas CataniaTYPED_TEST_P(BarTest, A) {} // Wrong test case name. 1221be2c9def7187e4e643c00a31dd9986395795d7dNicolas CataniaREGISTER_TYPED_TEST_CASE_P(FooTest, A); 1231be2c9def7187e4e643c00a31dd9986395795d7dNicolas CataniaINSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, testing::Types<int>); 1241be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 1251be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania#elif defined(TEST_CATCHES_WRONG_CASE_IN_REGISTER_TYPED_TEST_CASE_P) 1261be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// Tests that the compiler catches using the wrong test case name in 1271be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// REGISTER_TYPED_TEST_CASE_P. 1281be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 1291be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania#include <gtest/gtest.h> 1301be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 1311be2c9def7187e4e643c00a31dd9986395795d7dNicolas Cataniatemplate <typename T> 1321be2c9def7187e4e643c00a31dd9986395795d7dNicolas Cataniaclass FooTest : public testing::Test { 1331be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania}; 1341be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 1351be2c9def7187e4e643c00a31dd9986395795d7dNicolas Cataniatemplate <typename T> 1361be2c9def7187e4e643c00a31dd9986395795d7dNicolas Cataniaclass BarTest : public testing::Test { 1371be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania}; 1381be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 1391be2c9def7187e4e643c00a31dd9986395795d7dNicolas CataniaTYPED_TEST_CASE_P(FooTest); 1401be2c9def7187e4e643c00a31dd9986395795d7dNicolas CataniaTYPED_TEST_P(FooTest, A) {} 1411be2c9def7187e4e643c00a31dd9986395795d7dNicolas CataniaREGISTER_TYPED_TEST_CASE_P(BarTest, A); // Wrong test case name. 1421be2c9def7187e4e643c00a31dd9986395795d7dNicolas CataniaINSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, testing::Types<int>); 1431be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 1441be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania#elif defined(TEST_CATCHES_WRONG_CASE_IN_INSTANTIATE_TYPED_TEST_CASE_P) 1451be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// Tests that the compiler catches using the wrong test case name in 1461be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// INSTANTIATE_TYPED_TEST_CASE_P. 1471be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 1481be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania#include <gtest/gtest.h> 1491be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 1501be2c9def7187e4e643c00a31dd9986395795d7dNicolas Cataniatemplate <typename T> 1511be2c9def7187e4e643c00a31dd9986395795d7dNicolas Cataniaclass FooTest : public testing::Test { 1521be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania}; 1531be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 1541be2c9def7187e4e643c00a31dd9986395795d7dNicolas Cataniatemplate <typename T> 1551be2c9def7187e4e643c00a31dd9986395795d7dNicolas Cataniaclass BarTest : public testing::Test { 1561be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania}; 1571be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 1581be2c9def7187e4e643c00a31dd9986395795d7dNicolas CataniaTYPED_TEST_CASE_P(FooTest); 1591be2c9def7187e4e643c00a31dd9986395795d7dNicolas CataniaTYPED_TEST_P(FooTest, A) {} 1601be2c9def7187e4e643c00a31dd9986395795d7dNicolas CataniaREGISTER_TYPED_TEST_CASE_P(FooTest, A); 1611be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 1621be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// Wrong test case name. 1631be2c9def7187e4e643c00a31dd9986395795d7dNicolas CataniaINSTANTIATE_TYPED_TEST_CASE_P(My, BarTest, testing::Types<int>); 1641be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 1651be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania#elif defined(TEST_CATCHES_INSTANTIATE_TYPED_TESET_CASE_P_WITH_SAME_NAME_PREFIX) 1661be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// Tests that the compiler catches instantiating TYPED_TEST_CASE_P 1671be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// twice with the same name prefix. 1681be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 1691be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania#include <gtest/gtest.h> 1701be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 1711be2c9def7187e4e643c00a31dd9986395795d7dNicolas Cataniatemplate <typename T> 1721be2c9def7187e4e643c00a31dd9986395795d7dNicolas Cataniaclass FooTest : public testing::Test { 1731be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania}; 1741be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 1751be2c9def7187e4e643c00a31dd9986395795d7dNicolas CataniaTYPED_TEST_CASE_P(FooTest); 1761be2c9def7187e4e643c00a31dd9986395795d7dNicolas CataniaTYPED_TEST_P(FooTest, A) {} 1771be2c9def7187e4e643c00a31dd9986395795d7dNicolas CataniaREGISTER_TYPED_TEST_CASE_P(FooTest, A); 1781be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 1791be2c9def7187e4e643c00a31dd9986395795d7dNicolas CataniaINSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, testing::Types<int>); 1801be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 1811be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// Wrong name prefix: "My" has been used. 1821be2c9def7187e4e643c00a31dd9986395795d7dNicolas CataniaINSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, testing::Types<double>); 1831be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 1841be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania#elif defined(TEST_STATIC_ASSERT_TYPE_EQ_IS_NOT_A_TYPE) 1851be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 1861be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania#include <gtest/gtest.h> 1871be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 1881be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// Tests that StaticAssertTypeEq<T1, T2> cannot be used as a type. 1891be2c9def7187e4e643c00a31dd9986395795d7dNicolas Cataniatesting::StaticAssertTypeEq<int, int> dummy; 1901be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 1911be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania#elif defined(TEST_STATIC_ASSERT_TYPE_EQ_WORKS_IN_NAMESPACE) 1921be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 1931be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania#include <gtest/gtest.h> 1941be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 1951be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// Tests that StaticAssertTypeEq<T1, T2> works in a namespace scope. 1961be2c9def7187e4e643c00a31dd9986395795d7dNicolas Cataniastatic bool dummy = testing::StaticAssertTypeEq<int, const int>(); 1971be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 1981be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania#elif defined(TEST_STATIC_ASSERT_TYPE_EQ_WORKS_IN_CLASS) 1991be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 2001be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania#include <gtest/gtest.h> 2011be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 2021be2c9def7187e4e643c00a31dd9986395795d7dNicolas Cataniatemplate <typename T> 2031be2c9def7187e4e643c00a31dd9986395795d7dNicolas Cataniaclass Helper { 2041be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania public: 2051be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania // Tests that StaticAssertTypeEq<T1, T2> works in a class. 2061be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania Helper() { testing::StaticAssertTypeEq<int, T>(); } 2071be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 2081be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania void DoSomething() {} 2091be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania}; 2101be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 2111be2c9def7187e4e643c00a31dd9986395795d7dNicolas Cataniavoid Test() { 2121be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania Helper<bool> h; 2131be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania h.DoSomething(); // To avoid the "unused variable" warning. 2141be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania} 2151be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 2161be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania#elif defined(TEST_STATIC_ASSERT_TYPE_EQ_WORKS_IN_FUNCTION) 2171be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 2181be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania#include <gtest/gtest.h> 2191be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 2201be2c9def7187e4e643c00a31dd9986395795d7dNicolas Cataniavoid Test() { 2211be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania // Tests that StaticAssertTypeEq<T1, T2> works inside a function. 2221be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania testing::StaticAssertTypeEq<const int, int>(); 2231be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania} 2241be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 2251be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania#else 2261be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania// A sanity test. This should compile. 2271be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 2281be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania#include <gtest/gtest.h> 2291be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 2301be2c9def7187e4e643c00a31dd9986395795d7dNicolas Cataniaint main() { 2311be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania return RUN_ALL_TESTS(); 2321be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania} 2331be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania 2341be2c9def7187e4e643c00a31dd9986395795d7dNicolas Catania#endif 235