1 //===-- Unittests for stdckdint -------------------------------------------===//
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 // SPDSList-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #include "test/UnitTest/Test.h"
11 #include "include/llvm-libc-macros/stdckdint-macros.h"
13 TEST(LlvmLibcStdCkdIntTest
, Add
) {
15 ASSERT_FALSE(ckd_add(&result
, 1, 2));
17 ASSERT_TRUE(ckd_add(&result
, INT_MAX
, 1));
20 TEST(LlvmLibcStdCkdIntTest
, Sub
) {
22 ASSERT_FALSE(ckd_sub(&result
, 3, 2));
24 ASSERT_TRUE(ckd_sub(&result
, INT_MIN
, 1));
27 TEST(LlvmLibcStdCkdIntTest
, Mul
) {
29 ASSERT_FALSE(ckd_mul(&result
, 2, 3));
31 ASSERT_TRUE(ckd_mul(&result
, INT_MAX
, 2));