diff options
Diffstat (limited to 'src/util/test_bio.c')
-rw-r--r-- | src/util/test_bio.c | 37 |
1 files changed, 27 insertions, 10 deletions
diff --git a/src/util/test_bio.c b/src/util/test_bio.c index c4c838675..ed51cb849 100644 --- a/src/util/test_bio.c +++ b/src/util/test_bio.c | |||
@@ -23,23 +23,40 @@ | |||
23 | * @brief testcase for the buffered IO module | 23 | * @brief testcase for the buffered IO module |
24 | * @author | 24 | * @author |
25 | */ | 25 | */ |
26 | |||
27 | |||
26 | #include "platform.h" | 28 | #include "platform.h" |
27 | #include "gnunet_common.h" | 29 | #include "gnunet_common.h" |
28 | #include "gnunet_disk_lib.h" | 30 | #include "gnunet_disk_lib.h" |
29 | #include "gnunet_scheduler_lib.h" | 31 | #include "gnunet_bio_lib.h" |
32 | |||
33 | int check(){ | ||
34 | |||
35 | int suc; | ||
36 | char* fileName = GNUNET_DISK_mktemp ("gnunet_bio"); | ||
37 | struct GNUNET_BIO_ReadHandle *fileR; | ||
38 | struct GNUNET_BIO_WriteHandle *fileW; | ||
39 | char *msg; | ||
40 | fileR = GNUNET_BIO_read_open (fileName); | ||
41 | GNUNET_BIO_read_close(fileR,&msg); | ||
42 | fileW = GNUNET_BIO_write_open(fileName); | ||
43 | if (GNUNET_OK == GNUNET_BIO_write_close(fileW)) | ||
44 | suc = 0; | ||
45 | else | ||
46 | suc = 1; | ||
47 | |||
48 | return suc; | ||
49 | |||
50 | |||
51 | } | ||
30 | 52 | ||
31 | 53 | ||
32 | 54 | ||
33 | int | 55 | int |
34 | main (int argc, char *argv[]) | 56 | main (int argc, char *argv[]) |
35 | { | 57 | { |
36 | unsigned int failureCount = 0; | 58 | |
37 | 59 | int ch = check(); | |
38 | GNUNET_log_setup ("test-bio", "WARNING", NULL); | 60 | return ch; |
39 | if (failureCount != 0) | 61 | |
40 | { | ||
41 | fprintf (stderr, "\n%u TESTS FAILED!\n", failureCount); | ||
42 | return -1; | ||
43 | } | ||
44 | return 0; | ||
45 | } /* end of main */ | 62 | } /* end of main */ |