2 Unix SMB/CIFS implementation.
6 Copyright (C) Jelmer Vernooij 2005
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 #include "torture/torture.h"
26 static const char *test_lists_shell_strings
[] = {
36 static bool test_lists_shell(struct torture_context
*tctx
,
37 const void *test_data
)
39 const char *data
= test_data
;
40 const char **ret1
, **ret2
, *tmp
;
42 TALLOC_CTX
*mem_ctx
= tctx
;
44 ret1
= str_list_make_shell(mem_ctx
, data
, " ");
45 tmp
= str_list_join_shell(mem_ctx
, ret1
, ' ');
46 ret2
= str_list_make_shell(mem_ctx
, tmp
, " ");
48 if ((ret1
== NULL
|| ret2
== NULL
) && ret2
!= ret1
) {
52 for (j
= 0; ret1
[j
] && ret2
[j
]; j
++) {
53 if (strcmp(ret1
[j
], ret2
[j
]) != 0) {
59 if (ret1
[j
] || ret2
[j
])
63 torture_assert(tctx
, match
, talloc_asprintf(tctx
,
64 "str_list_{make,join}_shell: Error double parsing, first run:\n%s\nSecond run: \n%s", data
, tmp
));
68 struct torture_suite
*torture_local_util_strlist(TALLOC_CTX
*mem_ctx
)
70 struct torture_suite
*suite
= torture_suite_create(mem_ctx
, "STRLIST");
73 for (i
= 0; test_lists_shell_strings
[i
]; i
++) {
74 torture_suite_add_simple_tcase(suite
,
75 "lists_shell", test_lists_shell
,
76 &test_lists_shell_strings
[i
]);