mirror of
https://github.com/opnsense/src.git
synced 2026-06-05 14:54:21 -04:00
Test case to check if an implementation of memset correctly handles the value passed being wider than a byte Approved by: emaste Reviewed By: fuz (GSoC mentor), emaste Sponsored by: Google LLC (GSoC 2024) Differential Revision: https://reviews.freebsd.org/D45738
29 lines
452 B
C
29 lines
452 B
C
/*-
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*
|
|
* Copyright (c) 2024 Strahinja Stanisic <strajabot@FreeBSD.org>
|
|
*/
|
|
|
|
#include <assert.h>
|
|
#include <string.h>
|
|
|
|
#include <atf-c.h>
|
|
|
|
ATF_TC_WITHOUT_HEAD(int_char_conv);
|
|
ATF_TC_BODY(int_char_conv, tc)
|
|
{
|
|
char b[64];
|
|
int c = 0xDEADBEEF;
|
|
memset(&b, c, 64);
|
|
for(int i = 0; i < 64; i++) {
|
|
assert(b[i] == (char)c);
|
|
}
|
|
|
|
}
|
|
|
|
ATF_TP_ADD_TCS(tp)
|
|
{
|
|
ATF_TP_ADD_TC(tp, int_char_conv);
|
|
return (atf_no_error());
|
|
}
|
|
|