convert-test-data.c (5815B)
1/* 2 * Licensed to the Apache Software Foundation (ASF) under one 3 * or more contributor license agreements. See the NOTICE file 4 * distributed with this work for additional information 5 * regarding copyright ownership. The ASF licenses this file 6 * to you under the Apache License, Version 2.0 (the 7 * "License"); you may not use this file except in compliance 8 * with the License. You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, 13 * software distributed under the License is distributed on an 14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 * KIND, either express or implied. See the License for the 16 * specific language governing permissions and limitations 17 * under the License. 18 */ 19 20#include "common/iconv.h" 21#include "convert-test-data.h" 22 23encoding_test_parameters test_params[NUM_SUPPORTED_ENCODINGS] = { 24 25 /* 26 * UTF-8 27 */ 28 29 { 30 "UTF-8", 31 GUAC_READ_UTF8, GUAC_READ_UTF8_NORMALIZED, 32 GUAC_WRITE_UTF8, GUAC_WRITE_UTF8_CRLF, 33 .test_mixed = TEST_STRING( 34 "pap\xC3\xA0 \xC3\xA8 bello\n" 35 "pap\xC3\xA0 \xC3\xA8 bello\r\n" 36 "pap\xC3\xA0 \xC3\xA8 bello\n" 37 "pap\xC3\xA0 \xC3\xA8 bello\r\n" 38 "pap\xC3\xA0 \xC3\xA8 bello" 39 ), 40 .test_unix = TEST_STRING( 41 "pap\xC3\xA0 \xC3\xA8 bello\n" 42 "pap\xC3\xA0 \xC3\xA8 bello\n" 43 "pap\xC3\xA0 \xC3\xA8 bello\n" 44 "pap\xC3\xA0 \xC3\xA8 bello\n" 45 "pap\xC3\xA0 \xC3\xA8 bello" 46 ), 47 .test_windows = TEST_STRING( 48 "pap\xC3\xA0 \xC3\xA8 bello\r\n" 49 "pap\xC3\xA0 \xC3\xA8 bello\r\n" 50 "pap\xC3\xA0 \xC3\xA8 bello\r\n" 51 "pap\xC3\xA0 \xC3\xA8 bello\r\n" 52 "pap\xC3\xA0 \xC3\xA8 bello" 53 ) 54 }, 55 56 /* 57 * UTF-16 58 */ 59 60 { 61 "UTF-16", 62 GUAC_READ_UTF16, GUAC_READ_UTF16_NORMALIZED, 63 GUAC_WRITE_UTF16, GUAC_WRITE_UTF16_CRLF, 64 .test_mixed = TEST_STRING( 65 "p\x00" "a\x00" "p\x00" "\xE0\x00" " \x00" "\xE8\x00" " \x00" "b\x00" "e\x00" "l\x00" "l\x00" "o\x00" "\n\x00" 66 "p\x00" "a\x00" "p\x00" "\xE0\x00" " \x00" "\xE8\x00" " \x00" "b\x00" "e\x00" "l\x00" "l\x00" "o\x00" "\r\x00" "\n\x00" 67 "p\x00" "a\x00" "p\x00" "\xE0\x00" " \x00" "\xE8\x00" " \x00" "b\x00" "e\x00" "l\x00" "l\x00" "o\x00" "\n\x00" 68 "p\x00" "a\x00" "p\x00" "\xE0\x00" " \x00" "\xE8\x00" " \x00" "b\x00" "e\x00" "l\x00" "l\x00" "o\x00" "\r\x00" "\n\x00" 69 "p\x00" "a\x00" "p\x00" "\xE0\x00" " \x00" "\xE8\x00" " \x00" "b\x00" "e\x00" "l\x00" "l\x00" "o\x00" 70 "\x00" 71 ), 72 .test_unix = TEST_STRING( 73 "p\x00" "a\x00" "p\x00" "\xE0\x00" " \x00" "\xE8\x00" " \x00" "b\x00" "e\x00" "l\x00" "l\x00" "o\x00" "\n\x00" 74 "p\x00" "a\x00" "p\x00" "\xE0\x00" " \x00" "\xE8\x00" " \x00" "b\x00" "e\x00" "l\x00" "l\x00" "o\x00" "\n\x00" 75 "p\x00" "a\x00" "p\x00" "\xE0\x00" " \x00" "\xE8\x00" " \x00" "b\x00" "e\x00" "l\x00" "l\x00" "o\x00" "\n\x00" 76 "p\x00" "a\x00" "p\x00" "\xE0\x00" " \x00" "\xE8\x00" " \x00" "b\x00" "e\x00" "l\x00" "l\x00" "o\x00" "\n\x00" 77 "p\x00" "a\x00" "p\x00" "\xE0\x00" " \x00" "\xE8\x00" " \x00" "b\x00" "e\x00" "l\x00" "l\x00" "o\x00" 78 "\x00" 79 ), 80 .test_windows = TEST_STRING( 81 "p\x00" "a\x00" "p\x00" "\xE0\x00" " \x00" "\xE8\x00" " \x00" "b\x00" "e\x00" "l\x00" "l\x00" "o\x00" "\r\x00" "\n\x00" 82 "p\x00" "a\x00" "p\x00" "\xE0\x00" " \x00" "\xE8\x00" " \x00" "b\x00" "e\x00" "l\x00" "l\x00" "o\x00" "\r\x00" "\n\x00" 83 "p\x00" "a\x00" "p\x00" "\xE0\x00" " \x00" "\xE8\x00" " \x00" "b\x00" "e\x00" "l\x00" "l\x00" "o\x00" "\r\x00" "\n\x00" 84 "p\x00" "a\x00" "p\x00" "\xE0\x00" " \x00" "\xE8\x00" " \x00" "b\x00" "e\x00" "l\x00" "l\x00" "o\x00" "\r\x00" "\n\x00" 85 "p\x00" "a\x00" "p\x00" "\xE0\x00" " \x00" "\xE8\x00" " \x00" "b\x00" "e\x00" "l\x00" "l\x00" "o\x00" 86 "\x00" 87 ) 88 }, 89 90 /* 91 * ISO 8859-1 92 */ 93 94 { 95 "ISO 8859-1", 96 GUAC_READ_ISO8859_1, GUAC_READ_ISO8859_1_NORMALIZED, 97 GUAC_WRITE_ISO8859_1, GUAC_WRITE_ISO8859_1_CRLF, 98 .test_mixed = TEST_STRING( 99 "pap\xE0 \xE8 bello\n" 100 "pap\xE0 \xE8 bello\r\n" 101 "pap\xE0 \xE8 bello\n" 102 "pap\xE0 \xE8 bello\r\n" 103 "pap\xE0 \xE8 bello" 104 ), 105 .test_unix = TEST_STRING( 106 "pap\xE0 \xE8 bello\n" 107 "pap\xE0 \xE8 bello\n" 108 "pap\xE0 \xE8 bello\n" 109 "pap\xE0 \xE8 bello\n" 110 "pap\xE0 \xE8 bello" 111 ), 112 .test_windows = TEST_STRING( 113 "pap\xE0 \xE8 bello\r\n" 114 "pap\xE0 \xE8 bello\r\n" 115 "pap\xE0 \xE8 bello\r\n" 116 "pap\xE0 \xE8 bello\r\n" 117 "pap\xE0 \xE8 bello" 118 ) 119 }, 120 121 /* 122 * CP-1252 123 */ 124 125 { 126 "CP-1252", 127 GUAC_READ_CP1252, GUAC_READ_CP1252_NORMALIZED, 128 GUAC_WRITE_CP1252, GUAC_WRITE_CP1252_CRLF, 129 .test_mixed = TEST_STRING( 130 "pap\xE0 \xE8 bello\n" 131 "pap\xE0 \xE8 bello\r\n" 132 "pap\xE0 \xE8 bello\n" 133 "pap\xE0 \xE8 bello\r\n" 134 "pap\xE0 \xE8 bello" 135 ), 136 .test_unix = TEST_STRING( 137 "pap\xE0 \xE8 bello\n" 138 "pap\xE0 \xE8 bello\n" 139 "pap\xE0 \xE8 bello\n" 140 "pap\xE0 \xE8 bello\n" 141 "pap\xE0 \xE8 bello" 142 ), 143 .test_windows = TEST_STRING( 144 "pap\xE0 \xE8 bello\r\n" 145 "pap\xE0 \xE8 bello\r\n" 146 "pap\xE0 \xE8 bello\r\n" 147 "pap\xE0 \xE8 bello\r\n" 148 "pap\xE0 \xE8 bello" 149 ) 150 } 151 152}; 153