aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-11-18 18:39:41 +0100
committerChristian Grothoff <christian@grothoff.org>2016-11-18 18:39:41 +0100
commiteaa0065e895bb1e3b25fef1439c606433ae4be51 (patch)
treebde97465910ffdea52a757b118471556dc4ab2fe
parenta58a12866221cba8cc724e135bb66c9d6e613fe2 (diff)
make adjustments to tests from fraction 1e-6 to 1e-8 change
-rw-r--r--src/backend/taler-merchant-httpd_parsing.c11
-rw-r--r--src/lib/test_merchant_api.c42
2 files changed, 30 insertions, 23 deletions
diff --git a/src/backend/taler-merchant-httpd_parsing.c b/src/backend/taler-merchant-httpd_parsing.c
index 34ea2f92..754ea902 100644
--- a/src/backend/taler-merchant-httpd_parsing.c
+++ b/src/backend/taler-merchant-httpd_parsing.c
@@ -84,8 +84,15 @@ buffer_init (struct Buffer *buf,
return GNUNET_SYSERR;
if (data_size > alloc_size)
alloc_size = data_size;
+ if (0 == alloc_size)
+ {
+ buf->data = NULL;
+ return GNUNET_OK;
+ }
buf->data = GNUNET_malloc (alloc_size);
- memcpy (buf->data, data, data_size);
+ GNUNET_memcpy (buf->data,
+ data,
+ data_size);
return GNUNET_OK;
}
@@ -99,7 +106,7 @@ buffer_init (struct Buffer *buf,
static void
buffer_deinit (struct Buffer *buf)
{
- GNUNET_free (buf->data);
+ GNUNET_free_non_null (buf->data);
buf->data = NULL;
}
diff --git a/src/lib/test_merchant_api.c b/src/lib/test_merchant_api.c
index 64630026..b61a44b1 100644
--- a/src/lib/test_merchant_api.c
+++ b/src/lib/test_merchant_api.c
@@ -53,7 +53,7 @@
/**
* Max size allowed for a contract
*/
-#define CONTRACT_MAX_SIZE 500
+#define CONTRACT_MAX_SIZE 1000
/**
* Handle to access the exchange.
@@ -541,16 +541,16 @@ struct Command
* How many "rows" we expect in the result
*/
unsigned int nresult;
-
+
/**
* Handle to the merchant
*/
-
+
/**
* Handle to /history request
*/
struct TALER_MERCHANT_HistoryOperation *ho;
-
+
} history;
@@ -626,7 +626,7 @@ get_new_contracts (struct Command *cmds)
unsigned int d = 0;
struct Command *cmd;
#define DELTA 1000
-
+
for (i=0;OC_END != (cmd = &cmds[i])->oc;i++)
if ( (NULL != cmd->label) &&
(OC_CONTRACT == cmd->oc) )
@@ -639,7 +639,7 @@ get_new_contracts (struct Command *cmds)
CONTRACT_MAX_SIZE,
"{\
\"max_fee\":\
- {\"currency\":\"EUR\", \"value\":0, \"fraction\":500000},\
+ {\"currency\":\"EUR\", \"value\":0, \"fraction\":50000000},\
\"transaction_id\":%d,\
\"timestamp\":\"\\/Date(42)\\/\",\
\"refund_deadline\":\"\\/Date(0)\\/\",\
@@ -766,13 +766,13 @@ history_cb (void *cls,
if (nelements != (cmd->details.history.nresult * (instance_idx + 1)))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Did not get as many history entries as expected\n");
+ "Did not get as many history entries as expected\n");
fail (is);
return;
}
next_command (is);
-}
+}
/**
* Check if the given historic event @a h corresponds to the given
@@ -1099,11 +1099,11 @@ pay_cb (void *cls,
}
if (MHD_HTTP_OK == http_status)
{
- /* Check signature */
+ /* Check signature */
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_fixed_auto ("merchant_sig", &sig),
GNUNET_JSON_spec_fixed_auto ("h_contract", &h_contract),
- GNUNET_JSON_spec_end ()
+ GNUNET_JSON_spec_end ()
};
if (GNUNET_OK !=
GNUNET_JSON_parse (obj,
@@ -1133,9 +1133,9 @@ pay_cb (void *cls,
fail (is);
return;
}
-
+
}
-
+
next_command (is);
}
@@ -1642,7 +1642,7 @@ interpreter_run (void *cls)
&error);
if (NULL != instance)
{
-
+
json_t *merchant;
merchant = json_object ();
@@ -1904,11 +1904,11 @@ interpreter_run (void *cls)
history_cb,
is)))
{
- fail (is);
+ fail (is);
return;
- }
- break;
-
+ }
+ break;
+
default:
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Unknown instruction %d at %u (%s)\n",
@@ -2061,7 +2061,7 @@ do_shutdown (void *cls)
}
break;
case OC_HISTORY:
-
+
if (NULL != cmd->details.history.ho)
{
TALER_MERCHANT_history_cancel (cmd->details.history.ho);
@@ -2196,7 +2196,7 @@ run (void *cls)
.expected_response_code = MHD_HTTP_OK,
.details.contract.proposal = "{\
\"max_fee\":\
- {\"currency\":\"EUR\", \"value\":0, \"fraction\":500000},\
+ {\"currency\":\"EUR\", \"value\":0, \"fraction\":50000000},\
\"transaction_id\":1,\
\"timestamp\":\"\\/Date(42)\\/\",\
\"refund_deadline\":\"\\/Date(0)\\/\",\
@@ -2219,7 +2219,7 @@ run (void *cls)
.expected_response_code = MHD_HTTP_OK,
.details.contract.proposal = "{\
\"max_fee\":\
- {\"currency\":\"EUR\", \"value\":0, \"fraction\":500000},\
+ {\"currency\":\"EUR\", \"value\":0, \"fraction\":50000000},\
\"transaction_id\":2,\
\"timestamp\":\"\\/Date(42)\\/\",\
\"refund_deadline\":\"\\/Date(0)\\/\",\
@@ -2463,7 +2463,7 @@ main (int argc,
GNUNET_array_append (instances, ninstances, token);
while (NULL != (token = strtok (NULL, " ")))
- GNUNET_array_append(instances, ninstances, token);
+ GNUNET_array_append(instances, ninstances, token);
instance = instances[instance_idx];
db = TALER_MERCHANTDB_plugin_load (cfg);