You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by iv...@apache.org on 2015/09/14 13:04:45 UTC
svn commit: r1702905 -
/subversion/trunk/subversion/tests/libsvn_subr/checksum-test.c
Author: ivan
Date: Mon Sep 14 11:04:44 2015
New Revision: 1702905
URL: http://svn.apache.org/r1702905
Log:
Add test for some non-obvious, but documented behavior of
svn_checksum_parse_hex() to return NULL for 'all zeroes checksum'.
* subversion/tests/libsvn_subr/checksum-test.c
(test_checksum_parse_all_zero): New test.
(test_funcs): Add test to test list.
Modified:
subversion/trunk/subversion/tests/libsvn_subr/checksum-test.c
Modified: subversion/trunk/subversion/tests/libsvn_subr/checksum-test.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_subr/checksum-test.c?rev=1702905&r1=1702904&r2=1702905&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_subr/checksum-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_subr/checksum-test.c Mon Sep 14 11:04:44 2015
@@ -274,6 +274,28 @@ test_serialization(apr_pool_t *pool)
return SVN_NO_ERROR;
}
+static svn_error_t *
+test_checksum_parse_all_zero(apr_pool_t *pool)
+{
+ svn_checksum_kind_t kind;
+ for (kind = svn_checksum_md5; kind <= svn_checksum_fnv1a_32x4; ++kind)
+ {
+ svn_checksum_t *checksum;
+ const char *hex;
+
+ checksum = svn_checksum_create(kind, pool);
+
+ hex = svn_checksum_to_cstring_display(checksum, pool);
+ SVN_ERR(svn_checksum_parse_hex(&checksum, kind, hex, pool));
+
+ /* All zeroes checksum is NULL by definition. See
+ svn_checksum_parse_hex().*/
+ SVN_TEST_ASSERT(checksum == NULL);
+ }
+
+ return SVN_NO_ERROR;
+}
+
/* An array of all test functions */
static int max_threads = 1;
@@ -293,6 +315,8 @@ static struct svn_test_descriptor_t test
"zero checksum cross-type matching"),
SVN_TEST_PASS2(test_serialization,
"checksum (de-)serialization"),
+ SVN_TEST_PASS2(test_checksum_parse_all_zero,
+ "checksum parse all zero"),
SVN_TEST_NULL
};