-do not run test without sqlite
[oweals/gnunet.git] / src / psycstore / test_plugin_psycstore.c
index a6c456fec41a5c0bc99812188e8a84a412fd15f5..0a7824929e74dc38e47286bab71ee18a9f6bc07a 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * This file is part of GNUnet
- * (C) 2013 Christian Grothoff (and other contributing authors)
+ * Copyright (C) 2013 Christian Grothoff (and other contributing authors)
  *
  * GNUnet is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published
@@ -14,8 +14,8 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with GNUnet; see the file COPYING.  If not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
  */
 
 /*
@@ -85,7 +85,7 @@ load_plugin (const struct GNUNET_CONFIGURATION_Handle *cfg)
   struct GNUNET_PSYCSTORE_PluginFunctions *ret;
   char *libname;
 
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Loading `%s' psycstore plugin\n"),
+  GNUNET_log (GNUNET_ERROR_TYPE_INFO, _ ("Loading `%s' psycstore plugin\n"),
               plugin_name);
   GNUNET_asprintf (&libname, "libgnunet_plugin_psycstore_%s", plugin_name);
   if (NULL == (ret = GNUNET_PLUGIN_load (libname, (void*) cfg)))
@@ -224,7 +224,8 @@ run (void *cls, char *const *args, const char *cfgfile,
                              - sizeof (msg->hop_counter)
                              - sizeof (msg->signature));
   msg->purpose.purpose = htonl (234);
-  GNUNET_CRYPTO_eddsa_sign (channel_key, &msg->purpose, &msg->signature);
+  GNUNET_assert (GNUNET_OK ==
+                 GNUNET_CRYPTO_eddsa_sign (channel_key, &msg->purpose, &msg->signature));
 
   struct FragmentClosure fcls = { 0 };
   fcls.n = 0;
@@ -305,15 +306,17 @@ run (void *cls, char *const *args, const char *cfgfile,
 
   message_id = GNUNET_ntohll (fcls.msg[0]->message_id) + 1;
   GNUNET_assert (GNUNET_OK == db->state_modify_begin (db->cls, &channel_pub_key,
-                                                      message_id, 1));
+                                                      message_id, 0));
 
-  GNUNET_assert (GNUNET_OK == db->state_modify_set (db->cls, &channel_pub_key,
-                                                    "_foo",
-                                                    C2ARG("one two three")));
+  GNUNET_assert (GNUNET_OK == db->state_modify_op (db->cls, &channel_pub_key,
+                                                   GNUNET_ENV_OP_ASSIGN,
+                                                   "_foo",
+                                                   C2ARG("one two three")));
 
-  GNUNET_assert (GNUNET_OK == db->state_modify_set (db->cls, &channel_pub_key,
-                                                    "_foo_bar", slave_key,
-                                                    sizeof (*slave_key)));
+  GNUNET_assert (GNUNET_OK == db->state_modify_op (db->cls, &channel_pub_key,
+                                                   GNUNET_ENV_OP_ASSIGN,
+                                                   "_foo_bar", slave_key,
+                                                   sizeof (*slave_key)));
 
   GNUNET_assert (GNUNET_OK == db->state_modify_end (db->cls, &channel_pub_key,
                                                     message_id));
@@ -365,15 +368,16 @@ run (void *cls, char *const *args, const char *cfgfile,
 
   GNUNET_assert (GNUNET_OK == db->state_sync_begin (db->cls, &channel_pub_key));
 
-  GNUNET_assert (GNUNET_OK == db->state_sync_set (db->cls, &channel_pub_key,
-                                                  "_sync_bar", scls.value[0],
-                                                  scls.value_size[0]));
+  GNUNET_assert (GNUNET_OK == db->state_sync_assign (db->cls, &channel_pub_key,
+                                                     "_sync_bar", scls.value[0],
+                                                     scls.value_size[0]));
 
-  GNUNET_assert (GNUNET_OK == db->state_sync_set (db->cls, &channel_pub_key,
-                                                  "_sync_foo", scls.value[1],
-                                                  scls.value_size[1]));
+  GNUNET_assert (GNUNET_OK == db->state_sync_assign (db->cls, &channel_pub_key,
+                                                     "_sync_foo", scls.value[1],
+                                                     scls.value_size[1]));
 
   GNUNET_assert (GNUNET_OK == db->state_sync_end (db->cls, &channel_pub_key,
+                                                  max_state_msg_id,
                                                   INT64_MAX - 5));
 
   GNUNET_assert (GNUNET_NO == db->state_get_prefix (db->cls, &channel_pub_key,
@@ -393,11 +397,13 @@ run (void *cls, char *const *args, const char *cfgfile,
 
   message_id = GNUNET_ntohll (fcls.msg[0]->message_id) + 6;
   GNUNET_assert (GNUNET_OK == db->state_modify_begin (db->cls, &channel_pub_key,
-                                                      message_id, 3));
+                                                      message_id,
+                                                      message_id - max_state_msg_id));
 
-  GNUNET_assert (GNUNET_OK == db->state_modify_set (db->cls, &channel_pub_key,
-                                                    "_sync_foo",
-                                                    C2ARG("five six seven")));
+  GNUNET_assert (GNUNET_OK == db->state_modify_op (db->cls, &channel_pub_key,
+                                                   GNUNET_ENV_OP_ASSIGN,
+                                                   "_sync_foo",
+                                                   C2ARG("five six seven")));
 
   GNUNET_assert (GNUNET_OK == db->state_modify_end (db->cls, &channel_pub_key,
                                                     message_id));