2 * revision-test.c -- test the revision functions
4 * ====================================================================
5 * Copyright (c) 2007 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/.
16 * ====================================================================
19 #include "svn_types.h"
21 #include "../svn_test.h"
24 test_revnum_parse(const char **msg
,
25 svn_boolean_t msg_only
,
26 svn_test_opts_t
*opts
,
31 const char *failure_tests
[] = {
38 const char *success_tests
[] = {
45 *msg
= "test svn_revnum_parse";
47 /* These tests should succeed. */
48 for (t
=success_tests
; *t
; ++t
)
50 svn_revnum_t rev
= -123;
53 /* Do one test with a NULL end pointer and then with non-NULL
55 SVN_ERR(svn_revnum_parse(&rev
, *t
, NULL
));
56 SVN_ERR(svn_revnum_parse(&rev
, *t
, &endptr
));
59 return svn_error_createf
62 "svn_revnum_parse('%s') should change the revision for "
67 return svn_error_createf
70 "End pointer for svn_revnum_parse('%s') should not "
71 "point to the start of the string",
75 /* These tests should fail. */
76 for (t
=failure_tests
; *t
; ++t
)
78 svn_revnum_t rev
= -123;
81 /* Do one test with a NULL end pointer and then with non-NULL
83 svn_error_t
*err
= svn_revnum_parse(&rev
, *t
, NULL
);
86 err
= svn_revnum_parse(&rev
, *t
, &endptr
);
88 return svn_error_createf
89 (SVN_ERR_TEST_FAILED
, NULL
,
90 "svn_revnum_parse('%s') succeeded when it should "
96 return svn_error_createf
99 "svn_revnum_parse('%s') should not change the revision "
104 return svn_error_createf
105 (SVN_ERR_TEST_FAILED
,
107 "End pointer for svn_revnum_parse('%s') does not "
108 "point to the start of the string",
116 /* The test table. */
118 struct svn_test_descriptor_t test_funcs
[] =
121 SVN_TEST_PASS(test_revnum_parse
),