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