diff options
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/test_amount.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/util/test_amount.c b/src/util/test_amount.c index 3f33334bc..640477156 100644 --- a/src/util/test_amount.c +++ b/src/util/test_amount.c @@ -73,6 +73,19 @@ main(int argc, GNUNET_assert (4 == a1.value); GNUNET_assert (0 == a1.fraction); + /* test conversion with leading zero in fraction */ + GNUNET_assert (GNUNET_OK == + TALER_string_to_amount ("eur:0.02", + &a2)); + GNUNET_assert (0 == strcasecmp ("eur", + a2.currency)); + GNUNET_assert (0 == a2.value); + GNUNET_assert (TALER_AMOUNT_FRAC_BASE / 100 * 2 == a2.fraction); + c = TALER_amount_to_string (&a2); + GNUNET_assert (0 == strcmp ("eur:0.02", + c)); + GNUNET_free (c); + /* test conversion with leading space and with fraction */ GNUNET_assert (GNUNET_OK == TALER_string_to_amount (" eur:4.12", |