test-term-parser.c revision 1c9633d669948155455e29b0c6e770995a8b1ca3
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
/***
This file is part of systemd.
Copyright (C) 2014 David Herrmann <dh.herrmann@gmail.com>
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
systemd is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
/*
* Terminal Parser Tests
*/
#include <assert.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "macro.h"
#include "term-internal.h"
#include "util.h"
static void test_term_utf8_invalid(void) {
term_utf8 p = { };
len = 5;
len = 5;
len = 5;
len = 5;
}
static void test_term_utf8_range(void) {
term_utf8 p = { };
char u8[4];
uint32_t i, j;
/* Convert all ucs-4 chars to utf-8 and back */
for (i = 0; i < 0x10FFFF; ++i) {
if (!ulen)
continue;
for (j = 0; j < ulen; ++j) {
if (!res) {
continue;
}
}
}
}
static void test_term_utf8_mix(void) {
static const char source[] = {
0x00, /* normal 0 */
0xC0, 0x80, /* overlong 0 */
0xC0, 0x81, /* overlong 1 */
0xE0, 0x80, 0x81, /* overlong 1 */
0xF0, 0x80, 0x80, 0x81, /* overlong 1 */
0xC0, 0x00, /* invalid continuation */
0xC0, 0xC0, 0x81, /* invalid continuation with a following overlong 1 */
0xF8, 0x80, 0x80, 0x80, 0x81, /* overlong 1 with 5 bytes */
0xE0, 0x80, 0xC0, 0x81, /* invalid 3-byte followed by valid 2-byte */
0xF0, 0x80, 0x80, 0xC0, 0x81, /* invalid 4-byte followed by valid 2-byte */
};
0x0000,
0x0000,
0x0001,
0x0001,
0x0001,
0x00C0, 0x0000,
0x00C0, 0x0001,
0x00F8, 0x0080, 0x0080, 0x0080, 0x0081,
0x00E0, 0x0080, 0x0001,
0x00F0, 0x0080, 0x0080, 0x0001,
};
term_utf8 p = { };
unsigned int i, j;
for (i = 0, j = 0; i < sizeof(source); ++i) {
if (!res)
continue;
j += len;
}
}
return 0;
}