Make test more lenient for custom clang version strings
[llvm-project.git] / libc / test / src / string / memset_explicit_test.cpp
blob4842f45791c4424ec55325ac4074d98639597bd8
1 //===-- Unittests for memset_explicit -------------------------------------===//
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 //===----------------------------------------------------------------------===//
9 #include "memory_utils/memory_check_utils.h"
10 #include "src/__support/macros/config.h"
11 #include "src/string/memset_explicit.h"
12 #include "test/UnitTest/Test.h"
14 namespace LIBC_NAMESPACE_DECL {
16 // Apply the same tests as memset
18 static inline void Adaptor(cpp::span<char> p1, uint8_t value, size_t size) {
19 LIBC_NAMESPACE::memset_explicit(p1.begin(), value, size);
22 TEST(LlvmLibcmemsetExplicitTest, SizeSweep) {
23 static constexpr size_t kMaxSize = 400;
24 Buffer DstBuffer(kMaxSize);
25 for (size_t size = 0; size < kMaxSize; ++size) {
26 const char value = size % 10;
27 auto dst = DstBuffer.span().subspan(0, size);
28 ASSERT_TRUE((CheckMemset<Adaptor>(dst, value, size)));
32 } // namespace LIBC_NAMESPACE_DECL