2
2
* utf-test.c -- test the utf functions
4
4
* ====================================================================
5
* Copyright (c) 2004, 2009 CollabNet. All rights reserved.
7
* This software is licensed as described in the file COPYING, which
8
* you should have received as part of this distribution. The terms
9
* are also available at http://subversion.tigris.org/license-1.html.
10
* If newer versions of this license are posted there, you may use a
11
* newer version instead, at your option.
13
* This software consists of voluntary contributions made by many
14
* individuals. For exact contribution history, see the revision
15
* history and logs, available at http://subversion.tigris.org/.
5
* Licensed to the Apache Software Foundation (ASF) under one
6
* or more contributor license agreements. See the NOTICE file
7
* distributed with this work for additional information
8
* regarding copyright ownership. The ASF licenses this file
9
* to you under the Apache License, Version 2.0 (the
10
* "License"); you may not use this file except in compliance
11
* with the License. You may obtain a copy of the License at
13
* http://www.apache.org/licenses/LICENSE-2.0
15
* Unless required by applicable law or agreed to in writing,
16
* software distributed under the License is distributed on an
17
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18
* KIND, either express or implied. See the License for the
19
* specific language governing permissions and limitations
16
21
* ====================================================================
182
178
/* Compare the two different implementations using random data. */
183
179
static svn_error_t *
184
utf_validate2(const char **msg,
185
svn_boolean_t msg_only,
186
svn_test_opts_t *opts,
180
utf_validate2(apr_pool_t *pool)
191
*msg = apr_psprintf(pool,
192
"test last_valid/last_valid2 (seed:%u)", seed_val());
197
186
/* We want enough iterations so that most runs get both valid and invalid
198
187
strings. We also want enough iterations such that a deliberate error
228
217
/* Test conversion from different codepages to utf8. */
229
218
static svn_error_t *
230
test_utf_cstring_to_utf8_ex2(const char **msg,
231
svn_boolean_t msg_only,
232
svn_test_opts_t *opts,
219
test_utf_cstring_to_utf8_ex2(apr_pool_t *pool)
236
222
apr_pool_t *subpool = svn_pool_create(pool);
276
257
/* Test conversion to different codepages from utf8. */
277
258
static svn_error_t *
278
test_utf_cstring_from_utf8_ex2(const char **msg,
279
svn_boolean_t msg_only,
280
svn_test_opts_t *opts,
259
test_utf_cstring_from_utf8_ex2(apr_pool_t *pool)
284
262
apr_pool_t *subpool = svn_pool_create(pool);
327
300
struct svn_test_descriptor_t test_funcs[] =
330
SVN_TEST_PASS(utf_validate),
331
SVN_TEST_PASS(utf_validate2),
332
SVN_TEST_PASS(test_utf_cstring_to_utf8_ex2),
333
SVN_TEST_PASS(test_utf_cstring_from_utf8_ex2),
303
SVN_TEST_PASS2(utf_validate,
304
"test is_valid/last_valid"),
305
SVN_TEST_PASS2(utf_validate2,
306
"test last_valid/last_valid2"),
307
SVN_TEST_PASS2(test_utf_cstring_to_utf8_ex2,
308
"test svn_utf_cstring_to_utf8_ex2"),
309
SVN_TEST_PASS2(test_utf_cstring_from_utf8_ex2,
310
"test svn_utf_cstring_from_utf8_ex2"),