[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] Adding tests for some function in svn_checksum.h in SWIG bindings for python

From: Philip Martin <philip.martin_at_wandisco.com>
Date: Tue, 19 Mar 2013 13:35:23 +0000

Shivani Poddar <shivani.poddar92_at_gmail.com> writes:

> On Tue, Mar 19, 2013 at 5:58 PM, Philip Martin
> <philip.martin_at_wandisco.com>wrote:
>
>> Shivani Poddar <shivani.poddar92_at_gmail.com> writes:
>>
>> > Index: subversion/bindings/swig/python/tests/checksum.py
>> > ===================================================================
>> > --- subversion/bindings/swig/python/tests/checksum.py (revision 1448005)
>> > +++ subversion/bindings/swig/python/tests/checksum.py (working copy)
>> > @@ -28,14 +28,50 @@
>> > kind, expected_length = svn.core.svn_checksum_md5, 128/8
>> > val = svn.core.svn_checksum_create(kind)
>> > check_val = svn.core.svn_checksum_to_cstring_display(val)
>> > -
>> > + rand_checksum = svn.core.svn_checksum_t()
>> > + rand_checksum.digest = 'd41d8cd98f00b204e9800998ecf8427e'
>> > + rand_checksum2 = svn.core.svn_checksum_t()
>> > + rand_checksum2.digest = '568554e2bf0fc50aa347777731081a80'
>>
>> That looks odd. svn_checksum_t.digest is binary and you are setting it
>> to the string representation of the binary not the binary data itself.
>> What are you trying to do?
>>
>
> I basically tried to assign some random md5 checksum values to
> rand_checksum.digest and similarly for rand_checksum2.digest. This was to
> facilitate the tests which follow wherein I am trying to check for all the
> cases of equal and unequal (zero and non zero) checksums with
> svn_checksum_match() function.

'd41d8cd98f00b204e9800998ecf8427e' is the MD5 of the empty string and
Subversion has special handling of that checksum.

Instead of setting the digest directly you could call svn_checksum_clear
and then svn_checksum_to_cstring_display to check that you get the
digest you expect.

For the '568554e2bf0fc50aa347777731081a80' I assume you could call
svn_checksum and pass in the data that gives that checksum.

-- 
Certified & Supported Apache Subversion Downloads:
http://www.wandisco.com/subversion/download
Received on 2013-03-19 14:36:11 CET

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.