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
19using namespace testing::ext;
20
21namespace {
22class WriterAdapterTest : public ::testing::Test {
23protected:
24    static void SetUpTestCase() {}
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 */
33HWTEST_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 */
45HWTEST_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