clang-format
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 4s
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 4s
This commit is contained in:
parent
bb574d2a2c
commit
5068a1b90d
4 changed files with 10 additions and 12 deletions
|
@ -20,8 +20,8 @@
|
||||||
#define SEODISPARATE_COM_SIMPLE_ARCHIVER_ARCHIVER_H_
|
#define SEODISPARATE_COM_SIMPLE_ARCHIVER_ARCHIVER_H_
|
||||||
|
|
||||||
// Standard library includes.
|
// Standard library includes.
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
// Local includes.
|
// Local includes.
|
||||||
#include "data_structures/hash_map.h"
|
#include "data_structures/hash_map.h"
|
||||||
|
|
|
@ -19,8 +19,8 @@
|
||||||
#include "linked_list.h"
|
#include "linked_list.h"
|
||||||
|
|
||||||
// Standard library includes.
|
// Standard library includes.
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
SDArchiverLinkedList *simple_archiver_list_init(void) {
|
SDArchiverLinkedList *simple_archiver_list_init(void) {
|
||||||
SDArchiverLinkedList *list = malloc(sizeof(SDArchiverLinkedList));
|
SDArchiverLinkedList *list = malloc(sizeof(SDArchiverLinkedList));
|
||||||
|
|
|
@ -17,10 +17,10 @@
|
||||||
// `data_structures/test.c` is the source for testing data structure code.
|
// `data_structures/test.c` is the source for testing data structure code.
|
||||||
|
|
||||||
// Standard library includes.
|
// Standard library includes.
|
||||||
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
// Local includes.
|
// Local includes.
|
||||||
#include "../algorithms/linear_congruential_gen.h"
|
#include "../algorithms/linear_congruential_gen.h"
|
||||||
|
@ -148,8 +148,8 @@ int main(void) {
|
||||||
key = malloc(sizeof(int32_t));
|
key = malloc(sizeof(int32_t));
|
||||||
*value = idx;
|
*value = idx;
|
||||||
*key = idx;
|
*key = idx;
|
||||||
simple_archiver_hash_map_insert(hash_map, value, key, sizeof(int32_t), NULL,
|
simple_archiver_hash_map_insert(hash_map, value, key, sizeof(int32_t),
|
||||||
NULL);
|
NULL, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -205,16 +205,14 @@ int main(void) {
|
||||||
CHECK_TRUE(simple_archiver_hash_map_iter(hash_map, hash_map_iter_check_fn,
|
CHECK_TRUE(simple_archiver_hash_map_iter(hash_map, hash_map_iter_check_fn,
|
||||||
found) == 0);
|
found) == 0);
|
||||||
|
|
||||||
for (uint32_t idx = 0; idx < SDARCHIVER_DS_TEST_HASH_MAP_ITER_SIZE;
|
for (uint32_t idx = 0; idx < SDARCHIVER_DS_TEST_HASH_MAP_ITER_SIZE; ++idx) {
|
||||||
++idx) {
|
|
||||||
CHECK_TRUE(found[idx] == 1);
|
CHECK_TRUE(found[idx] == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
CHECK_TRUE(simple_archiver_hash_map_iter(hash_map, hash_map_iter_check_fn2,
|
CHECK_TRUE(simple_archiver_hash_map_iter(hash_map, hash_map_iter_check_fn2,
|
||||||
found) == 2);
|
found) == 2);
|
||||||
|
|
||||||
for (uint32_t idx = 0; idx < SDARCHIVER_DS_TEST_HASH_MAP_ITER_SIZE;
|
for (uint32_t idx = 0; idx < SDARCHIVER_DS_TEST_HASH_MAP_ITER_SIZE; ++idx) {
|
||||||
++idx) {
|
|
||||||
CHECK_TRUE(found[idx] == 1);
|
CHECK_TRUE(found[idx] == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -289,7 +287,7 @@ int main(void) {
|
||||||
// Deterministic randomization.
|
// Deterministic randomization.
|
||||||
for (uint32_t idx = max - 1; idx-- > 0;) {
|
for (uint32_t idx = max - 1; idx-- > 0;) {
|
||||||
uint32_t other_idx = simple_archiver_algo_lcg_defaults(idx) %
|
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) {
|
if (max - 1 != other_idx) {
|
||||||
uint32_t temp = array[max - 1];
|
uint32_t temp = array[max - 1];
|
||||||
array[max - 1] = array[other_idx];
|
array[max - 1] = array[other_idx];
|
||||||
|
@ -357,7 +355,7 @@ int main(void) {
|
||||||
// Deterministic randomization.
|
// Deterministic randomization.
|
||||||
for (uint32_t idx = max - 1; idx-- > 0;) {
|
for (uint32_t idx = max - 1; idx-- > 0;) {
|
||||||
uint32_t other_idx = simple_archiver_algo_lcg_defaults(idx) %
|
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) {
|
if (max - 1 != other_idx) {
|
||||||
uint32_t temp = array[max - 1];
|
uint32_t temp = array[max - 1];
|
||||||
array[max - 1] = array[other_idx];
|
array[max - 1] = array[other_idx];
|
||||||
|
|
|
@ -17,10 +17,10 @@
|
||||||
// `test.c` is the source for testing code.
|
// `test.c` is the source for testing code.
|
||||||
|
|
||||||
// Standard library includes.
|
// Standard library includes.
|
||||||
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
// Local includes.
|
// Local includes.
|
||||||
#include "helpers.h"
|
#include "helpers.h"
|
||||||
|
|
Loading…
Reference in a new issue