summaryrefslogtreecommitdiff
path: root/src/tests
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2009-02-19 23:44:57 +0000
committerMike Buland <eichlan@xagasoft.com>2009-02-19 23:44:57 +0000
commit4309066dff46f52690998bbd1f60ec8b1631f142 (patch)
tree07b6092622c909351f20590e7ee96d07f5b2d010 /src/tests
parent3f958097632256329cdbaf2219e2ba15325e9c52 (diff)
downloadlibbu++-4309066dff46f52690998bbd1f60ec8b1631f142.tar.gz
libbu++-4309066dff46f52690998bbd1f60ec8b1631f142.tar.bz2
libbu++-4309066dff46f52690998bbd1f60ec8b1631f142.tar.xz
libbu++-4309066dff46f52690998bbd1f60ec8b1631f142.zip
We have the new Bu::CryptoHash base class and Bu::Md5 is here and ready
to rock. sha1 is still only a shell, I dunno if/when I'm going to implement that one. So far Bu::Md5 is 100% compatible with md5sum in all tests performed so far, in fact the test program's output is compatible with md5sum in every way (and it's so cute and little too!) Oh, minor update for stdstream and the formatter, they can handle more handy types now.
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/md5.cpp27
-rw-r--r--src/tests/stdstream.cpp4
2 files changed, 29 insertions, 2 deletions
diff --git a/src/tests/md5.cpp b/src/tests/md5.cpp
new file mode 100644
index 0000000..dea957b
--- /dev/null
+++ b/src/tests/md5.cpp
@@ -0,0 +1,27 @@
1#include "bu/sio.h"
2#include "bu/file.h"
3#include "bu/md5.h"
4
5using Bu::sio;
6
7int main( int argc, char *argv[] )
8{
9 argv++, argc--;
10 for(; *argv; argv++ )
11 {
12 Bu::File fIn( *argv, Bu::File::Read );
13 Bu::Md5 m;
14
15 char buf[1000];
16 for(;;)
17 {
18 int iRead = fIn.read( buf, 1000 );
19 m.addData( buf, iRead );
20 if( iRead < 1000 )
21 break;
22 }
23
24 sio << m.getResult() << " *" << *argv << sio.nl;
25 }
26}
27
diff --git a/src/tests/stdstream.cpp b/src/tests/stdstream.cpp
index cb22e22..0949a8c 100644
--- a/src/tests/stdstream.cpp
+++ b/src/tests/stdstream.cpp
@@ -24,8 +24,8 @@ int main()
24 sio << 0.123 << sio.nl; 24 sio << 0.123 << sio.nl;
25 sio << true << " and then " << false << sio.nl; 25 sio << true << " and then " << false << sio.nl;
26 26
27 //for( int j = 2; j <= 36; j++ ) 27 for( int j = 2; j <= 36; j++ )
28 // sio << "radix(" << j << ") = " << Fmt().radix( j ) << 255 << sio.nl; 28 sio << "radix(" << j << ") = " << Fmt().radix( j ).width( 8 ).align( Fmt::Right ) << 255 << sio.nl;
29 29
30 return 0; 30 return 0;
31} 31}