/
GitCaptain
/
llvm-project
Обзор
Документация
Войти
/
GitCaptain
/
llvm-project
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
fix-tests
libc/test/src/string/mempcpy_test.cpp
28 строк
1 KB
Michael Jones
[libc] add memccpy and mempcpy
15 окт 2021, 02:38
15 окт 2021, 02:38
db8a88f
Код
Авторство
О чём код?
//===-- Unittests for mempcpy ---------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #include "src/string/mempcpy.h" #include "utils/UnitTest/Test.h" // Since this function just calls out to memcpy, and memcpy has its own unit // tests, it is assumed that memcpy works. These tests are just for the specific // mempcpy behavior (returning the end of what was copied). TEST(LlvmLibcMempcpyTest, Simple) { const char *src = "12345"; char dest[10]; void *result = __llvm_libc::mempcpy(dest, src, 6); ASSERT_EQ(static_cast<char *>(result), dest + 6); ASSERT_STREQ(src, dest); } TEST(LlvmLibcMempcpyTest, ZeroCount) { const char *src = "12345"; char dest[10]; void *result = __llvm_libc::mempcpy(dest, src, 0); ASSERT_EQ(static_cast<char *>(result), dest); }