• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2 * Copyright (c) 2024 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 #include "utils/constant.h"
16 
17 #include <gtest/gtest.h>
18 
19 using namespace testing::ext;
20 using namespace OHOS::DistributedData;
21 
22 class ConstantTest : public testing::Test {
23 };
24 
25 /**
26 * @tc.name: EqualTest
27 * @tc.desc: Equal.
28 * @tc.type: FUNC
29 * @tc.require:
30 * @tc.author: MengYao
31 */
32 HWTEST_F(ConstantTest, EqualTest, TestSize.Level1)
33 {
34     bool result = Constant::Equal(true, true);
35     ASSERT_TRUE(result);
36 
37     result = Constant::Equal(true, false);
38     ASSERT_FALSE(result);
39 
40     result = OHOS::DistributedData::Constant::Equal(false, false);
41     ASSERT_TRUE(result);
42 }
43 
44 /**
45 * @tc.name: NotEqualTest
46 * @tc.desc: NotEqual.
47 * @tc.type: FUNC
48 * @tc.require:
49 * @tc.author: MengYao
50 */
51 HWTEST_F(ConstantTest, NotEqualTest, TestSize.Level1)
52 {
53     bool result = Constant::NotEqual(true, true);
54     ASSERT_FALSE(result);
55 
56     result = Constant::NotEqual(true, false);
57     ASSERT_TRUE(result);
58 
59     result = Constant::NotEqual(false, false);
60     ASSERT_FALSE(result);
61 }
62