summaryrefslogtreecommitdiff
path: root/libc/test/src/__support/str_to_integer_test.cpp
AgeCommit message (Collapse)Author
2025-10-31[libc] Templatize strtointeger implementation. (#165884)Alexey Samsonov
* Removes the copy-pasta implementation of wcstointeger, and migrate the wcsto* family of functions to use a template version of strtointeger. * Fixes the out-of-bound read in the original implementation(s) when the entire input string consists of whitespaces (then the sign check can access OOB memory) The code is currently slightly peppered with "if constexpr" statements to distinguish between char and wchar_t. We can probably simplify it in subsequent changes by: * using overrides, so that internal::isalnum() is overriden for both char and wchar_t (since C++ luckily allows us to reuse names). * this wouldn't help for direct comparison with literals - for this as a somewhat ugly workaround like is_char_literal(c, '0', L'0')
2025-09-11[libc] Clean up errno header usage in some more tests. (#157974)Alexey Samsonov
Either remove spurious libc_errno.h which are no longer needed, or migrate some tests to ErrnoCheckingTest to remove manual errno manipulation.
2025-06-11[libc] Move libc_errno.h to libc/src/__support and make ↵lntue
LIBC_ERRNO_MODE_SYSTEM to be header-only. (#143187) This is the first step in preparation for: https://discourse.llvm.org/t/rfc-make-clang-builtin-math-functions-constexpr-with-llvm-libc-to-support-c-23-constexpr-math-functions/86450
2025-06-11[libc] Reduce direct use of errno in src/stdlib and src/__support tests. ↵Alexey Samsonov
(#143767) * Get rid of libc_errno assignments in str_to_* __support tests, since those API have been migrated to return error in a struct instead. * Migrate tests for atof and to strto* functions from <stdlib.h> and for strdup from <string.h> to use ErrnoCheckingTest harness.
2024-03-06[libc] Add max length argument to decimal to float (#84091)Michael Jones
The implementation for from_chars in libcxx is possibly going to use our decimal to float utilities, but to do that we need to support limiting the length of the string to be parsed. This patch adds support for that length limiting to decimal_exp_to_float, as well as the functions it calls (high precision decimal, str to integer).