• 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 
16 #include "gtest/gtest.h"
17 #define private public
18 #define protected public
19 #include "string_utils.h"
20 
21 namespace OHOS {
22 namespace Telephony {
23 using namespace testing::ext;
24 
25 class SmsUtilsTest : public testing::Test {
26 public:
SetUpTestCase()27     static void SetUpTestCase()
28     {}
TearDownTestCase()29     static void TearDownTestCase()
30     {}
SetUp()31     void SetUp()
32     {}
TearDown()33     void TearDown()
34     {}
35 };
36 
37 /**
38  * @tc.number   Telephony_SmsUtilsTest_SmsUtilsTest_001
39  * @tc.name     SmsUtilsTest_001
40  * @tc.desc     Function test
41  */
42 HWTEST_F(SmsUtilsTest, SmsUtilsTest_001, Function | MediumTest | Level1)
43 {
44     std::string str = "Abcd0";
45     auto vect = StringUtils::HexToByteVector(str);
46     EXPECT_NE(vect.size(), 0);
47 }
48 
49 /**
50  * @tc.number   Telephony_SmsUtilsTest_SmsUtilsTest_002
51  * @tc.name     SmsUtilsTest_002
52  * @tc.desc     Function test
53  */
54 HWTEST_F(SmsUtilsTest, SmsUtilsTest_002, Function | MediumTest | Level1)
55 {
56     std::string str = "";
57     EXPECT_TRUE(StringUtils::IsEmpty(str));
58     str = "abc";
59     EXPECT_FALSE(StringUtils::IsEmpty(str));
60 }
61 }
62 }