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 <stdlib.h>
17#include "functionalext.h"
18
19/**
20 * @tc.name      : abs_0100
21 * @tc.desc      : Verify that the absolute value of the returned parameter is 0 (parameter is 0).
22 * @tc.level     : Level 0
23 */
24void abs_0100(void)
25{
26    int result = abs(0);
27    EXPECT_EQ("abs_0100", result, 0);
28}
29
30/**
31 * @tc.name      : abs_0200
32 * @tc.desc      : Verify that the absolute value of the returned parameter is a positive number (parameter is 10).
33 * @tc.level     : Level 0
34 */
35void abs_0200(void)
36{
37    int result = abs(10);
38    EXPECT_EQ("abs_0200", result, 10);
39}
40
41/**
42 * @tc.name      : abs_0300
43 * @tc.desc      : Verify that the absolute value of the returned parameter is a positive number (parameter is -10).
44 * @tc.level     : Level 0
45 */
46void abs_0300(void)
47{
48    int result = abs(-10);
49    EXPECT_EQ("abs_0300", result, 10);
50}
51
52int main(int argc, char *argv[])
53{
54    abs_0100();
55    abs_0200();
56    abs_0300();
57    return t_status;
58}