1 // Copyright 2023 Google LLC 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 #ifndef NEARBY_PRESENCE_NP_CPP_FFI_TESTS_NP_CPP_TEST_H_ 16 #define NEARBY_PRESENCE_NP_CPP_FFI_TESTS_NP_CPP_TEST_H_ 17 18 #include "gtest/gtest.h" 19 #include "nearby_protocol.h" 20 #include "shared_test_util.h" 21 22 class NpCppTest : public testing::Test { 23 protected: SetUpTestSuite()24 static void SetUpTestSuite() { 25 if (!panic_handler_set) { 26 ASSERT_TRUE( 27 nearby_protocol::GlobalConfig::SetPanicHandler(test_panic_handler)); 28 panic_handler_set = true; 29 } else { 30 ASSERT_FALSE( 31 nearby_protocol::GlobalConfig::SetPanicHandler(test_panic_handler)); 32 } 33 } 34 static bool panic_handler_set; 35 }; 36 37 #endif // NEARBY_PRESENCE_NP_CPP_FFI_TESTS_NP_CPP_TEST_H_ 38