11cb0ef41Sopenharmony_ci// Copyright 2006, Google Inc. 21cb0ef41Sopenharmony_ci// All rights reserved. 31cb0ef41Sopenharmony_ci// 41cb0ef41Sopenharmony_ci// Redistribution and use in source and binary forms, with or without 51cb0ef41Sopenharmony_ci// modification, are permitted provided that the following conditions are 61cb0ef41Sopenharmony_ci// met: 71cb0ef41Sopenharmony_ci// 81cb0ef41Sopenharmony_ci// * Redistributions of source code must retain the above copyright 91cb0ef41Sopenharmony_ci// notice, this list of conditions and the following disclaimer. 101cb0ef41Sopenharmony_ci// * Redistributions in binary form must reproduce the above 111cb0ef41Sopenharmony_ci// copyright notice, this list of conditions and the following disclaimer 121cb0ef41Sopenharmony_ci// in the documentation and/or other materials provided with the 131cb0ef41Sopenharmony_ci// distribution. 141cb0ef41Sopenharmony_ci// * Neither the name of Google Inc. nor the names of its 151cb0ef41Sopenharmony_ci// contributors may be used to endorse or promote products derived from 161cb0ef41Sopenharmony_ci// this software without specific prior written permission. 171cb0ef41Sopenharmony_ci// 181cb0ef41Sopenharmony_ci// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 191cb0ef41Sopenharmony_ci// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 201cb0ef41Sopenharmony_ci// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 211cb0ef41Sopenharmony_ci// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 221cb0ef41Sopenharmony_ci// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 231cb0ef41Sopenharmony_ci// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 241cb0ef41Sopenharmony_ci// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 251cb0ef41Sopenharmony_ci// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 261cb0ef41Sopenharmony_ci// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 271cb0ef41Sopenharmony_ci// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 281cb0ef41Sopenharmony_ci// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 291cb0ef41Sopenharmony_ci 301cb0ef41Sopenharmony_ci// Google C++ Testing and Mocking Framework definitions useful in production 311cb0ef41Sopenharmony_ci// code. 321cb0ef41Sopenharmony_ci 331cb0ef41Sopenharmony_ci#ifndef GOOGLETEST_INCLUDE_GTEST_GTEST_PROD_H_ 341cb0ef41Sopenharmony_ci#define GOOGLETEST_INCLUDE_GTEST_GTEST_PROD_H_ 351cb0ef41Sopenharmony_ci 361cb0ef41Sopenharmony_ci// When you need to test the private or protected members of a class, 371cb0ef41Sopenharmony_ci// use the FRIEND_TEST macro to declare your tests as friends of the 381cb0ef41Sopenharmony_ci// class. For example: 391cb0ef41Sopenharmony_ci// 401cb0ef41Sopenharmony_ci// class MyClass { 411cb0ef41Sopenharmony_ci// private: 421cb0ef41Sopenharmony_ci// void PrivateMethod(); 431cb0ef41Sopenharmony_ci// FRIEND_TEST(MyClassTest, PrivateMethodWorks); 441cb0ef41Sopenharmony_ci// }; 451cb0ef41Sopenharmony_ci// 461cb0ef41Sopenharmony_ci// class MyClassTest : public testing::Test { 471cb0ef41Sopenharmony_ci// // ... 481cb0ef41Sopenharmony_ci// }; 491cb0ef41Sopenharmony_ci// 501cb0ef41Sopenharmony_ci// TEST_F(MyClassTest, PrivateMethodWorks) { 511cb0ef41Sopenharmony_ci// // Can call MyClass::PrivateMethod() here. 521cb0ef41Sopenharmony_ci// } 531cb0ef41Sopenharmony_ci// 541cb0ef41Sopenharmony_ci// Note: The test class must be in the same namespace as the class being tested. 551cb0ef41Sopenharmony_ci// For example, putting MyClassTest in an anonymous namespace will not work. 561cb0ef41Sopenharmony_ci 571cb0ef41Sopenharmony_ci#define FRIEND_TEST(test_case_name, test_name) \ 581cb0ef41Sopenharmony_ci friend class test_case_name##_##test_name##_Test 591cb0ef41Sopenharmony_ci 601cb0ef41Sopenharmony_ci#endif // GOOGLETEST_INCLUDE_GTEST_GTEST_PROD_H_ 61