xref: /llvm-project/libc/test/src/inttypes/imaxabs_test.cpp (revision b6bc9d72f65a5086f310f321e969d96e9a559e75)
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 
TEST(LlvmLibcImaxAbsTest,Zero)12 TEST(LlvmLibcImaxAbsTest, Zero) {
13   EXPECT_EQ(LIBC_NAMESPACE::imaxabs(0), intmax_t(0));
14 }
15 
TEST(LlvmLibcImaxAbsTest,Positive)16 TEST(LlvmLibcImaxAbsTest, Positive) {
17   EXPECT_EQ(LIBC_NAMESPACE::imaxabs(1), intmax_t(1));
18 }
19 
TEST(LlvmLibcImaxAbsTest,Negative)20 TEST(LlvmLibcImaxAbsTest, Negative) {
21   EXPECT_EQ(LIBC_NAMESPACE::imaxabs(-1), intmax_t(1));
22 }
23