1/*
2 * Copyright (c) 2021-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#include <gtest/gtest.h>
17
18#define private public
19#define protected public
20#include "bool_wrapper.h"
21#undef private
22#undef protected
23
24using namespace OHOS;
25using namespace OHOS::AAFwk;
26using testing::ext::TestSize;
27
28namespace OHOS {
29namespace AAFwk {
30class AAfWKBoolWrapperTest : public testing::Test {
31public:
32    static void SetUpTestCase() {};
33    static void TearDownTestCase() {};
34    void SetUp() {};
35    void TearDown() {};
36};
37
38/**
39 * @tc.number: BoolWrapperTest_GetValue_001
40 * @tc.name: GetValue
41 * @tc.desc:
42 */
43HWTEST_F(AAfWKBoolWrapperTest, BoolWrapperTest_GetValue_001, TestSize.Level1)
44{
45  bool value = true;
46  Boolean bl(value);
47  ErrCode result = bl.GetValue(value);
48  EXPECT_EQ(ERR_OK, result);
49}
50
51/**
52 * @tc.number: BoolWrapperTest_ToString_001
53 * @tc.name: ToString
54 * @tc.desc:
55 */
56HWTEST_F(AAfWKBoolWrapperTest, BoolWrapperTest_ToString_001, TestSize.Level1)
57{
58  bool value = true;
59  Boolean bl(value);
60  EXPECT_EQ("true", bl.ToString());
61}
62
63/**
64 * @tc.number: BoolWrapperTest_Box_001
65 * @tc.name: Box
66 * @tc.desc:
67 */
68HWTEST_F(AAfWKBoolWrapperTest, BoolWrapperTest_Box_001, TestSize.Level1)
69{
70  bool value = true;
71  Boolean bl(value);
72  bool result = bl.Unbox(bl.Box(value));
73  EXPECT_EQ(true, result);
74}
75
76/**
77 * @tc.number: BoolWrapperTest_Parse_001
78 * @tc.name: Parse
79 * @tc.desc:
80 */
81HWTEST_F(AAfWKBoolWrapperTest, BoolWrapperTest_Parse_001, TestSize.Level1)
82{
83  bool value = true;
84  Boolean bl(value);
85  bool result = bl.Unbox(bl.Parse("true"));
86  EXPECT_EQ(true, result);
87}
88
89/**
90 * @tc.number: BoolWrapperTest_Parse_002
91 * @tc.name: Parse
92 * @tc.desc:
93 */
94HWTEST_F(AAfWKBoolWrapperTest, BoolWrapperTest_Parse_002, TestSize.Level1)
95{
96  bool value = true;
97  Boolean bl(value);
98  bool result = bl.Unbox(bl.Parse("false"));
99  EXPECT_EQ(false, result);
100}
101}
102}