[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: Shivani Poddar <shivani.poddar92_at_gmail.com>
Date: Tue, 19 Mar 2013 22:03:08 +0530

On Tue, Mar 19, 2013 at 7:05 PM, Philip Martin
<philip.martin_at_wandisco.com>wrote:

> 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.
>

Unless I don't assign the kind and digest some value for the object I
declare here , calling svn_checksum_clear() on it will give me a
segmentation fault , could you please elaborate more as to why should I
have to call svn_checksum_clear() before assigning the digest any value??

>
> For the '568554e2bf0fc50aa347777731081a80' I assume you could call
> svn_checksum and pass in the data that gives that checksum.
>
>
Yes, that sure looks like a better approach now.

> --
> Certified & Supported Apache Subversion Downloads:
> http://www.wandisco.com/subversion/download
>

-- 
Shivani Poddar,
Bachelors in Computer Sciences and MS in Exact Humanities, Sophomore
International Institute of Information Technology, Hyderabad
Received on 2013-03-19 17:33:40 CET

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