You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by br...@apache.org on 2012/11/07 00:11:07 UTC

svn commit: r1406393 - /subversion/branches/wc-collate-path/subversion/tests/libsvn_subr/utf-test.c

Author: brane
Date: Tue Nov  6 23:11:07 2012
New Revision: 1406393

URL: http://svn.apache.org/viewvc?rev=1406393&view=rev
Log:
On the wc-collate-path branch:

* subversion/tests/libsvn_subr/utf-test.c:
  (normalized_compare): Optionally test decomposition with known string size.
  (test_utf_decompose_normalized_ucs4cmp): Use that option.
   Rename 'lowercase' to 'lowcase' to shorten lines.

Modified:
    subversion/branches/wc-collate-path/subversion/tests/libsvn_subr/utf-test.c

Modified: subversion/branches/wc-collate-path/subversion/tests/libsvn_subr/utf-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/wc-collate-path/subversion/tests/libsvn_subr/utf-test.c?rev=1406393&r1=1406392&r2=1406393&view=diff
==============================================================================
--- subversion/branches/wc-collate-path/subversion/tests/libsvn_subr/utf-test.c (original)
+++ subversion/branches/wc-collate-path/subversion/tests/libsvn_subr/utf-test.c Tue Nov  6 23:11:07 2012
@@ -297,6 +297,7 @@ test_utf_cstring_from_utf8_ex2(apr_pool_
 /* Test normalization-independent UTF-8 string comparison */
 static svn_error_t *
 normalized_compare(const char *stra, int expected, const char *strb,
+                   svn_boolean_t implicit_size,
                    const char *stratag, const char *strbtag,
                    apr_int32_t *bufa, apr_size_t lena,
                    apr_int32_t *bufb, apr_size_t lenb)
@@ -304,8 +305,12 @@ normalized_compare(const char *stra, int
   apr_size_t rlena, rlenb;
   int result;
 
-  SVN_ERR(svn_utf__decompose_normalized(stra, 0, bufa, lena, &rlena));
-  SVN_ERR(svn_utf__decompose_normalized(strb, 0, bufb, lenb, &rlenb));
+  SVN_ERR(svn_utf__decompose_normalized(stra,
+                                        (implicit_size ? 0 : strlen(stra)),
+                                        bufa, lena, &rlena));
+  SVN_ERR(svn_utf__decompose_normalized(strb,
+                                        (implicit_size ? 0 : strlen(strb)),
+                                        bufb, lenb, &rlenb));
   result = svn_utf__ucs4cmp(bufa, rlena, bufb, rlenb);
 
   /* UCS-4 debugging dump of the decomposed strings
@@ -403,7 +408,7 @@ test_utf_decompose_normalized_ucs4cmp(ap
     "\xe1\xb8\xaf"              /* i with diaeresis and acute */
     "\xe1\xbb\x9d";             /* o with grave and hook */
 
-  static const char lowercase[] =
+  static const char lowcase[] =
     "s\xcc\x87\xcc\xa3"         /* s with dot above and below */
     "\xc5\xaf"                  /* u with ring */
     "b\xcc\xb1"                 /* b with macron below */
@@ -420,18 +425,18 @@ test_utf_decompose_normalized_ucs4cmp(ap
   apr_int32_t *bufb = apr_palloc(pool, buflen * sizeof(apr_int32_t));
 
 
-  SVN_ERR(normalized_compare(nfc, '=', nfd, "nfc", "nfd",
+  SVN_ERR(normalized_compare(nfc, '=', nfd, TRUE, "nfc", "nfd",
                              bufa, buflen, bufb, buflen));
-  SVN_ERR(normalized_compare(nfc, '=', mixup, "nfc", "mixup",
+  SVN_ERR(normalized_compare(nfc, '=', mixup, TRUE, "nfc", "mixup",
                              bufa, buflen, bufb, buflen));
-  SVN_ERR(normalized_compare(mixup, '=', nfd, "mixup", "nfd",
+  SVN_ERR(normalized_compare(mixup, '=', nfd, FALSE, "mixup", "nfd",
                              bufa, buflen, bufb, buflen));
 
-  SVN_ERR(normalized_compare(nfc, '<', longer, "nfc", "longer",
+  SVN_ERR(normalized_compare(nfc, '<', longer, FALSE, "nfc", "longer",
                              bufa, buflen, bufb, buflen));
-  SVN_ERR(normalized_compare(nfd, '>', shorter, "nfd", "shorter",
+  SVN_ERR(normalized_compare(nfd, '>', shorter, TRUE, "nfd", "shorter",
                              bufa, buflen, bufb, buflen));
-  SVN_ERR(normalized_compare(mixup, '<', lowercase, "mixup", "lowercase",
+  SVN_ERR(normalized_compare(mixup, '<', lowcase, FALSE, "mixup", "lowcase",
                              bufa, buflen, bufb, buflen));
 
   return SVN_NO_ERROR;