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 <gtest/gtest.h>
16 #include <thread>
17
18 #include "ndef_wifi_data_parser.h"
19
20 namespace OHOS {
21 namespace NFC {
22 namespace TAG {
23 namespace TEST {
24 using namespace testing::ext;
25 using namespace OHOS::NFC;
26 class NdefWifiDataParserTest : public testing::Test {
27 public:
28 static void SetUpTestCase();
29 static void TearDownTestCase();
30 void SetUp();
31 void TearDown();
32 };
33
SetUpTestCase()34 void NdefWifiDataParserTest::SetUpTestCase()
35 {
36 std::cout << " SetUpTestCase NdefWifiDataParserTest." << std::endl;
37 }
38
TearDownTestCase()39 void NdefWifiDataParserTest::TearDownTestCase()
40 {
41 std::cout << " TearDownTestCase NdefWifiDataParserTest." << std::endl;
42 }
43
SetUp()44 void NdefWifiDataParserTest::SetUp()
45 {
46 std::cout << " SetUp NdefWifiDataParserTest." << std::endl;
47 }
48
TearDown()49 void NdefWifiDataParserTest::TearDown()
50 {
51 std::cout << " TearDown NdefWifiDataParserTest." << std::endl;
52 }
53
54 /**
55 * @tc.name: CheckWifiRecord001
56 * @tc.desc: Test NdefWifiDataParserTest CheckWifiRecord.
57 * @tc.type: FUNC
58 */
59 HWTEST_F(NdefWifiDataParserTest, CheckWifiRecord001, TestSize.Level1)
60 {
61 std::string msg = "";
62 std::shared_ptr<WifiData> wifiData = NdefWifiDataParser::CheckWifiRecord(msg);
63 ASSERT_TRUE(wifiData != nullptr);
64 }
65
66 /**
67 * @tc.name: CheckWifiRecord002
68 * @tc.desc: Test NdefWifiDataParserTest CheckWifiRecord.
69 * @tc.type: FUNC
70 */
71 HWTEST_F(NdefWifiDataParserTest, CheckWifiRecord002, TestSize.Level1)
72 {
73 std::string msg = "CheckWifiRecord";
74 std::shared_ptr<WifiData> wifiData = NdefWifiDataParser::CheckWifiRecord(msg);
75 ASSERT_TRUE(wifiData != nullptr);
76 }
77
78 /**
79 * @tc.name: CheckWifiRecord003
80 * @tc.desc: Test NdefWifiDataParserTest CheckWifiRecord.
81 * @tc.type: FUNC
82 */
83 HWTEST_F(NdefWifiDataParserTest, CheckWifiRecord003, TestSize.Level1)
84 {
85 std::string msg = "DA1736016170706C69636174696F6E2F766E642E7766612E77736331100E0032"
86 "10260001011045000741646143393239100300020020100F0002000110270008"
87 "383838383838383810200006FFFFFFFFFFFF";
88 std::shared_ptr<WifiData> wifiData = NdefWifiDataParser::CheckWifiRecord(msg);
89 ASSERT_TRUE(wifiData != nullptr);
90 }
91 } // namespace TEST
92 } // namespace TAG
93 } // namespace NFC
94 } // namespace OHOS