Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
move isU8Eq from lib/cgo/tests/testutils/libsky_assert.c to lib/cgo/tests/testutils/common.c
ref skycoin#34
  • Loading branch information
Alvaro Denis committed May 14, 2019
1 parent 47f8d0f commit af6585c
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 13 deletions.
16 changes: 16 additions & 0 deletions lib/cgo/tests/testutils/common.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include "common.h"

#include <stddef.h>

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

return 1;
}
6 changes: 6 additions & 0 deletions lib/cgo/tests/testutils/common.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#ifndef TEST_UTIL_COMMON
#define TEST_UTIL_COMMON

int isU8Eq(unsigned char p1[], unsigned char p2[], int len);

#endif // TEST_UTIL_COMMON
13 changes: 0 additions & 13 deletions lib/cgo/tests/testutils/libsky_assert.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,19 +66,6 @@ int isSigEq(cipher__Sig *sig1, cipher__Sig *sig2)
return memcmp((void *)sig1, (void *)sig2, sizeof(cipher__Sig)) == 0;
}

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

return 1;
}

int isSHA256Eq(cipher__SHA256 *sh1, cipher__SHA256 *sh2)
{
return (memcmp((void *)sh1, (void *)sh1, sizeof(cipher__SHA256)) == 0);
Expand Down

0 comments on commit af6585c

Please sign in to comment.