1*0a6a1f1dSLionel Sambuc /* $NetBSD: test-prohibited.c,v 1.1.1.2 2014/04/24 12:45:56 pettai Exp $ */
2ebfedea0SLionel Sambuc
3ebfedea0SLionel Sambuc /*
4ebfedea0SLionel Sambuc * Copyright (c) 2004 Kungliga Tekniska Högskolan
5ebfedea0SLionel Sambuc * (Royal Institute of Technology, Stockholm, Sweden).
6ebfedea0SLionel Sambuc * All rights reserved.
7ebfedea0SLionel Sambuc *
8ebfedea0SLionel Sambuc * Redistribution and use in source and binary forms, with or without
9ebfedea0SLionel Sambuc * modification, are permitted provided that the following conditions
10ebfedea0SLionel Sambuc * are met:
11ebfedea0SLionel Sambuc *
12ebfedea0SLionel Sambuc * 1. Redistributions of source code must retain the above copyright
13ebfedea0SLionel Sambuc * notice, this list of conditions and the following disclaimer.
14ebfedea0SLionel Sambuc *
15ebfedea0SLionel Sambuc * 2. Redistributions in binary form must reproduce the above copyright
16ebfedea0SLionel Sambuc * notice, this list of conditions and the following disclaimer in the
17ebfedea0SLionel Sambuc * documentation and/or other materials provided with the distribution.
18ebfedea0SLionel Sambuc *
19ebfedea0SLionel Sambuc * 3. Neither the name of the Institute nor the names of its contributors
20ebfedea0SLionel Sambuc * may be used to endorse or promote products derived from this software
21ebfedea0SLionel Sambuc * without specific prior written permission.
22ebfedea0SLionel Sambuc *
23ebfedea0SLionel Sambuc * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
24ebfedea0SLionel Sambuc * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25ebfedea0SLionel Sambuc * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26ebfedea0SLionel Sambuc * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
27ebfedea0SLionel Sambuc * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28ebfedea0SLionel Sambuc * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29ebfedea0SLionel Sambuc * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30ebfedea0SLionel Sambuc * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31ebfedea0SLionel Sambuc * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32ebfedea0SLionel Sambuc * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33ebfedea0SLionel Sambuc * SUCH DAMAGE.
34ebfedea0SLionel Sambuc */
35ebfedea0SLionel Sambuc
36ebfedea0SLionel Sambuc #ifdef HAVE_CONFIG_H
37ebfedea0SLionel Sambuc #include <config.h>
38ebfedea0SLionel Sambuc #endif
39ebfedea0SLionel Sambuc #include <stdio.h>
40ebfedea0SLionel Sambuc #include "windlocl.h"
41ebfedea0SLionel Sambuc
42ebfedea0SLionel Sambuc static uint32_t positives[] = {
43ebfedea0SLionel Sambuc 0x00A0, 0x3000,
44ebfedea0SLionel Sambuc 0x0080, 0x009F, 0x206A, 0x206F, 0xFEFF,
45ebfedea0SLionel Sambuc 0xFFF9, 0xFFFD, 0xFFFE, 0xFFFF,
46ebfedea0SLionel Sambuc 0x1D173, 0x1D17A,
47ebfedea0SLionel Sambuc 0xE000, 0xF8FF, 0xF0000, 0xFFFFD,
48ebfedea0SLionel Sambuc 0x100000, 0x10FFFD,
49ebfedea0SLionel Sambuc 0xFDD0, 0xFDEF,
50ebfedea0SLionel Sambuc 0xFFFE, 0xFFFF,
51ebfedea0SLionel Sambuc 0x1FFFE, 0x1FFFF,
52ebfedea0SLionel Sambuc 0x2FFFE, 0x2FFFF,
53ebfedea0SLionel Sambuc 0x3FFFE, 0x3FFFF,
54ebfedea0SLionel Sambuc 0x4FFFE, 0x4FFFF,
55ebfedea0SLionel Sambuc 0x5FFFE, 0x5FFFF,
56ebfedea0SLionel Sambuc 0x6FFFE, 0x6FFFF,
57ebfedea0SLionel Sambuc 0x7FFFE, 0x7FFFF,
58ebfedea0SLionel Sambuc 0x8FFFE, 0x8FFFF,
59ebfedea0SLionel Sambuc 0x9FFFE, 0x9FFFF,
60ebfedea0SLionel Sambuc 0xAFFFE, 0xAFFFF,
61ebfedea0SLionel Sambuc 0xBFFFE, 0xBFFFF,
62ebfedea0SLionel Sambuc 0xCFFFE, 0xCFFFF,
63ebfedea0SLionel Sambuc 0xDFFFE, 0xDFFFF,
64ebfedea0SLionel Sambuc 0xEFFFE, 0xEFFFF,
65ebfedea0SLionel Sambuc 0xFFFFE, 0xFFFFF,
66ebfedea0SLionel Sambuc 0x10FFFE, 0x10FFFF,
67ebfedea0SLionel Sambuc 0xD800, 0xDFFF,
68ebfedea0SLionel Sambuc 0xFFF9,
69ebfedea0SLionel Sambuc 0xFFFA,
70ebfedea0SLionel Sambuc 0xFFFB,
71ebfedea0SLionel Sambuc 0xFFFC,
72ebfedea0SLionel Sambuc 0x2FF0, 0x2FFB,
73ebfedea0SLionel Sambuc 0x0340,
74ebfedea0SLionel Sambuc 0x0341,
75ebfedea0SLionel Sambuc 0x200E,
76ebfedea0SLionel Sambuc 0x200F,
77ebfedea0SLionel Sambuc 0x202A,
78ebfedea0SLionel Sambuc 0x202B,
79ebfedea0SLionel Sambuc 0x202C,
80ebfedea0SLionel Sambuc 0x202D,
81ebfedea0SLionel Sambuc 0x202E,
82ebfedea0SLionel Sambuc 0x206A,
83ebfedea0SLionel Sambuc 0x206B,
84ebfedea0SLionel Sambuc 0x206C,
85ebfedea0SLionel Sambuc 0x206D,
86ebfedea0SLionel Sambuc 0x206E,
87ebfedea0SLionel Sambuc 0x206F,
88ebfedea0SLionel Sambuc 0xE0001,
89ebfedea0SLionel Sambuc 0xE0020,
90ebfedea0SLionel Sambuc 0xE007F,
91ebfedea0SLionel Sambuc };
92ebfedea0SLionel Sambuc
93ebfedea0SLionel Sambuc static uint32_t negatives[] = {
94ebfedea0SLionel Sambuc 0x0000, 0x001F, 0x007F,
95ebfedea0SLionel Sambuc 0x0020, 0x2069, 0x2070, 0x0FFF8,
96ebfedea0SLionel Sambuc 0x1D172, 0x1D17B,
97ebfedea0SLionel Sambuc 0xF900,
98ebfedea0SLionel Sambuc 0xFDCF, 0xFDF0,
99ebfedea0SLionel Sambuc 0x10000,
100ebfedea0SLionel Sambuc 0x1FFFD, 0x20000,
101ebfedea0SLionel Sambuc 0x2FFFD, 0x30000,
102ebfedea0SLionel Sambuc 0x3FFFD, 0x40000,
103ebfedea0SLionel Sambuc 0x4FFFD, 0x50000,
104ebfedea0SLionel Sambuc 0x5FFFD, 0x60000,
105ebfedea0SLionel Sambuc 0x6FFFD, 0x70000,
106ebfedea0SLionel Sambuc 0x7FFFD, 0x80000,
107ebfedea0SLionel Sambuc 0x8FFFD, 0x90000,
108ebfedea0SLionel Sambuc 0x9FFFD, 0xA0000,
109ebfedea0SLionel Sambuc 0xAFFFD, 0xB0000,
110ebfedea0SLionel Sambuc 0xBFFFD, 0xC0000,
111ebfedea0SLionel Sambuc 0xCFFFD, 0xD0000,
112ebfedea0SLionel Sambuc 0xDFFFD, 0xE0000,
113ebfedea0SLionel Sambuc 0xEFFFD,
114ebfedea0SLionel Sambuc 0x110000,
115ebfedea0SLionel Sambuc 0xD7FF,
116ebfedea0SLionel Sambuc 0xFFF8,
117ebfedea0SLionel Sambuc 0x2FEF, 0x2FFC,
118ebfedea0SLionel Sambuc };
119ebfedea0SLionel Sambuc
120ebfedea0SLionel Sambuc int
main(void)121ebfedea0SLionel Sambuc main(void)
122ebfedea0SLionel Sambuc {
123ebfedea0SLionel Sambuc unsigned i;
124ebfedea0SLionel Sambuc unsigned failures = 0;
125ebfedea0SLionel Sambuc
126ebfedea0SLionel Sambuc for (i = 0; i < sizeof(positives)/sizeof(positives[0]); ++i)
127ebfedea0SLionel Sambuc if (!_wind_stringprep_error(positives[i], WIND_PROFILE_NAME)) {
128ebfedea0SLionel Sambuc printf ("code-point 0x%x not marked as prohibited\n",
129ebfedea0SLionel Sambuc positives[i]);
130ebfedea0SLionel Sambuc ++failures;
131ebfedea0SLionel Sambuc }
132ebfedea0SLionel Sambuc
133ebfedea0SLionel Sambuc for (i = 0; i < sizeof(negatives)/sizeof(negatives[0]); ++i)
134ebfedea0SLionel Sambuc if (_wind_stringprep_error(negatives[i], WIND_PROFILE_NAME)) {
135ebfedea0SLionel Sambuc printf ("code-point 0x%x not marked as non-prohibited\n",
136ebfedea0SLionel Sambuc negatives[i]);
137ebfedea0SLionel Sambuc ++failures;
138ebfedea0SLionel Sambuc }
139ebfedea0SLionel Sambuc return failures != 0;
140ebfedea0SLionel Sambuc }
141