aboutsummaryrefslogtreecommitdiff
path: root/src/json
diff options
context:
space:
mode:
authorMS <ms@taler.net>2020-06-10 11:01:27 +0200
committerMS <ms@taler.net>2020-06-10 11:02:04 +0200
commit3d1dc57bd8629b70fbe738db69caa785a47d610f (patch)
tree161af01e3ef4300127f042d3aa30cd6d6e0a52ad /src/json
parent2256f319479df8b5769041865af4ae4bfc2e6a41 (diff)
IBAN parsing test.
Diffstat (limited to 'src/json')
-rw-r--r--src/json/test_json_wire.c33
1 files changed, 23 insertions, 10 deletions
diff --git a/src/json/test_json_wire.c b/src/json/test_json_wire.c
index 2725173b2..27de0691b 100644
--- a/src/json/test_json_wire.c
+++ b/src/json/test_json_wire.c
@@ -30,9 +30,12 @@ main (int argc,
{
struct TALER_MasterPublicKeyP master_pub;
struct TALER_MasterPrivateKeyP master_priv;
- json_t *wire;
- const char *payto = "payto://x-taler-bank/42";
- char *p;
+ json_t *wire_xtalerbank;
+ json_t *wire_iban;
+ const char *payto_xtalerbank = "payto://x-taler-bank/42";
+ const char *payto_iban = "payto://iban/DE89370400440532013000";
+ char *p_xtalerbank;
+ char *p_iban;
(void) argc;
(void) argv;
@@ -42,15 +45,25 @@ main (int argc,
GNUNET_CRYPTO_eddsa_key_create (&master_priv.eddsa_priv);
GNUNET_CRYPTO_eddsa_key_get_public (&master_priv.eddsa_priv,
&master_pub.eddsa_pub);
- wire = TALER_JSON_exchange_wire_signature_make (payto,
- &master_priv);
- p = TALER_JSON_wire_to_payto (wire);
- GNUNET_assert (0 == strcmp (p, payto));
- GNUNET_free (p);
+ wire_xtalerbank = TALER_JSON_exchange_wire_signature_make (payto_xtalerbank,
+ &master_priv);
+ wire_iban = TALER_JSON_exchange_wire_signature_make (payto_iban,
+ &master_priv);
+ p_xtalerbank = TALER_JSON_wire_to_payto (wire_xtalerbank);
+ p_iban = TALER_JSON_wire_to_payto (wire_iban);
+ GNUNET_assert (0 == strcmp (p_xtalerbank, payto_xtalerbank));
+ GNUNET_assert (0 == strcmp (p_iban, payto_iban));
+ GNUNET_free (p_xtalerbank);
+ GNUNET_free (p_iban);
+
+ GNUNET_assert (GNUNET_OK ==
+ TALER_JSON_exchange_wire_signature_check (wire_xtalerbank,
+ &master_pub));
GNUNET_assert (GNUNET_OK ==
- TALER_JSON_exchange_wire_signature_check (wire,
+ TALER_JSON_exchange_wire_signature_check (wire_iban,
&master_pub));
- json_decref (wire);
+ json_decref (wire_xtalerbank);
+ json_decref (wire_iban);
return 0;
}