Get reloading working and fix corner exrapolation.
[sparrow.git] / test.c
blob790930858a1b060c280ecccc036c807171cfec56
1 #include "sparrow.h"
2 #include <string.h>
3 #include <math.h>
4 //#include "gstsparrow.h"
8 static void
9 test_popcount64()
11 guint64 tests[] = {0xf0f0f0f0f0f0f0f0, 0x0001111116000000,
12 0x123456789abcdef0, 0x0fedcba987654321,
13 0x0100, 0x77, 1, 2, 3};
14 guint i;
15 for (i = 0; i < (sizeof(tests) / sizeof(guint64)); i++){
16 guint32 r = popcount64(tests[i]);
17 printf("%016llx -> %u\n", tests[i], r);
21 static void
22 test_hamming_distance64()
24 guint64 tests[] = {0xf0f0f0f0f0f0f0f0, 0xf0f0f0f0f0f0f0f0, 0xffffffffffffffff,
25 0xf0f0f0f0f0f0f0f0, 0xffffffffffffffff, 0xffffffffffffffff,
26 0x0000000000000000, 0x0000000000000010, 0xffffffffffffffff,
27 0x1000000000000010, 0x0100000000000010, 0xffffffffffffffff,
28 0x1000000000000010, 0x0100000000000010, 0xffffffff00000000
30 guint i;
31 for (i = 0; i < (sizeof(tests) / sizeof(guint64)); i += 3){
32 guint32 r = hamming_distance64(tests[i], tests[i + 1], tests[i + 2]);
33 printf("%016llx, %016llx, mask %016llx -> %u\n", tests[i], tests[i + 1], tests[i + 2], r);
38 int main()
40 test_popcount64();
41 test_hamming_distance64();