]> begriffs open source - libtap/blob - t/cmp_mem.c
Add cmp_mem test
[libtap] / t / cmp_mem.c
1 #include "tap.h"
2
3 int main () {
4     setvbuf(stdout, NULL, _IONBF, 0);
5     unsigned char all_0[] = { 0, 0, 0, 0 };
6     unsigned char all_255[] = { 255, 255, 255, 255 };
7     unsigned char half[] = { 0, 0, 255, 255 };
8
9     plan(4);
10     cmp_mem(all_0, all_0, 4, "Array must be equal to itself");
11     cmp_mem(all_0, all_255, 4, "Arrays with different contents");
12     cmp_mem(all_0, half, 4, "Arrays differ, but start the same");
13     cmp_mem(all_0, all_255, 0, "Comparing 0 bytes of different arrays");
14     done_testing();
15 }
16