98% test_bio.c
authorJi Lu <jilu@140774ce-b5e7-0310-ab8b-a85725594a96>
Sun, 8 Nov 2009 22:15:45 +0000 (22:15 +0000)
committerJi Lu <jilu@140774ce-b5e7-0310-ab8b-a85725594a96>
Sun, 8 Nov 2009 22:15:45 +0000 (22:15 +0000)
src/util/test_bio.c

index 06dcfacc8d29d3d9c384a36232a835de43f44a66..6fb13232545ec5ada194931bddc3e1daf859fc11 100644 (file)
@@ -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 */