1/* 2 * Copyright (c) 2021 Huawei Device Co., Ltd. 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 16#include "test/utils/test_util.h" 17 18namespace panda::ecmascript::tooling::test { 19TestMap TestUtil::testMap_; 20os::memory::Mutex TestUtil::eventMutex_; 21os::memory::ConditionVariable TestUtil::eventCv_; 22DebugEvent TestUtil::lastEvent_ = DebugEvent::UNINITIALIZED; 23bool TestUtil::initialized_ = false; 24os::memory::Mutex TestUtil::suspendMutex_; 25os::memory::ConditionVariable TestUtil::suspendCv_; 26bool TestUtil::suspended_ = false; 27JSPtLocation TestUtil::lastEventLocation_(nullptr, EntityId(0), 0); 28 29std::ostream &operator<<(std::ostream &out, DebugEvent value) 30{ 31 const char *s = nullptr; 32 33#define ADD_CASE(entry) \ 34 case (entry): \ 35 s = #entry; \ 36 break 37 38 switch (value) { 39 ADD_CASE(DebugEvent::BREAKPOINT); 40 ADD_CASE(DebugEvent::LOAD_MODULE); 41 ADD_CASE(DebugEvent::PAUSED); 42 ADD_CASE(DebugEvent::EXCEPTION); 43 ADD_CASE(DebugEvent::STEP_COMPLETE); 44 ADD_CASE(DebugEvent::METHOD_ENTRY); 45 ADD_CASE(DebugEvent::SINGLE_STEP); 46 ADD_CASE(DebugEvent::VM_START); 47 ADD_CASE(DebugEvent::VM_INITIALIZATION); 48 ADD_CASE(DebugEvent::VM_DEATH); 49 ADD_CASE(DebugEvent::UNINITIALIZED); 50 default: { 51 ASSERT(false && "Unknown DebugEvent"); // NOLINT 52 } 53 } 54 55#undef ADD_CASE 56 57 return out << s; 58} 59 60std::ostream &operator<<(std::ostream &out, std::nullptr_t) 61{ 62 return out << "nullptr"; 63} 64 65TestEvents::TestEvents() 66{ 67 scenario = []() { 68 ASSERT_EXITED(); 69 return true; 70 }; 71} 72} // namespace panda::ecmascript::tooling::test 73