Skip to content

Commit

Permalink
[test-libc] refs skycoin#95 Rewrite isU8Eq to avoid random errors i…
Browse files Browse the repository at this point in the history
…n the tests
  • Loading branch information
Maykel Arias Torres committed Jul 9, 2019
1 parent d584eef commit 2fa0873
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions lib/cgo/tests/testutils/libsky_assert.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,14 @@ GoInt_ isSigEq(cipher__Sig *sig1, cipher__Sig *sig2) {
return memcmp((void *)sig1, (void *)sig2, sizeof(cipher__Sig)) == 0;
}

GoInt_ isU8Eq(unsigned char p1[], unsigned char p2[], size_t len) {

if (strncmp(p1, p2, len) == 0) {

GoInt_ isU8Eq(unsigned char p1[], unsigned char p2[], size_t len)
{
for (GoInt i = 0; i < len; i++) {
if (p1[i] != p2[i]) {
return 0;
}
}
return 1;
}
return 0;
}

GoInt_ isSHA256Eq(cipher__SHA256 *sh1, cipher__SHA256 *sh2) {
Expand Down

0 comments on commit 2fa0873

Please sign in to comment.