]> begriffs open source - libtap/blob - t/cmp_mem.c
Fixing a bug which prevents builds for Windows targets.
[libtap] / t / cmp_mem.c
1 #include "tap.h"
2
3 int main () {
4     unsigned char all_0[] = {0, 0, 0, 0};
5     unsigned char all_255[] = {255, 255, 255, 255};
6     unsigned char half[] = {0, 0, 255, 255};
7     unsigned char half_2[] = {0, 0, 255, 255};
8
9     plan(8);
10     cmp_mem(half, half_2, 4, "Same array different address");
11     cmp_mem(all_0, all_0, 4, "Array must be equal to itself");
12     cmp_mem(all_0, all_255, 4, "Arrays with different contents");
13     cmp_mem(all_0, half, 4, "Arrays differ, but start the same");
14     cmp_mem(all_0, all_255, 0, "Comparing 0 bytes of different arrays");
15     cmp_mem(NULL, all_0, 4, "got == NULL");
16     cmp_mem(all_0, NULL, 4, "expected == NULL");
17     cmp_mem(NULL, NULL, 4, "got == expected == NULL");
18     done_testing();
19 }
20