expose our hello to plugins
[oweals/gnunet.git] / src / fs / test_fs_directory.c
index 1f77dcf1499f02c5cbc7852388d3c2431fcec02e..b32628b730b26c59d93889c0affbc340eb95f214 100644 (file)
@@ -4,7 +4,7 @@
 
      GNUnet is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
-     by the Free Software Foundation; either version 2, or (at your
+     by the Free Software Foundation; either version 3, or (at your
      option) any later version.
 
      GNUnet is distributed in the hope that it will be useful, but
@@ -89,8 +89,20 @@ testDirectory (unsigned int i)
   uris = GNUNET_malloc (sizeof (struct GNUNET_FS_Uri*) * i);
   mds = GNUNET_malloc (sizeof (struct GNUNET_CONTAINER_MetaData*) * i);
   meta = GNUNET_CONTAINER_meta_data_create ();
-  GNUNET_CONTAINER_meta_data_insert (meta, EXTRACTOR_TITLE, "A title");
-  GNUNET_CONTAINER_meta_data_insert (meta, EXTRACTOR_AUTHOR, "An author");
+  GNUNET_CONTAINER_meta_data_insert (meta, 
+                                    "<test>",
+                                    EXTRACTOR_METATYPE_TITLE,
+                                    EXTRACTOR_METAFORMAT_UTF8,
+                                    "text/plain",
+                                    "A title",
+                                    strlen("A title")+1);
+  GNUNET_CONTAINER_meta_data_insert (meta, 
+                                    "<test>",
+                                    EXTRACTOR_METATYPE_AUTHOR_NAME, 
+                                    EXTRACTOR_METAFORMAT_UTF8,
+                                    "text/plain",
+                                    "An author",
+                                    strlen ("An author")+1);
   for (p = 0; p < i; p++)
     {
       mds[p] = GNUNET_CONTAINER_meta_data_create ();
@@ -98,14 +110,18 @@ testDirectory (unsigned int i)
         {
           GNUNET_snprintf (txt, sizeof(txt), "%u -- %u\n", p, q);
           GNUNET_CONTAINER_meta_data_insert (mds[p],
-                                   q %
-                                   EXTRACTOR_getHighestKeywordTypeNumber
-                                   (), txt);
+                                            "<test>",
+                                            q % EXTRACTOR_metatype_get_max (),
+                                            EXTRACTOR_METAFORMAT_UTF8,
+                                            "text/plain",
+                                            txt,
+                                            strlen(txt)+1);
         }
       GNUNET_snprintf (uri,
                        sizeof(uri),
                        "gnunet://fs/chk/C282GG70GKK41O4551011DO413KFBVTVMQG1OG30I0K4045N0G41HAPB82G680A02JRVVFO8URVRU2F159011DO41000000022RG820.RNVVVVOOLCLK065B5D04HTNVNSIB2AI022RG8200HSLK1CO1000ATQ98824DMA2032LIMG50CG0K057NVUVG200000H000004400000.%u",
                        p);
+      emsg = NULL;
       uris[p] = GNUNET_FS_uri_parse (uri, &emsg);
       if (uris[p] == NULL)
         {
@@ -117,8 +133,11 @@ testDirectory (unsigned int i)
             }
           GNUNET_free (mds);
           GNUNET_free (uris);
+         GNUNET_free (emsg);
+         GNUNET_CONTAINER_meta_data_destroy (meta);
           ABORT ();             /* error in testcase */
         }
+      GNUNET_assert (emsg == NULL);
     }
   start = GNUNET_TIME_absolute_get ();
   db = GNUNET_FS_directory_builder_create (meta);
@@ -134,7 +153,7 @@ testDirectory (unsigned int i)
           (unsigned long long) dlen,
           s);
   GNUNET_free (s);
-  if (i < 1000)
+  if (i < 100)
     {
       cls.pos = 0;
       cls.uri = uris;
@@ -169,10 +188,8 @@ main (int argc, char *argv[])
                    "WARNING",
 #endif
                    NULL);
-  for (i = 17; i < 4000; i *= 2)
+  for (i = 17; i < 1000; i *= 2)
     failureCount += testDirectory (i);    
-  fprintf (stderr, "\n");
-
   if (failureCount != 0)
     return 1;
   return 0;