1/**
2 * Copyright (c) 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 "functionalext.h"
17
18/**
19 * @tc.name      : remove_0100
20 * @tc.desc      : The parameter is valid and the file can be deleted.
21 * @tc.level     : Level 0
22 */
23void remove_0100(void)
24{
25    const char *ptr = "test.txt";
26    FILE *fptr = fopen(ptr, "w");
27    EXPECT_TRUE("remove_0100", fptr != NULL);
28    fclose(fptr);
29    int ret = remove(ptr);
30    EXPECT_EQ("remove_0100", ret, 0);
31    fptr = NULL;
32    ptr = NULL;
33}
34
35/**
36 * @tc.name      : remove_0200
37 * @tc.desc      : The parameter is invalid and the file cannot be deleted.
38 * @tc.level     : Level 2
39 */
40void remove_0200(void)
41{
42    const char *ptr = "test.txt";
43    int ret = remove(ptr);
44    EXPECT_EQ("remove_0200", ret, -1);
45    ptr = NULL;
46}
47
48int main(int argc, char *argv[])
49{
50    remove_0100();
51    remove_0200();
52    return t_status;
53}