summaryrefslogtreecommitdiff
path: root/src/util/test_amount.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/test_amount.c')
-rw-r--r--src/util/test_amount.c37
1 files changed, 28 insertions, 9 deletions
diff --git a/src/util/test_amount.c b/src/util/test_amount.c
index b5a21ebe7..2fd8ce6a8 100644
--- a/src/util/test_amount.c
+++ b/src/util/test_amount.c
@@ -236,24 +236,25 @@ main (int argc,
GNUNET_assert (1 == a2.fraction);
/* test rounding #1 */
-
GNUNET_assert (GNUNET_OK ==
TALER_string_to_amount ("EUR:0.01",
&r));
-
GNUNET_assert (GNUNET_OK ==
TALER_string_to_amount ("EUR:4.001",
&a1));
GNUNET_assert (GNUNET_OK ==
TALER_string_to_amount ("EUR:4",
&a2));
-
- GNUNET_assert (GNUNET_OK == TALER_amount_round_down (&a1, &r));
- GNUNET_assert (GNUNET_NO == TALER_amount_round_down (&a1, &r));
- GNUNET_assert (0 == TALER_amount_cmp (&a1, &a2));
+ GNUNET_assert (GNUNET_OK ==
+ TALER_amount_round_down (&a1,
+ &r));
+ GNUNET_assert (GNUNET_NO ==
+ TALER_amount_round_down (&a1,
+ &r));
+ GNUNET_assert (0 == TALER_amount_cmp (&a1,
+ &a2));
/* test rounding #2 */
-
GNUNET_assert (GNUNET_OK ==
TALER_string_to_amount ("EUR:0.001",
&r));
@@ -264,9 +265,27 @@ main (int argc,
GNUNET_assert (GNUNET_OK ==
TALER_string_to_amount ("EUR:4.001",
&a2));
- GNUNET_assert (GNUNET_NO == TALER_amount_round_down (&a1, &r));
- GNUNET_assert (0 == TALER_amount_cmp (&a1, &a2));
+ GNUNET_assert (GNUNET_NO ==
+ TALER_amount_round_down (&a1,
+ &r));
+ GNUNET_assert (0 == TALER_amount_cmp (&a1,
+ &a2));
+ /* test rounding #3 */
+ GNUNET_assert (GNUNET_OK ==
+ TALER_string_to_amount ("BTC:5",
+ &r));
+ GNUNET_assert (GNUNET_OK ==
+ TALER_string_to_amount ("BTC:12.3",
+ &a1));
+ GNUNET_assert (GNUNET_OK ==
+ TALER_string_to_amount ("BTC:10",
+ &a2));
+ GNUNET_assert (GNUNET_OK ==
+ TALER_amount_round_down (&a1,
+ &r));
+ GNUNET_assert (0 == TALER_amount_cmp (&a1,
+ &a2));
return 0;
}