gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [taler-exchange] branch master updated: improve history err


From: gnunet
Subject: [GNUnet-SVN] [taler-exchange] branch master updated: improve history error reporting by test
Date: Wed, 10 May 2017 16:53:43 +0200

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository exchange.

The following commit(s) were added to refs/heads/master by this push:
     new 474f374  improve history error reporting by test
474f374 is described below

commit 474f374d2d9b16d32a451d47092119dfb414c244
Author: Christian Grothoff <address@hidden>
AuthorDate: Wed May 10 16:55:08 2017 +0200

    improve history error reporting by test
---
 src/bank-lib/test_bank_interpreter.c | 42 ++++++++++++++++++++++++++++++++++--
 1 file changed, 40 insertions(+), 2 deletions(-)

diff --git a/src/bank-lib/test_bank_interpreter.c 
b/src/bank-lib/test_bank_interpreter.c
index b1eb477..bf797f2 100644
--- a/src/bank-lib/test_bank_interpreter.c
+++ b/src/bank-lib/test_bank_interpreter.c
@@ -335,6 +335,43 @@ build_history (struct InterpreterState *is,
 
 
 /**
+ * Log which history we expected.
+ *
+ * @param h what we expected
+ * @param h_len number of entries in @a h
+ * @param off position of the missmatch
+ */
+static void
+print_expected (struct History *h,
+                uint64_t h_len,
+                unsigned int off)
+{
+  GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+              "Transaction history missmatch at position %u/%llu\n",
+              off,
+              (unsigned long long) h_len);
+  GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+              "Expected history\n");
+  for (uint64_t i=0;i<h_len;i++)
+  {
+    char *acc;
+
+    acc = json_dumps (h[i].details.account_details,
+                      JSON_COMPACT);
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                "H(%llu): %s%s (serial: %llu, subject: %s, to: %s)\n",
+                (unsigned long long) i,
+                (TALER_BANK_DIRECTION_CREDIT == h[i].direction) ? "+" : "-",
+                TALER_amount2s (&h[i].details.amount),
+                (unsigned long long) h[i].serial_id,
+                h[i].details.wire_transfer_subject,
+                acc);
+    GNUNET_free_non_null (acc);
+  }
+}
+
+
+/**
  * Free history @a h of length @a h_len.
  *
  * @param h history array to free
@@ -402,13 +439,13 @@ check_result (struct InterpreterState *is,
                 "Test says history has at most %u results, but got result #%u 
to check\n",
                 (unsigned int) total,
                 off);
-    free_history (h,
-                  total);
+    print_expected (h, total, off);
     return GNUNET_SYSERR;
   }
   if (h[off].direction != dir)
   {
     GNUNET_break (0);
+    print_expected (h, total, off);
     free_history (h,
                   total);
     return GNUNET_SYSERR;
@@ -422,6 +459,7 @@ check_result (struct InterpreterState *is,
                          details->account_details)) )
   {
     GNUNET_break (0);
+    print_expected (h, total, off);
     free_history (h,
                   total);
     return GNUNET_SYSERR;

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]