Apache HTTPD
testpath.c
Go to the documentation of this file.
1/* Licensed to the Apache Software Foundation (ASF) under one or more
2 * contributor license agreements. See the NOTICE file distributed with
3 * this work for additional information regarding copyright ownership.
4 * The ASF licenses this file to You under the Apache License, Version 2.0
5 * (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include "testutil.h"
18#include "apr_file_info.h"
19#include "apr_errno.h"
20#include "apr_pools.h"
21#include "apr_tables.h"
22
23#if defined(WIN32) || defined(NETWARE) || defined(OS2)
24#define PSEP ";"
25#define DSEP "\\"
26#else
27#define PSEP ":"
28#define DSEP "/"
29#endif
30
31#define PX ""
32#define P1 "first path"
33#define P2 "second" DSEP "path"
34#define P3 "th ird" DSEP "path"
35#define P4 "fourth" DSEP "pa th"
36#define P5 "fifthpath"
37
38static const char *parts_in[] = { P1, P2, P3, PX, P4, P5 };
39static const char *path_in = P1 PSEP P2 PSEP P3 PSEP PX PSEP P4 PSEP P5;
40static const int parts_in_count = sizeof(parts_in)/sizeof(*parts_in);
41
42static const char *parts_out[] = { P1, P2, P3, P4, P5 };
43static const char *path_out = P1 PSEP P2 PSEP P3 PSEP P4 PSEP P5;
44static const int parts_out_count = sizeof(parts_out)/sizeof(*parts_out);
45
46static void list_split_multi(abts_case *tc, void *data)
47{
48 int i;
49 apr_status_t rv;
51
52 pathelts = NULL;
57 for (i = 0; i < pathelts->nelts; ++i)
58 ABTS_STR_EQUAL(tc, parts_out[i], ((char**)pathelts->elts)[i]);
59}
60
61static void list_split_single(abts_case *tc, void *data)
62{
63 int i;
64 apr_status_t rv;
66
67 for (i = 0; i < parts_in_count; ++i)
68 {
69 pathelts = NULL;
73 if (parts_in[i][0] == '\0')
75 else
76 {
78 ABTS_STR_EQUAL(tc, parts_in[i], *(char**)pathelts->elts);
79 }
80 }
81}
82
83static void list_merge_multi(abts_case *tc, void *data)
84{
85 int i;
86 char *liststr;
87 apr_status_t rv;
89
90 pathelts = apr_array_make(p, parts_in_count, sizeof(const char*));
91 for (i = 0; i < parts_in_count; ++i)
92 *(const char**)apr_array_push(pathelts) = parts_in[i];
93
94 liststr = NULL;
99}
100
101static void list_merge_single(abts_case *tc, void *data)
102{
103 int i;
104 char *liststr;
105 apr_status_t rv;
107
108 pathelts = apr_array_make(p, 1, sizeof(const char*));
110 for (i = 0; i < parts_in_count; ++i)
111 {
112 *(const char**)pathelts->elts = parts_in[i];
113 liststr = NULL;
115 if (parts_in[i][0] == '\0')
117 else
118 {
122 }
123 }
124}
125
126
128{
129 suite = ADD_SUITE(suite)
130
135
136 return suite;
137}
138
void abts_run_test(abts_suite *ts, test_func f, void *value)
Definition abts.c:175
#define ABTS_PTR_EQUAL(a, b, c)
Definition abts.h:126
#define ADD_SUITE(suite)
Definition abts.h:67
#define ABTS_PTR_NOTNULL(a, b)
Definition abts.h:125
#define ABTS_STR_EQUAL(a, b, c)
Definition abts.h:123
#define ABTS_INT_EQUAL(a, b, c)
Definition abts.h:109
APR Error Codes.
APR File Information.
APR memory allocation.
APR Table library.
apr_size_t size
#define APR_SUCCESS
Definition apr_errno.h:225
int apr_status_t
Definition apr_errno.h:44
void * data
const char * liststr
apr_array_header_t * pathelts
apr_pool_t * p
Definition md_event.c:32
return NULL
Definition mod_so.c:359
int i
Definition mod_so.c:347
#define P3
Definition testpath.c:34
static const char * path_in
Definition testpath.c:39
#define P5
Definition testpath.c:36
static void list_split_multi(abts_case *tc, void *data)
Definition testpath.c:46
static void list_merge_single(abts_case *tc, void *data)
Definition testpath.c:101
#define PSEP
Definition testpath.c:27
#define P1
Definition testpath.c:32
static const char * path_out
Definition testpath.c:43
static void list_merge_multi(abts_case *tc, void *data)
Definition testpath.c:83
static const char * parts_out[]
Definition testpath.c:42
static const char * parts_in[]
Definition testpath.c:38
abts_suite * testpath(abts_suite *suite)
Definition testpath.c:127
static const int parts_out_count
Definition testpath.c:44
#define PX
Definition testpath.c:31
#define P4
Definition testpath.c:35
static void list_split_single(abts_case *tc, void *data)
Definition testpath.c:61
#define P2
Definition testpath.c:33
static const int parts_in_count
Definition testpath.c:40