diff options
| author | Mike Buland <eichlan@xagasoft.com> | 2011-03-22 19:25:42 +0000 |
|---|---|---|
| committer | Mike Buland <eichlan@xagasoft.com> | 2011-03-22 19:25:42 +0000 |
| commit | 88004d87d513dcba767b1dae1e5199a89b22ce36 (patch) | |
| tree | 06051330e18e44407edc25d28fe978e0637ed90e /src/tests | |
| parent | 9d7ee5a5b9b6ca2093043b7c584df02913739b02 (diff) | |
| download | libbu++-88004d87d513dcba767b1dae1e5199a89b22ce36.tar.gz libbu++-88004d87d513dcba767b1dae1e5199a89b22ce36.tar.bz2 libbu++-88004d87d513dcba767b1dae1e5199a89b22ce36.tar.xz libbu++-88004d87d513dcba767b1dae1e5199a89b22ce36.zip | |
We now have a UTF-8 test parser, I'm going to move it into a functor, I think.
Diffstat (limited to '')
| -rw-r--r-- | src/tests/utf.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/tests/utf.cpp b/src/tests/utf.cpp new file mode 100644 index 0000000..59d49c6 --- /dev/null +++ b/src/tests/utf.cpp | |||
| @@ -0,0 +1,22 @@ | |||
| 1 | #include <bu/file.h> | ||
| 2 | #include <bu/string.h> | ||
| 3 | #include <bu/utfstring.h> | ||
| 4 | |||
| 5 | int main( int argc, char *argv[] ) | ||
| 6 | { | ||
| 7 | argc--, argv++; | ||
| 8 | |||
| 9 | for( char **sFile = argv; *sFile; sFile++ ) | ||
| 10 | { | ||
| 11 | Bu::File fIn( *sFile, Bu::File::Read ); | ||
| 12 | Bu::String sUtf8; | ||
| 13 | char buf[4096]; | ||
| 14 | while( !fIn.isEos() ) | ||
| 15 | { | ||
| 16 | int iAmnt = fIn.read( buf, 4096 ); | ||
| 17 | sUtf8.append( buf, iAmnt ); | ||
| 18 | } | ||
| 19 | Bu::UtfString::debugUtf8( sUtf8 ); | ||
| 20 | } | ||
| 21 | } | ||
| 22 | |||
