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