1 /* 2 * Copyright (c) 2023 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 <gtest/gtest.h> 17 #include <thread> 18 #include "eu/execute_unit.h" 19 #include "eu/thread_group.h" 20 #include "internal_inc/types.h" 21 22 using namespace testing; 23 using namespace testing::ext; 24 using namespace ffrt; 25 using namespace std; 26 27 28 class ExecuteUnitTest : public testing::Test { 29 protected: SetUpTestCase()30 static void SetUpTestCase() 31 { 32 } 33 TearDownTestCase()34 static void TearDownTestCase() 35 { 36 } 37 SetUp()38 virtual void SetUp() 39 { 40 } 41 TearDown()42 virtual void TearDown() 43 { 44 } 45 }; 46 47 /** 48 * @tc.name: NotifyTaskAdded 49 * @tc.desc: Test whether the NotifyTaskAdded interface are normal. 50 * @tc.type: FUNC 51 */ 52 HWTEST_F(ExecuteUnitTest, NotifyTaskAdded, TestSize.Level1) 53 { 54 ExecuteUnit::Instance().NotifyTaskAdded(qos(5)); 55 } 56 57 /** 58 * @tc.name: BindWG 59 * @tc.desc: Test whether the BindWG interface are normal. 60 * @tc.type: FUNC 61 */ 62 HWTEST_F(ExecuteUnitTest, BindWG, TestSize.Level1) 63 { 64 QoS *qos1 = new QoS(); 65 ExecuteUnit::Instance().BindWG(DevType(0), *qos1); 66 } 67 68 /** 69 * @tc.name: UnbindTG 70 * @tc.desc: Test whether the UnbindTG interface are normal. 71 * @tc.type: FUNC 72 */ 73 HWTEST_F(ExecuteUnitTest, UnbindTG, TestSize.Level1) 74 { 75 QoS *qos1 = new QoS(); 76 ExecuteUnit::Instance().UnbindTG(DevType(0), *qos1); 77 } 78 79 /** 80 * @tc.name: BindTG 81 * @tc.desc: Test whether the BindTG interface are normal. 82 * @tc.type: FUNC 83 */ 84 HWTEST_F(ExecuteUnitTest, BindTG, TestSize.Level1) 85 { 86 QoS *qos1 = new QoS(); 87 ThreadGroup* it = ExecuteUnit::Instance().BindTG(DevType(0), *qos1); 88 } 89