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

RE: svn commit: r1505055 - /subversion/trunk/subversion/tests/libsvn_subr/string-test.c

From: Bert Huijben <bert_at_qqmail.nl>
Date: Sat, 20 Jul 2013 00:32:45 +0200

> -----Original Message-----
> From: stefan2_at_apache.org [mailto:stefan2_at_apache.org]
> Sent: zaterdag 20 juli 2013 00:29
> To: commits_at_subversion.apache.org
> Subject: svn commit: r1505055 -
> /subversion/trunk/subversion/tests/libsvn_subr/string-test.c
>
> Author: stefan2
> Date: Fri Jul 19 22:29:21 2013
> New Revision: 1505055
>
> URL: http://svn.apache.org/r1505055
> Log:
> Add a test case for base36 string conversion.
>
> * subversion/tests/libsvn_subr/string-test.c
> (sub_test_base36): new two-way conversion test
> (test_base36): test the conversion with a few different values
> (test_funcs): register the new test
>
> Modified:
> subversion/trunk/subversion/tests/libsvn_subr/string-test.c
>
> Modified: subversion/trunk/subversion/tests/libsvn_subr/string-test.c
> URL:
> http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_su
> br/string-test.c?rev=1505055&r1=1505054&r2=1505055&view=diff
> ==========================================================
> ====================
> --- subversion/trunk/subversion/tests/libsvn_subr/string-test.c (original)
> +++ subversion/trunk/subversion/tests/libsvn_subr/string-test.c Fri Jul 19
> 22:29:21 2013
> @@ -537,7 +537,42 @@ test24(apr_pool_t *pool)
> SVN_TEST_ASSERT(length == 20);
> SVN_TEST_STRING_ASSERT(buffer, "18446744073709551615");
>
> - return test_stringbuf_unequal("abc", "abb", pool);
> + return SVN_NO_ERROR;
> +}

It appears you accidentally removed the last line from the previous test?

(Problem resolving conflict?)

> +
> +static svn_error_t *
> +sub_test_base36(apr_uint64_t value, const char *base36)
> +{
> + char buffer[SVN_INT64_BUFFER_SIZE];
> + apr_size_t length;
> + apr_size_t expected_length = strlen(base36);
> + const char *end = buffer;
> + apr_uint64_t result;
> +
> + length = svn__ui64tobase36(buffer, value);
> + SVN_TEST_ASSERT(length == expected_length);
> + SVN_TEST_STRING_ASSERT(buffer, base36);
> +
> + result = svn__base36toui64(&end, buffer);
> + SVN_TEST_ASSERT(end - buffer == length);
> + SVN_TEST_ASSERT(result == value);
> +
> + result = svn__base36toui64(NULL, buffer);
> + SVN_TEST_ASSERT(result == value);
> +
> + return SVN_NO_ERROR;
> +}
> +
> +static svn_error_t *
> +test_base36(apr_pool_t *pool)
> +{
> + SVN_ERR(sub_test_base36(0, "0"));
> + SVN_ERR(sub_test_base36(1234567890ull, "kf12oi"));
> + SVN_ERR(sub_test_base36(0x7fffffffffffffffull, "1y2p0ij32e8e7"));
> + SVN_ERR(sub_test_base36(0x8000000000000000ull, "1y2p0ij32e8e8"));
> + SVN_ERR(sub_test_base36(0xffffffffffffffffull, "3w5e11264sgsf"));
> +
> + return SVN_NO_ERROR;
> }
>
> static svn_error_t *
> @@ -770,6 +805,8 @@ struct svn_test_descriptor_t test_funcs[
> "compare stringbufs; same length, different content"),
> SVN_TEST_PASS2(test24,
> "verify i64toa"),
> + SVN_TEST_PASS2(test_base36,
> + "verify base36 conversion"),

Usually we try to add new tests at the end of the list to avoid renumbering.
(or there must be good reasons to keep more of them together)

        Bert
Received on 2013-07-20 00:33:42 CEST

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.