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 #include <gtest/gtest.h>
16 #include "ffrt_inner.h"
17 #include "c/executor_task.h"
18 #include "tm/scpu_task.h"
19 #include "dfx/log/ffrt_log_api.h"
20 #include "../common.h"
21 
22 using namespace std;
23 using namespace ffrt;
24 using namespace testing;
25 #ifdef HWTEST_TESTING_EXT_ENABLE
26 using namespace testing::ext;
27 #endif
28 
29 class InheritTest : public testing::Test {
30 protected:
SetUpTestCase()31     static void SetUpTestCase()
32     {
33     }
34 
TearDownTestCase()35     static void TearDownTestCase()
36     {
37     }
38 
SetUp()39     virtual void SetUp()
40     {
41     }
42 
TearDown()43     virtual void TearDown()
44     {
45     }
46 };
47 
48 HWTEST_F(InheritTest, executorToCPUEUTask, TestSize.Level1)
49 {
50     ffrt_executor_task_t w;
51     w.type = 1;
52     auto* cputask = reinterpret_cast<SCPUEUTask*>(&w);
53     EXPECT_EQ(w.type, 1);
54     EXPECT_EQ(cputask->type, 1);
55     EXPECT_EQ(reinterpret_cast<uint64_t>(&(w.type)), reinterpret_cast<uint64_t>(&(cputask->type)));
56 }