• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "samgr_wrapper_test.h"
17 
18 #include <cstring>
19 #include <gtest/gtest.h>
20 
21 extern "C" bool LoadService(int32_t saId);
22 
23 using namespace testing::ext;
24 namespace UnitTest::AssetSamgrWrapperTest {
25 class AssetSamgrWrapperTest : public testing::Test {
26 public:
27     static void SetUpTestCase(void);
28 
29     static void TearDownTestCase(void);
30 
31     void SetUp(void);
32 
33     void TearDown(void);
34 };
35 
SetUpTestCase(void)36 void AssetSamgrWrapperTest::SetUpTestCase(void)
37 {
38 }
39 
TearDownTestCase(void)40 void AssetSamgrWrapperTest::TearDownTestCase(void)
41 {
42 }
43 
SetUp(void)44 void AssetSamgrWrapperTest::SetUp(void)
45 {
46 }
47 
TearDown(void)48 void AssetSamgrWrapperTest::TearDown(void)
49 {
50 }
51 
52 /**
53  * @tc.name: AssetSamgrWrapperTest.AssetSamgrWrapperTest001
54  * @tc.desc: Test asset func LoadService, expect
55  * @tc.type: FUNC
56  * @tc.result:0
57  */
58 HWTEST_F(AssetSamgrWrapperTest, AssetSamgrWrapperTest001, TestSize.Level0)
59 {
60     int32_t asId = 3510;
61     ASSERT_EQ(true, LoadService(asId));
62 }
63 
64 /**
65  * @tc.name: AssetSamgrWrapperTest.AssetSamgrWrapperTest002
66  * @tc.desc: Test asset func LoadService, expect
67  * @tc.type: FUNC
68  * @tc.result:0
69  */
70 HWTEST_F(AssetSamgrWrapperTest, AssetSamgrWrapperTest002, TestSize.Level0)
71 {
72     int32_t asId = -1;
73     ASSERT_EQ(false, LoadService(asId));
74 }
75 
76 /**
77  * @tc.name: AssetSamgrWrapperTest.AssetSamgrWrapperTest003
78  * @tc.desc: Test asset func LoadService, expect
79  * @tc.type: FUNC
80  * @tc.result:0
81  */
82 HWTEST_F(AssetSamgrWrapperTest, AssetSamgrWrapperTest003, TestSize.Level0)
83 {
84     int32_t asId = 99999;
85     ASSERT_EQ(false, LoadService(asId));
86 }
87 }