diff options
Diffstat (limited to 'src/tests')
-rw-r--r-- | src/tests/fstring.cpp | 2 | ||||
-rw-r--r-- | src/tests/md5test.cpp | 19 |
2 files changed, 17 insertions, 4 deletions
diff --git a/src/tests/fstring.cpp b/src/tests/fstring.cpp index 271738c..92f8cc4 100644 --- a/src/tests/fstring.cpp +++ b/src/tests/fstring.cpp | |||
@@ -18,7 +18,7 @@ void thing( FString str ) | |||
18 | } | 18 | } |
19 | 19 | ||
20 | #define pem printf("---------\n%08X: %s\n%08X: %s\n", (unsigned int)str.c_str(), str.c_str(), (unsigned int)str2.c_str(), str2.c_str() ); | 20 | #define pem printf("---------\n%08X: %s\n%08X: %s\n", (unsigned int)str.c_str(), str.c_str(), (unsigned int)str2.c_str(), str2.c_str() ); |
21 | int main( int argc, char *argv ) | 21 | int main( int argc, char **argv ) |
22 | { | 22 | { |
23 | FString str("th"); | 23 | FString str("th"); |
24 | 24 | ||
diff --git a/src/tests/md5test.cpp b/src/tests/md5test.cpp index 6f832df..2cc8868 100644 --- a/src/tests/md5test.cpp +++ b/src/tests/md5test.cpp | |||
@@ -2,18 +2,31 @@ | |||
2 | #include <string.h> | 2 | #include <string.h> |
3 | #include "md5.h" | 3 | #include "md5.h" |
4 | 4 | ||
5 | int main() | 5 | #include <sys/types.h> |
6 | #include <sys/stat.h> | ||
7 | #include <unistd.h> | ||
8 | |||
9 | |||
10 | int main( int argc, char *argv[] ) | ||
6 | { | 11 | { |
7 | md5 mproc; | 12 | md5 mproc; |
8 | md5sum sum; | 13 | md5sum sum; |
9 | char hexstr[33]; | 14 | char hexstr[33]; |
10 | 15 | ||
16 | struct stat s; | ||
17 | stat( argv[1], &s ); | ||
18 | char *buf = new char[s.st_size]; | ||
19 | FILE *fh = fopen( argv[1], "rb" ); | ||
20 | fread( buf, 1, s.st_size, fh ); | ||
21 | fclose( fh ); | ||
22 | |||
11 | memset( hexstr, 0, 33 ); | 23 | memset( hexstr, 0, 33 ); |
12 | 24 | ||
13 | mproc.sumString( &sum, "qwertyuiopasdfgh" ); | 25 | mproc.sumData( &sum, buf, s.st_size ); |
14 | mproc.sumToHex( &sum, hexstr ); | 26 | mproc.sumToHex( &sum, hexstr ); |
15 | printf("sum: %s\n", hexstr ); | 27 | printf("sum: %s\n", hexstr ); |
16 | printf("chk: 1ebfc043d8880b758b13ddc8aa1638ef\n"); | 28 | |
29 | delete[] buf; | ||
17 | 30 | ||
18 | return 0; | 31 | return 0; |
19 | } | 32 | } |