// `data_structures/test.c` is the source for testing data structure code.
// Standard library includes.
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <stdint.h>
// Local includes.
#include "../algorithms/linear_congruential_gen.h"
key = malloc(sizeof(int32_t));
*value = idx;
*key = idx;
- simple_archiver_hash_map_insert(hash_map, value, key, sizeof(int32_t), NULL,
- NULL);
+ simple_archiver_hash_map_insert(hash_map, value, key, sizeof(int32_t),
+ NULL, NULL);
}
}
CHECK_TRUE(simple_archiver_hash_map_iter(hash_map, hash_map_iter_check_fn,
found) == 0);
- for (uint32_t idx = 0; idx < SDARCHIVER_DS_TEST_HASH_MAP_ITER_SIZE;
- ++idx) {
+ for (uint32_t idx = 0; idx < SDARCHIVER_DS_TEST_HASH_MAP_ITER_SIZE; ++idx) {
CHECK_TRUE(found[idx] == 1);
}
CHECK_TRUE(simple_archiver_hash_map_iter(hash_map, hash_map_iter_check_fn2,
found) == 2);
- for (uint32_t idx = 0; idx < SDARCHIVER_DS_TEST_HASH_MAP_ITER_SIZE;
- ++idx) {
+ for (uint32_t idx = 0; idx < SDARCHIVER_DS_TEST_HASH_MAP_ITER_SIZE; ++idx) {
CHECK_TRUE(found[idx] == 1);
}
// Deterministic randomization.
for (uint32_t idx = max - 1; idx-- > 0;) {
uint32_t other_idx = simple_archiver_algo_lcg_defaults(idx) %
- (unsigned long long)(idx + 1);
+ (unsigned long long)(idx + 1);
if (max - 1 != other_idx) {
uint32_t temp = array[max - 1];
array[max - 1] = array[other_idx];
// Deterministic randomization.
for (uint32_t idx = max - 1; idx-- > 0;) {
uint32_t other_idx = simple_archiver_algo_lcg_defaults(idx) %
- (unsigned long long)(idx + 1);
+ (unsigned long long)(idx + 1);
if (max - 1 != other_idx) {
uint32_t temp = array[max - 1];
array[max - 1] = array[other_idx];