summaryrefslogtreecommitdiff
path: root/src/tests
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/tests/base64.cpp37
1 files changed, 34 insertions, 3 deletions
diff --git a/src/tests/base64.cpp b/src/tests/base64.cpp
index 3122d5c..5e36448 100644
--- a/src/tests/base64.cpp
+++ b/src/tests/base64.cpp
@@ -1,4 +1,5 @@
1#include "bu/file.h" 1#include "bu/file.h"
2#include "bu/membuf.h"
2#include "bu/base64.h" 3#include "bu/base64.h"
3 4
4int main( int argc, char *argv[] ) 5int main( int argc, char *argv[] )
@@ -31,12 +32,42 @@ int main( int argc, char *argv[] )
31 Bu::File fOut( argv[1], Bu::File::WriteNew ); 32 Bu::File fOut( argv[1], Bu::File::WriteNew );
32 Bu::Base64 bIn( fIn ); 33 Bu::Base64 bIn( fIn );
33 34
34 char buf[16]; 35 char buf[1024];
35 for(;;) 36 for(;;)
36 { 37 {
37 int iRead = bIn.read( buf, 16 ); 38 int iRead = bIn.read( buf, 1024 );
39 printf("Read %d bytes.\n", iRead );
38 fOut.write( buf, iRead ); 40 fOut.write( buf, iRead );
39 if( iRead < 16 ) 41 if( iRead == 0 )
42 break;
43 }
44 }
45 else if( argv[0][0] == 'D' )
46 {
47 argv++;
48 Bu::MemBuf mIn;
49 {
50 Bu::File fIn( argv[0], Bu::File::Read );
51 char buf[1024];
52 for(;;)
53 {
54 int iRead = fIn.read( buf, 1024 );
55 mIn.write( buf, iRead );
56 if( iRead < 1024 )
57 break;
58 }
59 mIn.setPos( 0 );
60 }
61 Bu::File fOut( argv[1], Bu::File::WriteNew );
62 Bu::Base64 bIn( mIn );
63
64 char buf[1024];
65 for(;;)
66 {
67 int iRead = bIn.read( buf, 1024 );
68 printf("Read %d bytes.\n", iRead );
69 fOut.write( buf, iRead );
70 if( iRead == 0 )
40 break; 71 break;
41 } 72 }
42 } 73 }