commit 757b3b259eba27881a8b5616ba45d42798c1ade8 Author: Nick Mathewson nickm@torproject.org Date: Mon Sep 17 10:34:08 2012 -0400
Add unit test for crypto_pk_cmp_keys and NULL --- src/test/test_crypto.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/src/test/test_crypto.c b/src/test/test_crypto.c index 7f4347a..fd983de 100644 --- a/src/test/test_crypto.c +++ b/src/test/test_crypto.c @@ -427,6 +427,11 @@ test_crypto_pk(void) test_assert(! crypto_pk_read_public_key_from_string(pk2, encoded, size)); test_eq(0, crypto_pk_cmp_keys(pk1, pk2));
+ /* comparison between keys and NULL */ + tt_int_op(crypto_pk_cmp_keys(NULL, pk1), <, 0); + tt_int_op(crypto_pk_cmp_keys(NULL, NULL), ==, 0); + tt_int_op(crypto_pk_cmp_keys(pk1, NULL), >, 0); + test_eq(128, crypto_pk_keysize(pk1)); test_eq(1024, crypto_pk_num_bits(pk1)); test_eq(128, crypto_pk_keysize(pk2));