1 | //===-- Unittests for imaxabs ---------------------------------------------===// |
---|---|
2 | // |
3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
4 | // See https://llvm.org/LICENSE.txt for license information. |
5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
6 | // |
7 | //===----------------------------------------------------------------------===// |
8 | |
9 | #include "src/inttypes/imaxabs.h" |
10 | #include "test/UnitTest/Test.h" |
11 | |
12 | TEST(LlvmLibcImaxAbsTest, Zero) { |
13 | EXPECT_EQ(LIBC_NAMESPACE::imaxabs(0), intmax_t(0)); |
14 | } |
15 | |
16 | TEST(LlvmLibcImaxAbsTest, Positive) { |
17 | EXPECT_EQ(LIBC_NAMESPACE::imaxabs(1), intmax_t(1)); |
18 | } |
19 | |
20 | TEST(LlvmLibcImaxAbsTest, Negative) { |
21 | EXPECT_EQ(LIBC_NAMESPACE::imaxabs(-1), intmax_t(1)); |
22 | } |
23 |