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 "detector.h" 17 #include <gtest/gtest.h> 18 19 using namespace testing::ext; 20 21 class DetectorFileTest : public testing::Test { 22 public: 23 static void SetUpTestCase(void); 24 static void TearDownTestCase(void); 25 void SetUp(); 26 void TearDown(); 27 }; 28 SetUpTestCase(void)29void DetectorFileTest::SetUpTestCase(void) 30 { 31 // step 2: input testsuit setup step 32 } 33 TearDownTestCase(void)34void DetectorFileTest::TearDownTestCase(void) 35 { 36 // step 2: input testsuit teardown step 37 } 38 SetUp(void)39void DetectorFileTest::SetUp(void) 40 { 41 // step 3: input testcase setup step 42 } 43 TearDown(void)44void DetectorFileTest::TearDown(void) 45 { 46 // step 3: input testcase teardown step 47 } 48 49 /** 50 * @tc.name: IsExistOfFile_001 51 * @tc.desc: Check whether the file exists. 52 * @tc.type: FUNC 53 * @tc.require: AR00000000 SR00000000 54 */ 55 HWTEST_F(DetectorFileTest, IsExistOfFile_001, TestSize.Level0) 56 { 57 // step 1: 58 const char* filepath1 = "/data/test/resource/txt/1.txt"; 59 EXPECT_TRUE(FileExist(filepath1)); 60 61 // step 2: 62 const char* filepath2 = "/data/test/resource/txt/3.txt"; 63 EXPECT_TRUE(FileExist(filepath2)); 64 } 65 66 /** 67 * @tc.name: IsExistOfFile_002 68 * @tc.desc: Check whether the file exists. 69 * @tc.type: FUNC 70 * @tc.require: AR00000000 SR00000000 71 */ 72 HWTEST_F(DetectorFileTest, IsExistOfFile_002, TestSize.Level1) 73 { 74 // step 1: 75 const char* filepath1 = "/data/test/resource/txt/2.txt"; 76 EXPECT_TRUE(FileExist(filepath1)); 77 78 // step 2: 79 const char* filepath2 = "/data/test/resource/txt/4.txt"; 80 EXPECT_TRUE(FileExist(filepath2)); 81 } 82