/** * Main test header file */ #include "seatest.h" #include "../src/blk256.h" #include "../src/blk128.h" #include /** * Compare two 256-bit blocks */ #define assert_blk256_eq(sx, sy) \ do { \ char test_format[1024]; \ int test_count = 3; \ if ((sx).mx != (sy).mx) { \ sprintf(test_format, "Expected %d, but was %d", (sx).mx, (sy).mx); \ assert_fail(test_format); \ } else { \ for (; test_count >= 0; test_count--) { \ if ((sx).x[test_count] != (sy).x[test_count]) { \ sprintf(test_format \ , "Expected x[%d]=%lu, but was %lu" \ , test_count \ , (sx).x[test_count] \ , (sy).x[test_count]); \ assert_fail(test_format); \ test_count = 3; \ break; \ } \ } \ } \ if (test_count == -1) assert_true(1); /* Make the test count */ \ } while(0) #define assert_blk128_eq(sx, sy) \ do { \ char test_format[1024]; \ if ((sx).hi != (sy).hi) { \ sprintf(test_format, "Expected hi=%lu, but got %lu", (sx).hi, (sy).hi); \ assert_fail(test_format); \ } else if ((sx).lo != (sy).lo) { \ sprintf(test_format, "Expected lo=%lu, but got %lu", (sx).lo, (sy).lo); \ assert_fail(test_format); \ } else { \ assert_true(1); \ } \ } while(0) #define blk256_print(name, t) \ do { \ printf("%s: {%d, [%lu, %lu, %lu, %lu]}\n", name, (t).mx, (t).x[3], (t).x[2], (t).x[1], (t).x[0]);\ } while(0) #define blk128_print(name, t) \ do { \ printf("%s: [%lu, %lu]\n", name, (t).hi, (t).lo);\ } while(0)