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.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/util/test_amount.c b/src/util/test_amount.c
index d9110eaf8..4eeccd7e0 100644
--- a/src/util/test_amount.c
+++ b/src/util/test_amount.c
@@ -234,6 +234,29 @@ main (int argc,
GNUNET_assert (0 == a2.value);
GNUNET_assert (1 == a2.fraction);
+ /* test rounding #1 */
+
+ 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, 2));
+ GNUNET_assert (GNUNET_NO == TALER_amount_round_down (&a1, 2));
+ GNUNET_assert (0 == TALER_amount_cmp (&a1, &a2));
+
+ /* test rounding #2 */
+
+ GNUNET_assert (GNUNET_OK ==
+ TALER_string_to_amount ("EUR:4.001",
+ &a1));
+ GNUNET_assert (GNUNET_OK ==
+ TALER_string_to_amount ("EUR:4.001",
+ &a2));
+ GNUNET_assert (GNUNET_NO == TALER_amount_round_down (&a1, 3));
+ GNUNET_assert (0 == TALER_amount_cmp (&a1, &a2));
return 0;
}