check return values

This commit is contained in:
Christian Grothoff 2015-05-18 20:18:37 +02:00
parent 7b4623706c
commit c742db86c4

View File

@ -54,10 +54,10 @@ postgres_prepare (PGconn *db_conn)
",abs_time" ",abs_time"
",forever" ",forever"
",hash" ",hash"
",hamount_val" ",hamount_val"
",hamount_frac" ",hamount_frac"
",hamount_curr" ",hamount_curr"
",namount_val" ",namount_val"
",namount_frac" ",namount_frac"
",namount_curr" ",namount_curr"
",vsize" ",vsize"
@ -72,10 +72,10 @@ postgres_prepare (PGconn *db_conn)
",abs_time" ",abs_time"
",forever" ",forever"
",hash" ",hash"
",hamount_val" ",hamount_val"
",hamount_frac" ",hamount_frac"
",hamount_curr" ",hamount_curr"
",namount_val" ",namount_val"
",namount_frac" ",namount_frac"
",namount_curr" ",namount_curr"
",vsize" ",vsize"
@ -116,18 +116,20 @@ run_queries (PGconn *conn)
char msg[] = "Hello"; char msg[] = "Hello";
void *msg2; void *msg2;
size_t msg2_len; size_t msg2_len;
priv = GNUNET_CRYPTO_rsa_private_key_create (1024); priv = GNUNET_CRYPTO_rsa_private_key_create (1024);
pub = GNUNET_CRYPTO_rsa_private_key_get_public (priv); pub = GNUNET_CRYPTO_rsa_private_key_get_public (priv);
sig = GNUNET_CRYPTO_rsa_sign (priv, sig = GNUNET_CRYPTO_rsa_sign (priv,
msg, msg,
sizeof (msg)); sizeof (msg));
TALER_string_to_amount ("EUR:5.5", GNUNET_assert (GNUNET_OK ==
&hamount); TALER_string_to_amount ("EUR:5.5",
&hamount));
TALER_amount_hton (&namount, TALER_amount_hton (&namount,
&hamount); &hamount);
TALER_string_to_amount ("EUR:4.4", GNUNET_assert (GNUNET_OK ==
&hamount); TALER_string_to_amount ("EUR:4.4",
&hamount));
/* FIXME: test TALER_PQ_result_spec_variable_size */ /* FIXME: test TALER_PQ_result_spec_variable_size */
{ {
struct TALER_PQ_QueryParam params_insert[] = { struct TALER_PQ_QueryParam params_insert[] = {
@ -155,7 +157,7 @@ run_queries (PGconn *conn)
TALER_PQ_result_spec_variable_size ("vsize", &msg2, &msg2_len), TALER_PQ_result_spec_variable_size ("vsize", &msg2, &msg2_len),
TALER_PQ_result_spec_end TALER_PQ_result_spec_end
}; };
result = TALER_PQ_exec_prepared (conn, result = TALER_PQ_exec_prepared (conn,
"test_insert", "test_insert",
params_insert); params_insert);
@ -170,7 +172,7 @@ run_queries (PGconn *conn)
GNUNET_CRYPTO_rsa_public_key_free (pub); GNUNET_CRYPTO_rsa_public_key_free (pub);
return 1; return 1;
} }
PQclear (result); PQclear (result);
result = TALER_PQ_exec_prepared (conn, result = TALER_PQ_exec_prepared (conn,
"test_select", "test_select",
@ -198,10 +200,11 @@ run_queries (PGconn *conn)
GNUNET_break (0 == GNUNET_break (0 ==
TALER_amount_cmp (&hamount, TALER_amount_cmp (&hamount,
&hamount2)); &hamount2));
TALER_string_to_amount ("EUR:5.5", GNUNET_assert (GNUNET_OK ==
&hamount); TALER_string_to_amount ("EUR:5.5",
&hamount));
TALER_amount_ntoh (&hamount2, TALER_amount_ntoh (&hamount2,
&namount2); &namount2);
GNUNET_break (0 == GNUNET_break (0 ==
TALER_amount_cmp (&hamount, TALER_amount_cmp (&hamount,
&hamount2)); &hamount2));
@ -225,7 +228,7 @@ run_queries (PGconn *conn)
GNUNET_CRYPTO_rsa_public_key_free (pub); GNUNET_CRYPTO_rsa_public_key_free (pub);
if (GNUNET_OK != ret) if (GNUNET_OK != ret)
return 1; return 1;
return 0; return 0;
} }