From 474f374d2d9b16d32a451d47092119dfb414c244 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Wed, 10 May 2017 16:55:08 +0200 Subject: [PATCH] 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 b1eb477d9..bf797f2cb 100644 --- a/src/bank-lib/test_bank_interpreter.c +++ b/src/bank-lib/test_bank_interpreter.c @@ -334,6 +334,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;iaccount_details)) ) { GNUNET_break (0); + print_expected (h, total, off); free_history (h, total); return GNUNET_SYSERR;