getting test to pass

This commit is contained in:
Christian Grothoff 2015-05-15 14:46:03 +02:00
parent 955054bf25
commit 85f198ef32
4 changed files with 5 additions and 16 deletions

View File

@ -179,7 +179,7 @@ TALER_PQ_QUERY_PARAM_RSA_SIGNATURE(const struct GNUNET_CRYPTO_rsa_Signature *x);
* @param x pointer to the query parameter to pass * @param x pointer to the query parameter to pass
*/ */
struct TALER_PQ_QueryParam struct TALER_PQ_QueryParam
TALER_PQ_QUERY_PARAM_ABSOLUTE_TIME(struct GNUNET_TIME_Absolute x); TALER_PQ_QUERY_PARAM_ABSOLUTE_TIME(const struct GNUNET_TIME_Absolute *x);
/** /**

View File

@ -178,8 +178,6 @@ TALER_PQ_exec_prepared (PGconn *db_conn,
at_nbo = GNUNET_new (struct GNUNET_TIME_AbsoluteNBO); at_nbo = GNUNET_new (struct GNUNET_TIME_AbsoluteNBO);
scratch[soff++] = at_nbo; scratch[soff++] = at_nbo;
/* FIXME: this does not work for 'forever' as PQ uses 63-bit integers;
should check and handle! (Need testcase!) */
*at_nbo = GNUNET_TIME_absolute_hton (*at_hbo); *at_nbo = GNUNET_TIME_absolute_hton (*at_hbo);
param_values[off] = (void *) at_nbo; param_values[off] = (void *) at_nbo;
param_lengths[off] = sizeof (struct GNUNET_TIME_AbsoluteNBO); param_lengths[off] = sizeof (struct GNUNET_TIME_AbsoluteNBO);
@ -537,8 +535,6 @@ TALER_PQ_extract_result (PGresult *result,
PQgetvalue (result, PQgetvalue (result,
row, row,
fnum); fnum);
/* FIXME: this does not work for 'forever' as PQ uses 63-bit integers;
should check and handle! (Need testcase!) */
*dst = GNUNET_TIME_absolute_ntoh (*res); *dst = GNUNET_TIME_absolute_ntoh (*res);
break; break;
} }

View File

@ -99,10 +99,10 @@ TALER_PQ_QUERY_PARAM_RSA_SIGNATURE (const struct GNUNET_CRYPTO_rsa_Signature *x)
* @return array entry for the query parameters to use * @return array entry for the query parameters to use
*/ */
struct TALER_PQ_QueryParam struct TALER_PQ_QueryParam
TALER_PQ_QUERY_PARAM_ABSOLUTE_TIME (struct GNUNET_TIME_Absolute x) TALER_PQ_QUERY_PARAM_ABSOLUTE_TIME (const struct GNUNET_TIME_Absolute *x)
{ {
struct TALER_PQ_QueryParam res = struct TALER_PQ_QueryParam res =
{ TALER_PQ_QF_TIME_ABSOLUTE, &(x), sizeof (x) }; { TALER_PQ_QF_TIME_ABSOLUTE, x, sizeof (*x) };
return res; return res;
} }

View File

@ -129,8 +129,8 @@ run_queries (PGconn *conn)
struct TALER_PQ_QueryParam params_insert[] = { struct TALER_PQ_QueryParam params_insert[] = {
TALER_PQ_QUERY_PARAM_RSA_PUBLIC_KEY (pub), TALER_PQ_QUERY_PARAM_RSA_PUBLIC_KEY (pub),
TALER_PQ_QUERY_PARAM_RSA_SIGNATURE (sig), TALER_PQ_QUERY_PARAM_RSA_SIGNATURE (sig),
TALER_PQ_QUERY_PARAM_ABSOLUTE_TIME (abs_time), TALER_PQ_QUERY_PARAM_ABSOLUTE_TIME (&abs_time),
TALER_PQ_QUERY_PARAM_ABSOLUTE_TIME (forever), TALER_PQ_QUERY_PARAM_ABSOLUTE_TIME (&forever),
TALER_PQ_QUERY_PARAM_PTR (&hc), TALER_PQ_QUERY_PARAM_PTR (&hc),
TALER_PQ_QUERY_PARAM_AMOUNT (&hamount), TALER_PQ_QUERY_PARAM_AMOUNT (&hamount),
TALER_PQ_QUERY_PARAM_AMOUNT_NBO (&namount), TALER_PQ_QUERY_PARAM_AMOUNT_NBO (&namount),
@ -150,8 +150,6 @@ run_queries (PGconn *conn)
TALER_PQ_RESULT_SPEC_END TALER_PQ_RESULT_SPEC_END
}; };
fprintf (stderr,
"Inserting\n");
result = TALER_PQ_exec_prepared (conn, result = TALER_PQ_exec_prepared (conn,
"test_insert", "test_insert",
params_insert); params_insert);
@ -168,8 +166,6 @@ run_queries (PGconn *conn)
} }
PQclear (result); PQclear (result);
fprintf (stderr,
"Selecting\n");
result = TALER_PQ_exec_prepared (conn, result = TALER_PQ_exec_prepared (conn,
"test_select", "test_select",
params_select); params_select);
@ -187,8 +183,6 @@ run_queries (PGconn *conn)
results_select, results_select,
0); 0);
GNUNET_break (GNUNET_YES == ret); GNUNET_break (GNUNET_YES == ret);
fprintf (stderr,
"Verifying\n");
GNUNET_break (abs_time.abs_value_us == abs_time2.abs_value_us); GNUNET_break (abs_time.abs_value_us == abs_time2.abs_value_us);
GNUNET_break (forever.abs_value_us == forever2.abs_value_us); GNUNET_break (forever.abs_value_us == forever2.abs_value_us);
GNUNET_break (0 == GNUNET_break (0 ==
@ -233,7 +227,6 @@ main(int argc,
PGresult *result; PGresult *result;
int ret; int ret;
// FIXME: pass valid connect string for tests...
GNUNET_log_setup ("test-pq", GNUNET_log_setup ("test-pq",
"WARNING", "WARNING",
NULL); NULL);