Alexandre Lision | ddd731e | 2014-01-31 11:50:08 -0500 | [diff] [blame] | 1 | // Copyright (C) 2009-2010 David Sugar, Tycho Softworks. |
| 2 | // |
| 3 | // This file is part of GNU uCommon C++. |
| 4 | // |
| 5 | // GNU uCommon C++ is free software: you can redistribute it and/or modify |
| 6 | // it under the terms of the GNU Lesser General Public License as published |
| 7 | // by the Free Software Foundation, either version 3 of the License, or |
| 8 | // (at your option) any later version. |
| 9 | // |
| 10 | // GNU uCommon C++ is distributed in the hope that it will be useful, |
| 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | // GNU Lesser General Public License for more details. |
| 14 | // |
| 15 | // You should have received a copy of the GNU Lesser General Public License |
| 16 | // along with GNU uCommon C++. If not, see <http://www.gnu.org/licenses/>. |
| 17 | |
| 18 | #ifndef DEBUG |
| 19 | #define DEBUG |
| 20 | #endif |
| 21 | |
| 22 | #include <ucommon/ucommon.h> |
| 23 | |
| 24 | #include <stdio.h> |
| 25 | |
| 26 | using namespace UCOMMON_NAMESPACE; |
| 27 | |
| 28 | extern "C" int main() |
| 29 | { |
| 30 | char u1[] = {(char)0xc2, (char)0xa9, 0x00}; |
| 31 | char u2[] = {(char)0xe2, (char)0x89, (char)0xa0, 0x00}; |
| 32 | |
| 33 | assert(utf8::size(u1) == 2); |
| 34 | assert(utf8::size(u2) == 3); |
| 35 | assert(utf8::count(u1) == 1); |
| 36 | assert(utf8::count(u2) == 1); |
| 37 | assert(utf8::codepoint(u1) == 0x00a9); |
| 38 | assert(utf8::codepoint(u2) == 0x2260); |
| 39 | |
| 40 | return 0; |
| 41 | } |