summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2016-06-20 08:48:09 -0400
committerNick Mathewson <nickm@torproject.org>2016-06-20 08:48:09 -0400
commit6cedd4932352929496d8e017500362fafd367f18 (patch)
tree3f15189a3be369c561f3bdef0d7b7ede1dc6f273 /src/test
parent1160ac1283a076acc6c660827ebeb84a111f27cc (diff)
parent568dc27a1943305f6e11a9a497f56a6aabe27c99 (diff)
downloadtor-6cedd4932352929496d8e017500362fafd367f18.tar.gz
tor-6cedd4932352929496d8e017500362fafd367f18.zip
Merge branch 'bug14013_029_01_squashed'
Diffstat (limited to 'src/test')
-rw-r--r--src/test/test_crypto.c7
-rw-r--r--src/test/test_dir.c2
-rw-r--r--src/test/test_guardfraction.c2
-rw-r--r--src/test/test_microdesc.c3
-rw-r--r--src/test/test_ntor_cl.c2
-rw-r--r--src/test/test_util_format.c4
6 files changed, 11 insertions, 9 deletions
diff --git a/src/test/test_crypto.c b/src/test/test_crypto.c
index bf4b68efe2..ba2fb86246 100644
--- a/src/test/test_crypto.c
+++ b/src/test/test_crypto.c
@@ -1521,7 +1521,7 @@ test_crypto_formats(void *arg)
strlcpy(data1, "f0d678affc000100", 1024);
i = base16_decode(data2, 8, data1, 16);
- tt_int_op(i,OP_EQ, 0);
+ tt_int_op(i,OP_EQ, 8);
tt_mem_op(data2,OP_EQ, "\xf0\xd6\x78\xaf\xfc\x00\x01\x00",8);
/* now try some failing base16 decodes */
@@ -2537,8 +2537,9 @@ test_crypto_ed25519_testvectors(void *arg)
#define DECODE(p,s) base16_decode((char*)(p),sizeof(p),(s),strlen(s))
#define EQ(a,h) test_memeq_hex((const char*)(a), (h))
- tt_int_op(0, OP_EQ, DECODE(sk, ED25519_SECRET_KEYS[i]));
- tt_int_op(0, OP_EQ, DECODE(blinding_param, ED25519_BLINDING_PARAMS[i]));
+ tt_int_op(sizeof(sk), OP_EQ, DECODE(sk, ED25519_SECRET_KEYS[i]));
+ tt_int_op(sizeof(blinding_param), OP_EQ, DECODE(blinding_param,
+ ED25519_BLINDING_PARAMS[i]));
tt_int_op(0, OP_EQ, ed25519_secret_key_from_seed(&esk, sk));
EQ(esk.seckey, ED25519_EXPANDED_SECRET_KEYS[i]);
diff --git a/src/test/test_dir.c b/src/test/test_dir.c
index 74b753a1ea..b7d58bd577 100644
--- a/src/test/test_dir.c
+++ b/src/test/test_dir.c
@@ -580,7 +580,7 @@ test_dir_extrainfo_parsing(void *arg)
crypto_pk_t *pk = ri->identity_pkey = crypto_pk_new(); \
tt_assert(! crypto_pk_read_public_key_from_string(pk, \
name##_KEY, strlen(name##_KEY))); \
- tt_int_op(0,OP_EQ,base16_decode(d, 20, name##_FP, strlen(name##_FP))); \
+ tt_int_op(20,OP_EQ,base16_decode(d, 20, name##_FP, strlen(name##_FP))); \
digestmap_set((digestmap_t*)map, d, ri); \
ri = NULL; \
} while (0)
diff --git a/src/test/test_guardfraction.c b/src/test/test_guardfraction.c
index 300590a3d9..130aff11aa 100644
--- a/src/test/test_guardfraction.c
+++ b/src/test/test_guardfraction.c
@@ -40,7 +40,7 @@ gen_vote_routerstatus_for_tests(const char *digest_in_hex, int is_guard)
tt_int_op(strlen(digest_in_hex), ==, HEX_DIGEST_LEN);
retval = base16_decode(digest_tmp, sizeof(digest_tmp),
digest_in_hex, HEX_DIGEST_LEN);
- tt_int_op(retval, ==, 0);
+ tt_int_op(retval, ==, sizeof(digest_tmp));
memcpy(rs->identity_digest, digest_tmp, DIGEST_LEN);
}
diff --git a/src/test/test_microdesc.c b/src/test/test_microdesc.c
index be90f53196..2afbdde88a 100644
--- a/src/test/test_microdesc.c
+++ b/src/test/test_microdesc.c
@@ -783,7 +783,8 @@ test_md_reject_cache(void *arg)
mc = get_microdesc_cache();
#define ADD(hex) \
do { \
- tt_int_op(0,OP_EQ,base16_decode(buf,sizeof(buf),hex,strlen(hex))); \
+ tt_int_op(sizeof(buf),OP_EQ,base16_decode(buf,sizeof(buf), \
+ hex,strlen(hex)));\
smartlist_add(wanted, tor_memdup(buf, DIGEST256_LEN)); \
} while (0)
diff --git a/src/test/test_ntor_cl.c b/src/test/test_ntor_cl.c
index 49c9ad76d4..a560e5fc5e 100644
--- a/src/test/test_ntor_cl.c
+++ b/src/test/test_ntor_cl.c
@@ -21,7 +21,7 @@
} STMT_END
#define BASE16(idx, var, n) STMT_BEGIN { \
const char *s = argv[(idx)]; \
- if (base16_decode((char*)var, n, s, strlen(s)) < 0 ) { \
+ if (base16_decode((char*)var, n, s, strlen(s)) < (int)n ) { \
fprintf(stderr, "couldn't decode argument %d (%s)\n",idx,s); \
return 1; \
} \
diff --git a/src/test/test_util_format.c b/src/test/test_util_format.c
index c441037178..ad2ca317bd 100644
--- a/src/test/test_util_format.c
+++ b/src/test/test_util_format.c
@@ -270,7 +270,7 @@ test_util_format_base16_decode(void *ignored)
tt_int_op(res, OP_EQ, 0);
res = base16_decode(dst, 1000, "aabc", 4);
- tt_int_op(res, OP_EQ, 0);
+ tt_int_op(res, OP_EQ, 2);
tt_mem_op(dst, OP_EQ, "\xaa\xbc", 2);
res = base16_decode(dst, 1000, "aabcd", 6);
@@ -280,7 +280,7 @@ test_util_format_base16_decode(void *ignored)
tt_int_op(res, OP_EQ, -1);
res = base16_decode(real_dst, 10, real_src, 14);
- tt_int_op(res, OP_EQ, 0);
+ tt_int_op(res, OP_EQ, 7);
tt_mem_op(real_dst, OP_EQ, expected, 7);
done: