1 //===-- Unittests for strtoimax -------------------------------------------===// 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/strtoimax.h" 10 11 #include "utils/UnitTest/Test.h" 12 13 #include <errno.h> 14 #include <limits.h> 15 #include <stddef.h> 16 17 // strtoimax is equivalent to strtoll on all currently supported configurations. 18 // Thus to avoid duplicating code there is just one test to make sure that 19 // strtoimax works at all. For real tests see stdlib/strtoll_test.cpp. 20 TEST(LlvmLibcStrToIMaxTest,SimpleCheck)21TEST(LlvmLibcStrToIMaxTest, SimpleCheck) { 22 const char *ten = "10"; 23 errno = 0; 24 ASSERT_EQ(__llvm_libc::strtoimax(ten, nullptr, 10), intmax_t(10)); 25 ASSERT_EQ(errno, 0); 26 } 27