wcsncasecmp.c revision f2d34afa1058d195513e7ab9a6c1f0ce38b4d05b
/*
* This file and its contents are supplied under the terms of the
* Common Development and Distribution License ("CDDL"), version 1.0.
* You may only use this file in accordance with the terms of version
* 1.0 of the CDDL.
*
* A full copy of the text of the CDDL should have accompanied this
* source. A copy of the CDDL is also available via the Internet at
*/
/*
* Copyright 2016 Joyent, Inc.
*/
/*
* General tests for wcsncasecmp(). Test to make sure that the following are
* true:
*
* o Two identical strings are equal
* o Two strings with the same contents are equal
* o Case insensitive in ASCII works
* o Basic cases where strings aren't equal
* o An ASCII string that would compare greater due to case is properly less
* o Comparing with zero characters succeeds even if different strings
* o Characters in a locale / language that don't have a notion of case are
* consistent
*/
#include <wchar.h>
#include <string.h>
#include <strings.h>
#include <stdlib.h>
#include <locale.h>
int
main(void)
{
int ret;
const char *str = "kefka";
const char *caps = "KEFKA";
const char *less = "celes";
const char *more = "terra";
const char *hikari = "光";
const char *awake = "目覚め";
/*
* Start in en_US.UTF-8, which the test suites deps guarantee is
* present.
*/
(void) memset(a, 'a', sizeof (a));
(void) memset(b, 'b', sizeof (b));
VERIFY3S(wcsncasecmp(a, b, 0), ==, 0);
/*
* This locale is also guaranteed by the test suite.
*/
return (0);
}