1 /*
2 * Copyright (c) 2024 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 "../check_mock.h"
17 #include "../../../src/mock/mock_values.h"
18 #include "../cpp_helpers_mock.h"
19
20 #include <gtest/gtest.h>
21
22 namespace libabckit::test {
23
24 class LibAbcKitCppMockTestType : public ::testing::Test {};
25
26 // Test: test-kind=mock, api=Type::GetTypeId, abc-kind=ArkTS1, category=internal, extension=cpp
TEST_F(LibAbcKitCppMockTestType,Type_GetTypeId)27 TEST_F(LibAbcKitCppMockTestType, Type_GetTypeId)
28 {
29 ASSERT_TRUE(CheckMockedStackEmpty());
30 {
31 abckit::File f(DEFAULT_PATH);
32 ASSERT_TRUE(CheckMockedApi("OpenAbc"));
33 abckit::mock::helpers::GetMockType(f).GetTypeId();
34 ASSERT_TRUE(CheckMockedApi("TypeGetTypeId"));
35 }
36 ASSERT_TRUE(CheckMockedApi("CloseFile"));
37 ASSERT_TRUE(CheckMockedStackEmpty());
38 }
39
40 // Test: test-kind=mock, api=Type::GetReferenceClass, abc-kind=ArkTS1, category=internal, extension=cpp
TEST_F(LibAbcKitCppMockTestType,Type_GetReferenceClass)41 TEST_F(LibAbcKitCppMockTestType, Type_GetReferenceClass)
42 {
43 ASSERT_TRUE(CheckMockedStackEmpty());
44 {
45 abckit::File f(DEFAULT_PATH);
46 ASSERT_TRUE(CheckMockedApi("OpenAbc"));
47 abckit::mock::helpers::GetMockType(f).GetReferenceClass();
48 ASSERT_TRUE(CheckMockedApi("TypeGetReferenceClass"));
49 }
50 ASSERT_TRUE(CheckMockedApi("CloseFile"));
51 ASSERT_TRUE(CheckMockedStackEmpty());
52 }
53
54 } // namespace libabckit::test