blob: e7b933d22922d0f34659c822a02d6172451ba53c (
plain) (
tree)
|
|
#include <stdbool.h>
static void foreachfn(void * const _ptr) {
unsigned int * ptr = _ptr;
unsigned int val = *ptr;
val %= 0x2;
*ptr = val;
}
static bool zaptest_test_foreach(void) {
unsigned int arr[] = {
0x0u,
0x1u,
0x2u,
0x3u,
};
zap_foreach(arr,sizeof (arr[0x0u]),sizeof (arr) / sizeof (arr[0x0u]),foreachfn);
zaptest_chk(arr[0x0u],0x0u,unsigned int,"%X");
zaptest_chk(arr[0x1u],0x1u,unsigned int,"%X");
zaptest_chk(arr[0x2u],0x0u,unsigned int,"%X");
zaptest_chk(arr[0x3u],0x1u,unsigned int,"%X");
return false;
}
|