1 /* key-test.c --- tests for the key gen functions
3 * ====================================================================
4 * Copyright (c) 2000-2006 CollabNet. All rights reserved.
6 * This software is licensed as described in the file COPYING, which
7 * you should have received as part of this distribution. The terms
8 * are also available at http://subversion.tigris.org/license-1.html.
9 * If newer versions of this license are posted there, you may use a
10 * newer version instead, at your option.
12 * This software consists of voluntary contributions made by many
13 * individuals. For exact contribution history, see the revision
14 * history and logs, available at http://subversion.tigris.org/.
15 * ====================================================================
25 #include "svn_error.h"
27 #include "../svn_test.h"
28 #include "../../libsvn_fs_base/key-gen.h"
33 key_test(const char **msg
,
34 svn_boolean_t msg_only
,
35 svn_test_opts_t
*opts
,
39 const char *keys
[9][2] = {
42 { "zzzzz", "100000" },
43 { "z000000zzzzzz", "z000001000000" },
44 { "97hnq33jx2a", "97hnq33jx2b" },
45 { "97hnq33jx2z", "97hnq33jx30" },
51 *msg
= "testing sequential alphanumeric key generation";
56 for (i
= 0; i
< 9; i
++)
58 char gen_key
[MAX_KEY_SIZE
];
59 const char *orig_key
= keys
[i
][0];
60 const char *next_key
= keys
[i
][1];
63 len
= strlen(orig_key
);
66 svn_fs_base__next_key(orig_key
, &len
, gen_key
);
67 if (! (((len
== olen
) || (len
== (olen
+ 1)))
68 && (strlen(next_key
) == len
)
69 && (strcmp(next_key
, gen_key
) == 0)))
71 return svn_error_createf
72 (SVN_ERR_FS_GENERAL
, NULL
,
73 "failed to increment key \"%s\" correctly\n"
76 orig_key
, next_key
, gen_key
);
86 struct svn_test_descriptor_t test_funcs
[] =
89 SVN_TEST_PASS(key_test
),