summaryrefslogtreecommitdiff
path: root/test/source/test/memfor.i
blob: 0d6768e1df0b07be9ff28a7e124e6b26adb5f8de (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <stdbool.h>

static void memforfn(void * const _ptr) {
	unsigned int * ptr = _ptr;
	unsigned int   val = *ptr;
	val %= 0x2;
	*ptr = val;
}

static bool zaptest_test_memfor(void) {
	unsigned int arr[] = {
		0x0u,
		0x1u,
		0x2u,
		0x3u,
	};
	zap_memfor(arr,sizeof (arr[0x0u]),sizeof (arr) / sizeof (arr[0x0u]),memforfn);
	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;
}