]> git.saurik.com Git - apple/icu.git/blame - icuSources/extra/scrptrun/srtest.cpp
ICU-66108.tar.gz
[apple/icu.git] / icuSources / extra / scrptrun / srtest.cpp
CommitLineData
f3c0d7a5
A
1// © 2016 and later: Unicode, Inc. and others.
2// License & terms of use: http://www.unicode.org/copyright.html
b75a7d8f
A
3/*
4 * %W% %E%
5 *
2ca993e8 6 * (C) Copyright IBM Corp. 2001-2016 - All Rights Reserved
b75a7d8f
A
7 *
8 */
9
10#include "unicode/utypes.h"
11#include "unicode/uscript.h"
12
2ca993e8 13#include "cmemory.h"
b75a7d8f
A
14#include "scrptrun.h"
15
16#include <stdio.h>
17
18UChar testChars[] = {
19 0x0020, 0x0946, 0x0939, 0x093F, 0x0928, 0x094D, 0x0926, 0x0940, 0x0020,
20 0x0627, 0x0644, 0x0639, 0x0631, 0x0628, 0x064A, 0x0629, 0x0020,
21 0x0420, 0x0443, 0x0441, 0x0441, 0x043A, 0x0438, 0x0439, 0x0020,
22 'E', 'n', 'g', 'l', 'i', 's', 'h', 0x0020,
23 0x6F22, 0x5B75, 0x3068, 0x3072, 0x3089, 0x304C, 0x306A, 0x3068,
24 0x30AB, 0x30BF, 0x30AB, 0x30CA,
25 0xD801, 0xDC00, 0xD801, 0xDC01, 0xD801, 0xDC02, 0xD801, 0xDC03
26};
27
2ca993e8 28int32_t testLength = UPRV_LENGTHOF(testChars);
b75a7d8f 29
340931cb 30int main()
b75a7d8f 31{
340931cb 32 icu::ScriptRun scriptRun(testChars, 0, testLength);
b75a7d8f
A
33
34 while (scriptRun.next()) {
35 int32_t start = scriptRun.getScriptStart();
36 int32_t end = scriptRun.getScriptEnd();
37 UScriptCode code = scriptRun.getScriptCode();
38
39 printf("Script '%s' from %d to %d.\n", uscript_getName(code), start, end);
40 }
340931cb 41 return 0;
2ca993e8 42}