diff options
| author | Mike Buland <eichlan@xagasoft.com> | 2011-04-07 05:44:42 +0000 |
|---|---|---|
| committer | Mike Buland <eichlan@xagasoft.com> | 2011-04-07 05:44:42 +0000 |
| commit | 27aecbc60be6c80ce221f29c01f743de714faa63 (patch) | |
| tree | 84838a5e55088ed95c3f4ca35f6ff4c27f56812b /src/tests | |
| parent | 5de54062d8bf9bdfde17a02e4aef91341146162d (diff) | |
| download | libbu++-27aecbc60be6c80ce221f29c01f743de714faa63.tar.gz libbu++-27aecbc60be6c80ce221f29c01f743de714faa63.tar.bz2 libbu++-27aecbc60be6c80ce221f29c01f743de714faa63.tar.xz libbu++-27aecbc60be6c80ce221f29c01f743de714faa63.zip | |
Pretty sure all utf encoders and decoders are complete and tested.
Diffstat (limited to 'src/tests')
| -rw-r--r-- | src/tests/utf.cpp | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/tests/utf.cpp b/src/tests/utf.cpp index 9e075e2..01bac7e 100644 --- a/src/tests/utf.cpp +++ b/src/tests/utf.cpp | |||
| @@ -4,6 +4,46 @@ | |||
| 4 | 4 | ||
| 5 | int main( int argc, char *argv[] ) | 5 | int main( int argc, char *argv[] ) |
| 6 | { | 6 | { |
| 7 | Bu::File fIn("utf8.in", Bu::File::Read ); | ||
| 8 | Bu::String sUtf8; | ||
| 9 | char buf[4096]; | ||
| 10 | while( !fIn.isEos() ) | ||
| 11 | { | ||
| 12 | int iAmnt = fIn.read( buf, 4096 ); | ||
| 13 | sUtf8.append( buf, iAmnt ); | ||
| 14 | } | ||
| 15 | Bu::UtfString us( sUtf8, Bu::UtfString::Utf8 ); | ||
| 16 | us.debug(); | ||
| 17 | { | ||
| 18 | Bu::File fOut("utf8.out", Bu::File::WriteNew ); | ||
| 19 | us.write( fOut, Bu::UtfString::Utf8 ); | ||
| 20 | } | ||
| 21 | { | ||
| 22 | Bu::File fOut("utf16.out", Bu::File::WriteNew ); | ||
| 23 | us.write( fOut, Bu::UtfString::Utf16 ); | ||
| 24 | } | ||
| 25 | { | ||
| 26 | Bu::File fOut("utf16le.out", Bu::File::WriteNew ); | ||
| 27 | us.write( fOut, Bu::UtfString::Utf16le ); | ||
| 28 | } | ||
| 29 | { | ||
| 30 | Bu::File fOut("utf16be.out", Bu::File::WriteNew ); | ||
| 31 | us.write( fOut, Bu::UtfString::Utf16be ); | ||
| 32 | } | ||
| 33 | { | ||
| 34 | Bu::File fOut("utf32.out", Bu::File::WriteNew ); | ||
| 35 | us.write( fOut, Bu::UtfString::Utf32 ); | ||
| 36 | } | ||
| 37 | { | ||
| 38 | Bu::File fOut("utf32le.out", Bu::File::WriteNew ); | ||
| 39 | us.write( fOut, Bu::UtfString::Utf32le ); | ||
| 40 | } | ||
| 41 | { | ||
| 42 | Bu::File fOut("utf32be.out", Bu::File::WriteNew ); | ||
| 43 | us.write( fOut, Bu::UtfString::Utf32be ); | ||
| 44 | } | ||
| 45 | |||
| 46 | /* | ||
| 7 | argc--, argv++; | 47 | argc--, argv++; |
| 8 | 48 | ||
| 9 | for( char **sFile = argv; *sFile; sFile++ ) | 49 | for( char **sFile = argv; *sFile; sFile++ ) |
| @@ -17,7 +57,9 @@ int main( int argc, char *argv[] ) | |||
| 17 | sUtf8.append( buf, iAmnt ); | 57 | sUtf8.append( buf, iAmnt ); |
| 18 | } | 58 | } |
| 19 | Bu::UtfString us( sUtf8, Bu::UtfString::Utf16 ); | 59 | Bu::UtfString us( sUtf8, Bu::UtfString::Utf16 ); |
| 60 | |||
| 20 | us.debug(); | 61 | us.debug(); |
| 21 | } | 62 | } |
| 63 | */ | ||
| 22 | } | 64 | } |
| 23 | 65 | ||
