1 /*
2 * Copyright (c) Huawei Technologies Co., Ltd. 2021. All rights reserved.
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 "writer_adapter.h"
18
19 using namespace testing::ext;
20
21 namespace {
22 class WriterAdapterTest : public ::testing::Test {
23 protected:
SetUpTestCase()24 static void SetUpTestCase() {}
TearDownTestCase()25 static void TearDownTestCase() {}
26 };
27
28 /**
29 * @tc.name: plugin
30 * @tc.desc: Write data to shared memory through writer.
31 * @tc.type: FUNC
32 */
HWTEST_F(WriterAdapterTest, Writer, TestSize.Level1)33 HWTEST_F(WriterAdapterTest, Writer, TestSize.Level1)
34 {
35 WriterAdapter writerAdapter;
36 EXPECT_EQ(writerAdapter.GetWriter(), nullptr);
37 EXPECT_EQ(writerAdapter.GetStruct(), &writerAdapter.writerStruct_);
38 }
39
40 /**
41 * @tc.name: plugin
42 * @tc.desc: Write data to shared memory through writer.
43 * @tc.type: FUNC
44 */
HWTEST_F(WriterAdapterTest, Func, TestSize.Level1)45 HWTEST_F(WriterAdapterTest, Func, TestSize.Level1)
46 {
47 WriterAdapter writerAdapter;
48 EXPECT_EQ(writerAdapter.WriteFunc(nullptr, nullptr, 0), 0);
49 EXPECT_FALSE(writerAdapter.FlushFunc(nullptr));
50 }
51 } // namespace