diff options
Diffstat (limited to 'src/bank-lib/testing_api_cmd_history.c')
-rw-r--r-- | src/bank-lib/testing_api_cmd_history.c | 87 |
1 files changed, 46 insertions, 41 deletions
diff --git a/src/bank-lib/testing_api_cmd_history.c b/src/bank-lib/testing_api_cmd_history.c index e69cd7c1a..c5b31197d 100644 --- a/src/bank-lib/testing_api_cmd_history.c +++ b/src/bank-lib/testing_api_cmd_history.c | |||
@@ -64,9 +64,9 @@ struct HistoryState | |||
64 | /** | 64 | /** |
65 | * How many rows we want in the result, _at most_. In | 65 | * How many rows we want in the result, _at most_. In |
66 | * the case of /history-range, we fake this value with | 66 | * the case of /history-range, we fake this value with |
67 | * INT64_MAX. | 67 | * UINT64_MAX. |
68 | */ | 68 | */ |
69 | long long num_results; | 69 | unsigned long long num_results; |
70 | 70 | ||
71 | /** | 71 | /** |
72 | * Handle to a pending "history" operation. | 72 | * Handle to a pending "history" operation. |
@@ -159,6 +159,10 @@ history_traits (void *cls, | |||
159 | const char *trait, | 159 | const char *trait, |
160 | unsigned int index) | 160 | unsigned int index) |
161 | { | 161 | { |
162 | (void) cls; | ||
163 | (void) ret; | ||
164 | (void) trait; | ||
165 | (void) index; | ||
162 | /* Must define this function because some callbacks | 166 | /* Must define this function because some callbacks |
163 | * look for certain traits on _all_ the commands. */ | 167 | * look for certain traits on _all_ the commands. */ |
164 | return GNUNET_SYSERR; | 168 | return GNUNET_SYSERR; |
@@ -184,7 +188,7 @@ test_cancelled (struct TALER_TESTING_Interpreter *is, | |||
184 | current_cmd = &is->commands[off]; | 188 | current_cmd = &is->commands[off]; |
185 | TALER_LOG_INFO ("Is `%s' rejected?\n", | 189 | TALER_LOG_INFO ("Is `%s' rejected?\n", |
186 | current_cmd->label); | 190 | current_cmd->label); |
187 | for (unsigned int i = 0; i<is->ip; i++) | 191 | for (int i = 0; i<is->ip; i++) |
188 | { | 192 | { |
189 | const struct TALER_TESTING_Command *c = &is->commands[i]; | 193 | const struct TALER_TESTING_Command *c = &is->commands[i]; |
190 | 194 | ||
@@ -290,13 +294,10 @@ build_history_hit_limit (uint64_t total, | |||
290 | TALER_TESTING_get_trait_absolute_time (pos, | 294 | TALER_TESTING_get_trait_absolute_time (pos, |
291 | 0, | 295 | 0, |
292 | ×tamp)); | 296 | ×tamp)); |
293 | |||
294 | GNUNET_assert (GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us != | 297 | GNUNET_assert (GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us != |
295 | hs->end_date.abs_value_us); | 298 | hs->end_date.abs_value_us); |
296 | |||
297 | return timestamp->abs_value_us >= hs->end_date.abs_value_us; | 299 | return timestamp->abs_value_us >= hs->end_date.abs_value_us; |
298 | } | 300 | } |
299 | |||
300 | return total >= hs->num_results; | 301 | return total >= hs->num_results; |
301 | } | 302 | } |
302 | 303 | ||
@@ -714,6 +715,7 @@ compute_result_count (struct TALER_TESTING_Interpreter *is) | |||
714 | return total; | 715 | return total; |
715 | } | 716 | } |
716 | 717 | ||
718 | |||
717 | /** | 719 | /** |
718 | * Check that the "/history" response matches the | 720 | * Check that the "/history" response matches the |
719 | * CMD whose offset in the list of CMDs is @a off. | 721 | * CMD whose offset in the list of CMDs is @a off. |
@@ -1017,9 +1019,8 @@ history_range_run (void *cls, | |||
1017 | * @param cmd the command which is being cleaned up. | 1019 | * @param cmd the command which is being cleaned up. |
1018 | */ | 1020 | */ |
1019 | static void | 1021 | static void |
1020 | history_cleanup | 1022 | history_cleanup (void *cls, |
1021 | (void *cls, | 1023 | const struct TALER_TESTING_Command *cmd) |
1022 | const struct TALER_TESTING_Command *cmd) | ||
1023 | { | 1024 | { |
1024 | struct HistoryState *hs = cls; | 1025 | struct HistoryState *hs = cls; |
1025 | 1026 | ||
@@ -1028,7 +1029,6 @@ history_cleanup | |||
1028 | TALER_LOG_WARNING ("/history did not complete\n"); | 1029 | TALER_LOG_WARNING ("/history did not complete\n"); |
1029 | TALER_BANK_history_cancel (hs->hh); | 1030 | TALER_BANK_history_cancel (hs->hh); |
1030 | } | 1031 | } |
1031 | |||
1032 | GNUNET_free (hs); | 1032 | GNUNET_free (hs); |
1033 | } | 1033 | } |
1034 | 1034 | ||
@@ -1041,13 +1041,12 @@ history_cleanup | |||
1041 | * operation. | 1041 | * operation. |
1042 | * @param account_no bank account number to ask the history for. | 1042 | * @param account_no bank account number to ask the history for. |
1043 | * @param direction which direction this operation is interested. | 1043 | * @param direction which direction this operation is interested. |
1044 | * @param ascending if GNUNET_YES, the bank will return the rows | 1044 | * @param ascending if #GNUNET_YES, the bank will return the rows |
1045 | * in ascending (= chronological) order. | 1045 | * in ascending (= chronological) order. |
1046 | * @param start_row_reference reference to a command that can | 1046 | * @param start_row_reference reference to a command that can |
1047 | * offer a row identifier, to be used as the starting row | 1047 | * offer a row identifier, to be used as the starting row |
1048 | * to accept in the result. | 1048 | * to accept in the result. |
1049 | * @param num_result how many rows we want in the result. | 1049 | * @param num_results how many rows we want in the result. |
1050 | * | ||
1051 | * @return the command. | 1050 | * @return the command. |
1052 | */ | 1051 | */ |
1053 | struct TALER_TESTING_Command | 1052 | struct TALER_TESTING_Command |
@@ -1058,7 +1057,7 @@ TALER_TESTING_cmd_bank_history | |||
1058 | enum TALER_BANK_Direction direction, | 1057 | enum TALER_BANK_Direction direction, |
1059 | unsigned int ascending, | 1058 | unsigned int ascending, |
1060 | const char *start_row_reference, | 1059 | const char *start_row_reference, |
1061 | long long num_results) | 1060 | unsigned long long num_results) |
1062 | { | 1061 | { |
1063 | struct HistoryState *hs; | 1062 | struct HistoryState *hs; |
1064 | 1063 | ||
@@ -1072,15 +1071,17 @@ TALER_TESTING_cmd_bank_history | |||
1072 | hs->start_date = GNUNET_TIME_UNIT_FOREVER_ABS; | 1071 | hs->start_date = GNUNET_TIME_UNIT_FOREVER_ABS; |
1073 | hs->end_date = GNUNET_TIME_UNIT_FOREVER_ABS; | 1072 | hs->end_date = GNUNET_TIME_UNIT_FOREVER_ABS; |
1074 | 1073 | ||
1075 | struct TALER_TESTING_Command cmd = { | 1074 | { |
1076 | .label = label, | 1075 | struct TALER_TESTING_Command cmd = { |
1077 | .cls = hs, | 1076 | .label = label, |
1078 | .run = &history_run, | 1077 | .cls = hs, |
1079 | .cleanup = &history_cleanup, | 1078 | .run = &history_run, |
1080 | .traits = &history_traits | 1079 | .cleanup = &history_cleanup, |
1081 | }; | 1080 | .traits = &history_traits |
1082 | 1081 | }; | |
1083 | return cmd; | 1082 | |
1083 | return cmd; | ||
1084 | } | ||
1084 | } | 1085 | } |
1085 | 1086 | ||
1086 | 1087 | ||
@@ -1124,15 +1125,17 @@ TALER_TESTING_cmd_bank_history_range | |||
1124 | hs->start_date = GNUNET_TIME_UNIT_FOREVER_ABS; | 1125 | hs->start_date = GNUNET_TIME_UNIT_FOREVER_ABS; |
1125 | hs->end_date = GNUNET_TIME_UNIT_FOREVER_ABS; | 1126 | hs->end_date = GNUNET_TIME_UNIT_FOREVER_ABS; |
1126 | 1127 | ||
1127 | struct TALER_TESTING_Command cmd = { | 1128 | { |
1128 | .label = label, | 1129 | struct TALER_TESTING_Command cmd = { |
1129 | .cls = hs, | 1130 | .label = label, |
1130 | .run = &history_range_run, | 1131 | .cls = hs, |
1131 | .cleanup = &history_cleanup, | 1132 | .run = &history_range_run, |
1132 | .traits = &history_traits | 1133 | .cleanup = &history_cleanup, |
1133 | }; | 1134 | .traits = &history_traits |
1134 | 1135 | }; | |
1135 | return cmd; | 1136 | |
1137 | return cmd; | ||
1138 | } | ||
1136 | } | 1139 | } |
1137 | 1140 | ||
1138 | 1141 | ||
@@ -1173,15 +1176,17 @@ TALER_TESTING_cmd_bank_history_range_with_dates | |||
1173 | hs->start_date = start_date; | 1176 | hs->start_date = start_date; |
1174 | hs->end_date = end_date; | 1177 | hs->end_date = end_date; |
1175 | 1178 | ||
1176 | struct TALER_TESTING_Command cmd = { | 1179 | { |
1177 | .label = label, | 1180 | struct TALER_TESTING_Command cmd = { |
1178 | .cls = hs, | 1181 | .label = label, |
1179 | .run = &history_range_run, | 1182 | .cls = hs, |
1180 | .cleanup = &history_cleanup, | 1183 | .run = &history_range_run, |
1181 | .traits = &history_traits | 1184 | .cleanup = &history_cleanup, |
1182 | }; | 1185 | .traits = &history_traits |
1183 | 1186 | }; | |
1184 | return cmd; | 1187 | |
1188 | return cmd; | ||
1189 | } | ||
1185 | } | 1190 | } |
1186 | 1191 | ||
1187 | /* end of testing_api_cmd_history.c */ | 1192 | /* end of testing_api_cmd_history.c */ |