From 757b3b259eba27881a8b5616ba45d42798c1ade8 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Mon, 17 Sep 2012 10:34:08 -0400 Subject: Add unit test for crypto_pk_cmp_keys and NULL --- src/test/test_crypto.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/test/test_crypto.c b/src/test/test_crypto.c index 7f4347a41c..fd983de002 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)); -- cgit v1.2.3-54-g00ecf