aboutsummaryrefslogtreecommitdiff
path: root/libc/test/src/inttypes/imaxabs_test.cpp
blob: 7c9870495c35a4b6b263028c9c0f6fb4bc8b2b71 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
//===-- Unittests for imaxabs ---------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "src/inttypes/imaxabs.h"
#include "test/UnitTest/Test.h"

TEST(LlvmLibcImaxAbsTest, Zero) {
  EXPECT_EQ(__llvm_libc::imaxabs(0), intmax_t(0));
}

TEST(LlvmLibcImaxAbsTest, Positive) {
  EXPECT_EQ(__llvm_libc::imaxabs(1), intmax_t(1));
}

TEST(LlvmLibcImaxAbsTest, Negative) {
  EXPECT_EQ(__llvm_libc::imaxabs(-1), intmax_t(1));
}