get rid of SOCKTYPE and FDTYPE
[oweals/gnunet.git] / src / util / test_bio.c
index 65d10b6abc3bc9b7487de0491af90660bb6936e2..8ff93c168a8b907fbb19e7df078d0ae8bd36de0a 100644 (file)
      WITHOUT ANY WARRANTY; without even the implied warranty of
      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      Affero General Public License for more details.
-*/
+
+     You should have received a copy of the GNU Affero General Public License
+     along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+     SPDX-License-Identifier: AGPL3.0-or-later
+ */
 
 /**
  * @file util/test_bio.c
@@ -23,7 +28,7 @@
 #include "platform.h"
 #include "gnunet_util_lib.h"
 #define TESTSTRING "testString"
-#define TESTNUMBER64 ((int64_t)100000L)
+#define TESTNUMBER64 ((int64_t) 100000L)
 
 static int
 test_normal_rw ()
@@ -71,6 +76,7 @@ test_normal_rw ()
   return 0;
 }
 
+
 static int
 test_nullstring_rw ()
 {
@@ -98,6 +104,7 @@ test_nullstring_rw ()
   return 0;
 }
 
+
 static int
 test_emptystring_rw ()
 {
@@ -125,6 +132,7 @@ test_emptystring_rw ()
   return 0;
 }
 
+
 static int
 test_bigstring_rw ()
 {
@@ -154,6 +162,7 @@ test_bigstring_rw ()
   return 0;
 }
 
+
 static int
 test_bigmeta_rw ()
 {
@@ -164,12 +173,12 @@ test_bigmeta_rw ()
   char *fileName = GNUNET_DISK_mktemp ("gnunet_bio");
   struct GNUNET_CONTAINER_MetaData *metaDataR;
 
-  memset (meta, 'b', sizeof (meta));
-  meta[sizeof (meta) - 1] = '\0';
+  memset (meta, 'b', sizeof(meta));
+  meta[sizeof(meta) - 1] = '\0';
   fileW = GNUNET_BIO_write_open (fileName);
   GNUNET_assert (NULL != fileW);
-  GNUNET_assert (GNUNET_OK == GNUNET_BIO_write_int32 (fileW, sizeof (meta)));
-  GNUNET_assert (GNUNET_OK == GNUNET_BIO_write (fileW, meta, sizeof (meta)));
+  GNUNET_assert (GNUNET_OK == GNUNET_BIO_write_int32 (fileW, sizeof(meta)));
+  GNUNET_assert (GNUNET_OK == GNUNET_BIO_write (fileW, meta, sizeof(meta)));
   GNUNET_assert (GNUNET_OK == GNUNET_BIO_write_close (fileW));
 
   fileR = GNUNET_BIO_read_open (fileName);
@@ -187,6 +196,7 @@ test_bigmeta_rw ()
   return 0;
 }
 
+
 static int
 test_directory_r ()
 {
@@ -199,7 +209,7 @@ test_directory_r ()
   GNUNET_assert (NULL != fileR);
   GNUNET_assert (GNUNET_SYSERR ==
                  GNUNET_BIO_read (fileR, "Read error", readResult,
-                                  sizeof (readResult)));
+                                  sizeof(readResult)));
   msg = NULL;
   GNUNET_BIO_read_close (fileR, &msg);
   GNUNET_free (msg);
@@ -207,6 +217,7 @@ test_directory_r ()
   return 0;
 }
 
+
 static int
 test_nullfile_rw ()
 {
@@ -214,8 +225,8 @@ test_nullfile_rw ()
   struct GNUNET_BIO_WriteHandle *fileWNO;
   struct GNUNET_BIO_ReadHandle *fileRNO;
 
-  memset (fileNameNO, 'a', sizeof (fileNameNO));
-  fileNameNO[sizeof (fileNameNO) - 1] = '\0';
+  memset (fileNameNO, 'a', sizeof(fileNameNO));
+  fileNameNO[sizeof(fileNameNO) - 1] = '\0';
 
   GNUNET_log_skip (1, GNUNET_NO);
   fileWNO = GNUNET_BIO_write_open (fileNameNO);
@@ -263,7 +274,7 @@ test_fullfile_rw ()
   GNUNET_assert (NULL != fileR);
   GNUNET_assert (GNUNET_SYSERR ==
                  GNUNET_BIO_read (fileR, "Read error", readResult,
-                                  sizeof (readResult)));
+                                  sizeof(readResult)));
   readResultString = NULL;
   GNUNET_assert (GNUNET_SYSERR ==
                  GNUNET_BIO_read_string (fileR, "Read string error",
@@ -282,6 +293,7 @@ test_fullfile_rw ()
   return 0;
 }
 
+
 static int
 test_fakestring_rw ()
 {
@@ -310,6 +322,7 @@ test_fakestring_rw ()
   return 0;
 }
 
+
 static int
 test_fakemeta_rw ()
 {
@@ -340,6 +353,7 @@ test_fakemeta_rw ()
   return 0;
 }
 
+
 static int
 test_fakebigmeta_rw ()
 {
@@ -370,6 +384,7 @@ test_fakebigmeta_rw ()
   return 0;
 }
 
+
 static int
 check_string_rw ()
 {
@@ -380,6 +395,7 @@ check_string_rw ()
   return 0;
 }
 
+
 static int
 check_metadata_rw ()
 {
@@ -389,6 +405,7 @@ check_metadata_rw ()
   return 0;
 }
 
+
 static int
 check_file_rw ()
 {
@@ -399,6 +416,7 @@ check_file_rw ()
   return 0;
 }
 
+
 int
 main (int argc, char *argv[])
 {
@@ -409,4 +427,5 @@ main (int argc, char *argv[])
   return 0;
 }
 
+
 /* end of test_bio.c */