diff options
Diffstat (limited to 'src/tests/utf.cpp')
-rw-r--r-- | src/tests/utf.cpp | 112 |
1 files changed, 56 insertions, 56 deletions
diff --git a/src/tests/utf.cpp b/src/tests/utf.cpp index 923b611..40d4194 100644 --- a/src/tests/utf.cpp +++ b/src/tests/utf.cpp | |||
@@ -7,65 +7,65 @@ using namespace Bu; | |||
7 | 7 | ||
8 | int main() | 8 | int main() |
9 | { | 9 | { |
10 | sio << "Code: " << Bu::__calcHashCode( Bu::UtfString("Hello there") ) | 10 | sio << "Code: " << Bu::__calcHashCode( Bu::UtfString("Hello there") ) |
11 | << sio.nl; | 11 | << sio.nl; |
12 | 12 | ||
13 | Bu::File fIn("utf8.in", Bu::File::Read ); | 13 | Bu::File fIn("utf8.in", Bu::File::Read ); |
14 | Bu::String sUtf8; | 14 | Bu::String sUtf8; |
15 | char buf[4096]; | 15 | char buf[4096]; |
16 | while( !fIn.isEos() ) | 16 | while( !fIn.isEos() ) |
17 | { | 17 | { |
18 | int iAmnt = fIn.read( buf, 4096 ); | 18 | int iAmnt = fIn.read( buf, 4096 ); |
19 | sUtf8.append( buf, iAmnt ); | 19 | sUtf8.append( buf, iAmnt ); |
20 | } | 20 | } |
21 | Bu::UtfString us( sUtf8, Bu::UtfString::Utf8 ); | 21 | Bu::UtfString us( sUtf8, Bu::UtfString::Utf8 ); |
22 | us.debug(); | 22 | us.debug(); |
23 | { | 23 | { |
24 | Bu::File fOut("utf8.out", Bu::File::WriteNew ); | 24 | Bu::File fOut("utf8.out", Bu::File::WriteNew ); |
25 | us.write( fOut, Bu::UtfString::Utf8 ); | 25 | us.write( fOut, Bu::UtfString::Utf8 ); |
26 | } | 26 | } |
27 | { | 27 | { |
28 | Bu::File fOut("utf16.out", Bu::File::WriteNew ); | 28 | Bu::File fOut("utf16.out", Bu::File::WriteNew ); |
29 | us.write( fOut, Bu::UtfString::Utf16 ); | 29 | us.write( fOut, Bu::UtfString::Utf16 ); |
30 | } | 30 | } |
31 | { | 31 | { |
32 | Bu::File fOut("utf16le.out", Bu::File::WriteNew ); | 32 | Bu::File fOut("utf16le.out", Bu::File::WriteNew ); |
33 | us.write( fOut, Bu::UtfString::Utf16le ); | 33 | us.write( fOut, Bu::UtfString::Utf16le ); |
34 | } | 34 | } |
35 | { | 35 | { |
36 | Bu::File fOut("utf16be.out", Bu::File::WriteNew ); | 36 | Bu::File fOut("utf16be.out", Bu::File::WriteNew ); |
37 | us.write( fOut, Bu::UtfString::Utf16be ); | 37 | us.write( fOut, Bu::UtfString::Utf16be ); |
38 | } | 38 | } |
39 | { | 39 | { |
40 | Bu::File fOut("utf32.out", Bu::File::WriteNew ); | 40 | Bu::File fOut("utf32.out", Bu::File::WriteNew ); |
41 | us.write( fOut, Bu::UtfString::Utf32 ); | 41 | us.write( fOut, Bu::UtfString::Utf32 ); |
42 | } | 42 | } |
43 | { | 43 | { |
44 | Bu::File fOut("utf32le.out", Bu::File::WriteNew ); | 44 | Bu::File fOut("utf32le.out", Bu::File::WriteNew ); |
45 | us.write( fOut, Bu::UtfString::Utf32le ); | 45 | us.write( fOut, Bu::UtfString::Utf32le ); |
46 | } | 46 | } |
47 | { | 47 | { |
48 | Bu::File fOut("utf32be.out", Bu::File::WriteNew ); | 48 | Bu::File fOut("utf32be.out", Bu::File::WriteNew ); |
49 | us.write( fOut, Bu::UtfString::Utf32be ); | 49 | us.write( fOut, Bu::UtfString::Utf32be ); |
50 | } | 50 | } |
51 | 51 | ||
52 | /* | 52 | /* |
53 | argc--, argv++; | 53 | argc--, argv++; |
54 | 54 | ||
55 | for( char **sFile = argv; *sFile; sFile++ ) | 55 | for( char **sFile = argv; *sFile; sFile++ ) |
56 | { | 56 | { |
57 | Bu::File fIn( *sFile, Bu::File::Read ); | 57 | Bu::File fIn( *sFile, Bu::File::Read ); |
58 | Bu::String sUtf8; | 58 | Bu::String sUtf8; |
59 | char buf[4096]; | 59 | char buf[4096]; |
60 | while( !fIn.isEos() ) | 60 | while( !fIn.isEos() ) |
61 | { | 61 | { |
62 | int iAmnt = fIn.read( buf, 4096 ); | 62 | int iAmnt = fIn.read( buf, 4096 ); |
63 | sUtf8.append( buf, iAmnt ); | 63 | sUtf8.append( buf, iAmnt ); |
64 | } | 64 | } |
65 | Bu::UtfString us( sUtf8, Bu::UtfString::Utf16 ); | 65 | Bu::UtfString us( sUtf8, Bu::UtfString::Utf16 ); |
66 | 66 | ||
67 | us.debug(); | 67 | us.debug(); |
68 | } | 68 | } |
69 | */ | 69 | */ |
70 | } | 70 | } |
71 | 71 | ||