/*
* 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 2014 Garrett D'Amore <garrett@damore.org>
*/
/*
* This program tests that wcsrtombs and friends work properly.
* In order for it to work, it requires that some additional locales
* be installed.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <locale.h>
#include <wchar.h>
#include <err.h>
#include <errno.h>
#include <unistd.h>
#include <xlocale.h>
#include <note.h>
#include "test_common.h"
int extra_debug = 0;
/*
* Note that this file is easiest edited with a UTF-8 capable editor,
* as there are embedded UTF-8 symbols in some of the strings.
*/
struct wcsrtombs_test {
};
/* Unicode values never have the high order bit set */
{ TESTING_MBS, TESTING_WCS },
{ HELLO_EN_MBS, HELLO_EN_WCS },
{ 0, 0 },
};
{ TESTING_MBS, TESTING_WCS },
{ HELLO_EN_MBS, HELLO_EN_WCS },
{ HELLO_RU_MBS, HELLO_RU_WCS },
{ 0, 0 },
};
struct {
const char *locale;
} locales[] = {
{ "C", C_data },
{ "en_US.UTF-8", utf8_data },
};
void
{
test_t t;
char *v;
if (v == NULL) {
}
}
test_failed(t, "incorrect return value: %d != %d",
}
test_failed(t, "wrong result: %s != %s",
}
if (extra_debug) {
}
}
test_passed(t);
}
void
{
test_t t;
char *v;
if (v == NULL) {
}
if (strcmp(v, "C") != 0) {
}
}
test_failed(t, "incorrect return value: %d != %d",
}
}
if (extra_debug) {
}
}
test_passed(t);
}
void
struct wcsrtombs_test *test)
{
}
test_failed(t, "incorrect return value: %d != %d",
}
}
if (extra_debug) {
}
}
}
void
{
for (int j = 0; j < NUMITR; j++) {
test_debugf(t, "iteration %d", j);
}
}
test_passed(t);
}
void
test_wcsrtombs_threaded(void)
{
}
void
test_wcsrtombs_partial(void)
{
test_t t;
char *dst;
t = test_start("wcsrtombs_partial");
}
if (cnt != 0) {
}
test_failed(t, "incorrectly advanced wcs");
}
if (cnt != 2) {
}
if (extra_debug) {
}
}
test_passed(t);
}
void
test_wcsrtombs_negative(void)
{
char *dst;
int e;
test_t t;
int cnt;
t = test_start("wcsrtombs_negative");
}
if (cnt != -1) {
}
test_failed(t, "wrong errno, wanted %d (EILSEQ), got %d: %s",
}
test_passed(t);
}
void
test_wcsnrtombs_partial(void)
{
test_t t;
char *dst;
t = test_start("wcsrntombs_partial");
}
if (cnt != 0) {
}
test_failed(t, "incorrectly advanced wcs");
}
/* we should get just 2 wide characters (expanding to 4 bytes) */
if (cnt != 4) {
}
if (extra_debug) {
}
}
test_passed(t);
}
void
test_wcsrtombs(void)
{
}
}
int
{
int optc;
switch (optc) {
case 'd':
break;
case 'f':
break;
case 'D':
extra_debug++;
break;
default:
exit(1);
}
}
exit(0);
}