1 /*
2 * Copyright (c) 2022 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 #define private public
17 #include "data_buffer_test.h"
18 #undef private
19
20 using namespace testing::ext;
21
22 namespace OHOS {
23 namespace DistributedHardware {
SetUpTestCase(void)24 void DataBufferTest::SetUpTestCase(void) {}
25
TearDownTestCase(void)26 void DataBufferTest::TearDownTestCase(void) {}
27
SetUp()28 void DataBufferTest::SetUp()
29 {
30 dataBuffer_ = std::make_shared<DataBuffer>(capacity);
31 }
32
TearDown()33 void DataBufferTest::TearDown() {}
34
35 /**
36 * @tc.name: Capacity_001
37 * @tc.desc: Verify the Capacity function.
38 * @tc.type: FUNC
39 * @tc.require: Issue Number
40 */
41 HWTEST_F(DataBufferTest, Capacity_001, TestSize.Level1)
42 {
43 size_t actual = dataBuffer_->Capacity();
44 EXPECT_EQ(capacity, actual);
45 }
46
47 /**
48 * @tc.name: Data_001
49 * @tc.desc: Verify the Data function.
50 * @tc.type: FUNC
51 * @tc.require: Issue Number
52 */
53 HWTEST_F(DataBufferTest, Data_001, TestSize.Level1)
54 {
55 uint8_t *actual = dataBuffer_->Data();
56 EXPECT_NE(nullptr, actual);
57 }
58 } // namespace DistributedHardware
59 } // namespace OHOS