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