Compare two test-vectors @param is The data as it is @param is_len The length of is @param should The data as it should @param should_len The length of should @param what The type of the data @param which The iteration count @return 0 on equality, -1 or 1 on difference */
| 61 | @return 0 on equality, -1 or 1 on difference |
| 62 | */ |
| 63 | int compare_testvector(const void* is, const unsigned long is_len, const void* should, const unsigned long should_len, const char* what, int which) |
| 64 | { |
| 65 | int res = 0; |
| 66 | if(is_len != should_len) |
| 67 | res = is_len > should_len ? -1 : 1; |
| 68 | else |
| 69 | res = XMEMCMP(is, should, is_len); |
| 70 | |
| 71 | #if defined(LTC_TEST) && defined(LTC_TEST_DBG) |
| 72 | if (res != 0) { |
| 73 | fprintf(stderr, "Testvector #%i of %s failed:\n", which, what); |
| 74 | _print_hex("SHOULD", should, should_len); |
| 75 | _print_hex("IS ", is, is_len); |
| 76 | } |
| 77 | #else |
| 78 | LTC_UNUSED_PARAM(which); |
| 79 | LTC_UNUSED_PARAM(what); |
| 80 | #endif |
| 81 | |
| 82 | return res; |
| 83 | } |
| 84 | |
| 85 | /* ref: $Format:%D$ */ |
| 86 | /* git commit: $Format:%H$ */ |
no test coverage detected