File: utf8_tests.cpp

package info (click to toggle)
kicad 9.0.3%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 770,320 kB
  • sloc: cpp: 961,692; ansic: 121,001; xml: 66,428; python: 18,387; sh: 1,010; awk: 301; asm: 292; makefile: 227; javascript: 167; perl: 10
file content (52 lines) | stat: -rw-r--r-- 768 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52


#include <string>
#include <core/utf8.h>
#include <wx/string.h>


void callee( const wxString& aString )
{
    UTF8 arg = aString;

    printf( "%s: '%s'\n", __func__, arg.c_str() );
}


int main( int argc, char** argv )
{
    UTF8        bozo = "This is a test of UTF-8: ü‱☺😕😱";

    callee( bozo );

    wxString s = bozo;

    UTF8 b = s;

    if( s.IsEmpty() )
    {
        printf( "string is empty\n" );
    }

    if(  s != bozo.wx_str() )
    {
        printf( "wxString conversion error\n" );
    }

    if( b != bozo )
    {
        printf( "From string conversion error\n" );
    }

    auto pos = bozo.begin();
    auto end = bozo.end();

    while( pos != end )
    {
        printf( "%c", *pos++ );
    }

    printf("\n");

    return 0;
}