Sun, 17 Sep 2017 17:56:02 +0200
adds option to dav get for downloading only the directory structure
this is an undocumented feature and may be replaced in the future
251
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1 | /* |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
3 | * |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
4 | * Copyright 2016 Olaf Wintermann. All rights reserved. |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
5 | * |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
6 | * Redistribution and use in source and binary forms, with or without |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
7 | * modification, are permitted provided that the following conditions are met: |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
8 | * |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
9 | * 1. Redistributions of source code must retain the above copyright |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
10 | * notice, this list of conditions and the following disclaimer. |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
11 | * |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
12 | * 2. Redistributions in binary form must reproduce the above copyright |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
13 | * notice, this list of conditions and the following disclaimer in the |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
14 | * documentation and/or other materials provided with the distribution. |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
15 | * |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
26 | * POSSIBILITY OF SUCH DAMAGE. |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
27 | */ |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
28 | |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
29 | #include <stdio.h> |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
30 | #include <stdlib.h> |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
31 | #include <string.h> |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
32 | |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
33 | #include "base64.h" |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
34 | |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
35 | #include <ucx/string.h> |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
36 | #include <libidav/utils.h> |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
37 | |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
38 | UCX_TEST(test_util_base64decode) { |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
39 | char *s1 = util_base64decode("YWJj"); |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
40 | char *s2 = util_base64decode("aGVsbG8gd29ybGQ="); |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
41 | char *s3 = util_base64decode("MA=="); |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
42 | char *s4 = util_base64decode("MHh4MQ=="); |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
43 | |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
44 | UCX_TEST_BEGIN; |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
45 | |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
46 | UCX_TEST_ASSERT(!strcmp(s1, "abc"), "s1 wrong"); |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
47 | UCX_TEST_ASSERT(!strcmp(s2, "hello world"), "s2 wrong"); |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
48 | UCX_TEST_ASSERT(!strcmp(s3, "0"), "s3 wrong"); |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
49 | UCX_TEST_ASSERT(!strcmp(s4, "0xx1"), "s4 wrong"); |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
50 | |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
51 | UCX_TEST_END; |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
52 | |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
53 | free(s1); |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
54 | free(s2); |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
55 | free(s3); |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
56 | free(s4); |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
57 | } |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
58 | |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
59 | UCX_TEST(test_util_base64decode_len) { |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
60 | int len1, len2, len3, len4, len5, len6; |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
61 | char *s1 = util_base64decode_len("aGVsbG8=", &len1); // 5 |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
62 | char *s2 = util_base64decode_len("MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5", &len2); // 30 |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
63 | char *s3 = util_base64decode_len("Lg==", &len3); // 1 |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
64 | char *s4 = util_base64decode_len("bG9s", &len4); // 3 |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
65 | char *s5 = util_base64decode_len("YWJjLS0tLS0tM3g=", &len5); // 11 |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
66 | char *s6 = util_base64decode_len("YWJjZGVmZy4uLjs7MGhlbGxv", &len6); // 18 |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
67 | |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
68 | UCX_TEST_BEGIN; |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
69 | |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
70 | UCX_TEST_ASSERT(!strcmp(s1, "hello"), "s1 wrong"); |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
71 | UCX_TEST_ASSERT(len1 == 5, "len1 wrong"); |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
72 | |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
73 | UCX_TEST_ASSERT(!strcmp(s2, "012345678901234567890123456789"), "s2 wrong"); |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
74 | UCX_TEST_ASSERT(len2 == 30, "len2 wrong"); |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
75 | |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
76 | UCX_TEST_ASSERT(!strcmp(s3, "."), "s3 wrong"); |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
77 | UCX_TEST_ASSERT(len3 == 1, "len3 wrong"); |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
78 | |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
79 | UCX_TEST_ASSERT(!strcmp(s4, "lol"), "s4 wrong"); |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
80 | UCX_TEST_ASSERT(len4 == 3, "len4 wrong"); |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
81 | |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
82 | UCX_TEST_ASSERT(!strcmp(s5, "abc------3x"), "s5 wrong"); |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
83 | UCX_TEST_ASSERT(len5 == 11, "len5 wrong"); |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
84 | |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
85 | UCX_TEST_ASSERT(!strcmp(s6, "abcdefg...;;0hello"), "s6 failed"); |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
86 | UCX_TEST_ASSERT(len6 == 18, "len6 wrong"); |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
87 | |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
88 | UCX_TEST_END; |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
89 | |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
90 | free(s1); |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
91 | free(s2); |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
92 | free(s3); |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
93 | free(s4); |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
94 | free(s5); |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
95 | free(s6); |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
96 | } |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
97 | |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
98 | UCX_TEST(test_util_base64encode) { |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
99 | char *str1 = "hello world"; |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
100 | char *str2 = "test string"; |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
101 | char *str3 = "01234567890123456789012345678901234567890123456789"; |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
102 | char str4[8]; |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
103 | str4[0] = 0; |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
104 | str4[1] = 12; |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
105 | str4[2] = 3; |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
106 | str4[3] = 50; |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
107 | str4[4] = 2; |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
108 | str4[5] = 110; |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
109 | str4[6] = 63; |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
110 | str4[7] = 1; |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
111 | |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
112 | char *str5 = "a"; |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
113 | char *str6 = "ab"; |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
114 | char *str7 = "abc"; |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
115 | char *str8 = "abcd"; |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
116 | char *str9 = "abcde"; |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
117 | char *str10 = "abcdef"; |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
118 | |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
119 | char *b1 = util_base64encode(str1, strlen(str1)); |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
120 | char *b2 = util_base64encode(str2, strlen(str2)); |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
121 | char *b3 = util_base64encode(str3, strlen(str3)); |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
122 | char *b4 = util_base64encode(str4, 8); |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
123 | char *b5 = util_base64encode(str5, strlen(str5)); |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
124 | char *b6 = util_base64encode(str6, strlen(str6)); |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
125 | char *b7 = util_base64encode(str7, strlen(str7)); |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
126 | char *b8 = util_base64encode(str8, strlen(str8)); |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
127 | char *b9 = util_base64encode(str9, strlen(str9)); |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
128 | char *b10 = util_base64encode(str10, strlen(str10)); |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
129 | |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
130 | UCX_TEST_BEGIN; |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
131 | |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
132 | UCX_TEST_ASSERT(!strcmp(b1, "aGVsbG8gd29ybGQ="), "b1 failed"); |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
133 | UCX_TEST_ASSERT(!strcmp(b2, "dGVzdCBzdHJpbmc="), "b2 failed"); |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
134 | UCX_TEST_ASSERT(!strcmp(b3, "MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODk="), "b3 failed"); |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
135 | UCX_TEST_ASSERT(!strcmp(b4, "AAwDMgJuPwE="), "b4 failed"); |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
136 | |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
137 | UCX_TEST_ASSERT(!strcmp(b5, "YQ=="), "b5 failed"); |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
138 | UCX_TEST_ASSERT(!strcmp(b6, "YWI="), "b6 failed"); |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
139 | UCX_TEST_ASSERT(!strcmp(b7, "YWJj"), "b7 failed"); |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
140 | UCX_TEST_ASSERT(!strcmp(b8, "YWJjZA=="), "b8 failed"); |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
141 | UCX_TEST_ASSERT(!strcmp(b9, "YWJjZGU="), "b9 failed"); |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
142 | UCX_TEST_ASSERT(!strcmp(b10, "YWJjZGVm"), "b10 failed"); |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
143 | |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
144 | UCX_TEST_END; |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
145 | |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
146 | free(b1); |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
147 | free(b2); |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
148 | free(b3); |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
149 | free(b4); |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
150 | free(b5); |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
151 | free(b6); |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
152 | free(b7); |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
153 | free(b8); |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
154 | free(b9); |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
155 | free(b10); |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
156 | } |
7534cb97b9ab
adds first libidav tests
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
157 |