From 608fd870746a39a82c06fe9904d050af778c57d8 Mon Sep 17 00:00:00 2001 From: Ji Lu Date: Sun, 8 Nov 2009 22:15:45 +0000 Subject: [PATCH] 98% test_bio.c --- src/util/test_bio.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/src/util/test_bio.c b/src/util/test_bio.c index 06dcfacc8..6fb132325 100644 --- a/src/util/test_bio.c +++ b/src/util/test_bio.c @@ -185,6 +185,19 @@ test_bigmeta_rw () return 0; } +static int +test_directory_r(void){ + char *msg; + char readResult[200]; + const char *fileName = "/dev"; + struct GNUNET_BIO_ReadHandle *fileR; + fileR = GNUNET_BIO_read_open (fileName); + GNUNET_assert (NULL != fileR); + GNUNET_assert (GNUNET_SYSERR == GNUNET_BIO_read (fileR, "Read error", readResult, 65537)); + GNUNET_BIO_read_close (fileR, &msg); + return 0; +} + static int test_nullfile_rw (void) { @@ -343,14 +356,14 @@ check_file_rw (void) { GNUNET_assert (0 == test_normal_rw ()); GNUNET_assert (0 == test_nullfile_rw ()); + GNUNET_assert (0 == test_directory_r()); return 0; } int -main (int argc, char *argv[]) -{ - GNUNET_assert (0 == check_file_rw ()); - GNUNET_assert (0 == check_metadata_rw ()); - GNUNET_assert (0 == check_string_rw ()); - return 0; +main (int argc, char *argv[]){ + GNUNET_assert (0 == check_file_rw()); + GNUNET_assert (0 == check_metadata_rw()); + GNUNET_assert (0 == check_string_rw()); + return 0; } /* end of main */ -- 2.25.1