Yzena
/
Yc
2
1
Fork 0
Browse Source

Get benchmarks, samples, and tests compiling again

Signed-off-by: Gavin Howard <gavin@yzena.com>
afl_persistent_mode
Gavin Howard 3 months ago
parent
commit
3cd3c4f145
Signed by: gavin
GPG Key ID: C08038BDF280D33E
  1. 4
      benchmarks/listdir.c
  2. 4
      benchmarks/xxh3_v_spooky.c
  3. 10
      samples/io/file_open.c
  4. 6
      samples/io/interactive.c
  5. 6
      samples/io/iterate.c
  6. 16
      samples/io/list_to_file.c
  7. 4
      samples/io/random_access.c
  8. 8
      tests/arith/arith_sge.c
  9. 8
      tests/arith/arith_sgt.c
  10. 8
      tests/arith/arith_sle.c
  11. 8
      tests/arith/arith_slt.c
  12. 10
      tests/arith/arith_sn.c
  13. 12
      tests/arith/arith_sshr.c
  14. 12
      tests/arith/arith_ushr.c
  15. 4
      tests/container/array_all.c
  16. 16
      tests/container/map_all.c
  17. 26
      tests/container/map_countwords.c
  18. 4
      tests/container/map_stress.c
  19. 4
      tests/container/ntree_add.c
  20. 4
      tests/container/ntree_copy.c
  21. 4
      tests/container/ntree_empty.c
  22. 4
      tests/container/ntree_iterator.c
  23. 4
      tests/container/ntree_remove.c
  24. 4
      tests/container/nvec_add.c
  25. 4
      tests/container/nvec_copy.c
  26. 4
      tests/container/nvec_nadd.c
  27. 6
      tests/container/nvec_npop.c
  28. 4
      tests/container/nvec_npush.c
  29. 6
      tests/container/nvec_nremove.c
  30. 6
      tests/container/nvec_pop.c
  31. 4
      tests/container/nvec_push.c
  32. 4
      tests/container/nvec_remove.c
  33. 4
      tests/container/nvec_setcap.c
  34. 4
      tests/container/nvec_setlen.c
  35. 4
      tests/container/nvec_stress.c
  36. 20
      tests/container/nvec_tests.c
  37. 4
      tests/container/nvec_tests.h
  38. 4
      tests/container/stack_all.c
  39. 4
      tests/container/svec_npop.c
  40. 4
      tests/container/svec_npush.c
  41. 4
      tests/container/svec_pop.c
  42. 4
      tests/container/svec_push.c
  43. 4
      tests/container/tree_add.c
  44. 4
      tests/container/tree_copy.c
  45. 4
      tests/container/tree_empty.c
  46. 4
      tests/container/tree_iterator.c
  47. 4
      tests/container/tree_remove.c
  48. 4
      tests/container/tree_removeAll.c
  49. 4
      tests/container/treevec_all.c
  50. 4
      tests/container/vec_add.c
  51. 4
      tests/container/vec_copy.c
  52. 4
      tests/container/vec_nadd.c
  53. 4
      tests/container/vec_npop.c
  54. 4
      tests/container/vec_npush.c
  55. 4
      tests/container/vec_nremove.c
  56. 4
      tests/container/vec_pop.c
  57. 4
      tests/container/vec_push.c
  58. 4
      tests/container/vec_remove.c
  59. 4
      tests/container/vec_setcap.c
  60. 4
      tests/container/vec_setlen.c
  61. 10
      tests/container/vec_stress.c
  62. 13
      tests/io/fs_open.c
  63. 12
      tests/io/fs_read.c
  64. 19
      tests/io/fs_unicode.c
  65. 2
      tests/iterator_tests.c
  66. 4
      tests/pool/mappool_all.c
  67. 4
      tests/str/string_all.c
  68. 11
      tests/strgen.c
  69. 3
      tests/util/hash_alignment.c
  70. 3
      tests/util/hash_deltas.c
  71. 12
      tests/util/hash_pieces.c
  72. 3
      tests/util/hash_results.c
  73. 4
      tests/yc_memcpy.c

4
benchmarks/listdir.c

@ -76,8 +76,8 @@ main(int argc, char* argv[])
y_Stat st;
s = y_fs_path_stat(dirp, &st);
if (s != y_STATUS_SUCCESS) return 1;
y_Error e = y_fs_path_stat(dirp, &st);
if (e != y_ERROR_SUCCESS) return 1;
size_t nentries = st.size / sizeof(struct dirent);

4
benchmarks/xxh3_v_spooky.c

@ -232,7 +232,7 @@ main(int argc, char* argv[])
for (i = len - 1; i < len; --i)
{
errors += y_map_remove(spooky, y_vec_get(words, i)) ? 1 : 0;
y_map_remove(spooky, y_vec_get(words, i));
#ifdef ERRS
errors += y_map_size(spooky) != i;
#endif // ERRS
@ -246,7 +246,7 @@ main(int argc, char* argv[])
for (i = len - 1; i < len; --i)
{
errors += y_map_remove(xxh3, y_vec_get(words, i)) ? 1 : 0;
y_map_remove(xxh3, y_vec_get(words, i));
#ifdef ERRS
errors += y_map_size(xxh3) != i;
#endif // ERRS

10
samples/io/file_open.c

@ -101,7 +101,7 @@ main(int argc, char* argv[])
{
y_Status s = y_main(false, false);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(s);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(y_status_exits[s]);
// Make sure we have a file name.
if (argc != 2)
@ -119,14 +119,14 @@ main(int argc, char* argv[])
y_Stat st;
// Stat the file.
s = y_fs_path_stat(path, &st);
y_Error e = y_fs_path_stat(path, &st);
// Check the status.
if (s)
if (e != y_ERROR_SUCCESS)
{
y_eprintf("Error opening file");
y_fs_path_destroy(&path);
y_exit(s);
y_exit(y_status_exits[s]);
}
// Print out the info.
@ -138,5 +138,5 @@ main(int argc, char* argv[])
y_fs_path_destroy(&path);
y_exit(s);
y_exit(y_status_exits[s]);
}

6
samples/io/interactive.c

@ -105,11 +105,11 @@ main(void)
y_Path path;
s = y_main(false, false);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(s);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(y_status_exits[s]);
// Open the directory.
s = y_fs_path_init_cstr(&path, ".");
if (y_err(s != y_STATUS_SUCCESS)) y_exit(s);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(y_status_exits[s]);
s = y_fs_dir_open(&dir, path);
@ -177,5 +177,5 @@ main(void)
bail:
y_exit(s);
y_exit(y_status_exits[s]);
}

6
samples/io/iterate.c

@ -99,12 +99,12 @@ main(void)
{
y_Status s = y_main(false, false);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(s);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(y_status_exits[s]);
y_Path path;
s = y_fs_path_init_cstr(&path, ".");
if (y_err(s != y_STATUS_SUCCESS)) y_exit(s);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(y_status_exits[s]);
// Open the directory.
y_Dir dir;
@ -135,5 +135,5 @@ main(void)
bail:
y_exit(s);
y_exit(y_status_exits[s]);
}

16
samples/io/list_to_file.c

@ -107,31 +107,31 @@ main(void)
y_Status s;
s = y_main(false, false);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(s);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(y_status_exits[s]);
s = y_fs_path_temp(&temp);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(s);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(y_status_exits[s]);
s = y_fs_path_init_cstr(&base, "list_to_file");
if (y_err(s != y_STATUS_SUCCESS)) y_exit(s);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(y_status_exits[s]);
// Open the temp file.
y_Path path;
s = y_fs_file_temp(&path, temp, base);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(s);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(y_status_exits[s]);
y_File fp;
// Open the temp file.
s = y_fs_file_open(&fp, path, y_FILE_WRITE | y_FILE_BINARY);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(s);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(y_status_exits[s]);
// Get the home directory path.
y_Path home;
s = y_fs_path_home(&home);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(s);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(y_status_exits[s]);
// Open the directory.
y_Dir dir;
@ -139,7 +139,7 @@ main(void)
s = y_fs_dir_open(&dir, home);
// Check for error.
if (y_err(s != y_STATUS_SUCCESS)) y_exit(s);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(y_status_exits[s]);
// Get the number of files.
uint32_t nfiles = y_fs_dir_numEntries(dir);
@ -172,5 +172,5 @@ main(void)
y_fs_dir_close(dir);
y_fs_file_close(fp);
y_exit(s);
y_exit(y_status_exits[s]);
}

4
samples/io/random_access.c

@ -102,7 +102,7 @@ main(int argc, char* argv[])
y_Status s = y_main(false, false);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(s);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(y_status_exits[s]);
// Open the directory.
const char* name = argc >= 2 ? argv[1] : ".";
@ -139,5 +139,5 @@ main(int argc, char* argv[])
bail:
y_exit(s);
y_exit(y_status_exits[s]);
}

8
tests/arith/arith_sge.c

@ -87,7 +87,7 @@ cycleinner8(int8_t start, int8_t end, int8_t si8, y_s8 i, y_s8 y_start)
if (y_s8sge(s, t) != (si8 >= sj8))
{
y_printf("8-bit sge: %lu\n", (unsigned long) s);
y_exit(y_STATUS_MISC_ERR);
y_exit(y_status_exits[y_STATUS_MISC_ERR]);
}
if (sj8 != end) sj8 += 1;
@ -128,7 +128,7 @@ cycleinner16(int16_t start, int16_t end, int16_t si16, y_s16 i, y_s16 y_start)
if (y_s16sge(s, t) != (si16 >= sj16))
{
y_printf("16-bit sge: %lu\n", (unsigned long) s);
y_exit(y_STATUS_MISC_ERR);
y_exit(y_status_exits[y_STATUS_MISC_ERR]);
}
if (sj16 != end) sj16 += 1;
@ -158,7 +158,7 @@ main()
{
y_Status s = y_main(false, false);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(s);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(y_status_exits[s]);
cycle8(INT8_MIN, 0, y_s8_min);
cycle8(0, INT8_MAX, 0);
@ -166,5 +166,5 @@ main()
cycle16(INT16_MIN, 0, y_s16_min);
cycle16(0, INT16_MAX, 0);
y_exit(y_STATUS_SUCCESS);
y_exit(y_status_exits[y_STATUS_SUCCESS]);
}

8
tests/arith/arith_sgt.c

@ -87,7 +87,7 @@ cycleinner8(int8_t start, int8_t end, int8_t si8, y_s8 i, y_s8 y_start)
if (y_s8sgt(s, t) != (si8 > sj8))
{
y_printf("8-bit sgt: %lu\n", (unsigned long) s);
y_exit(y_STATUS_MISC_ERR);
y_exit(y_status_exits[y_STATUS_MISC_ERR]);
}
if (sj8 != end) sj8 += 1;
@ -128,7 +128,7 @@ cycleinner16(int16_t start, int16_t end, int16_t si16, y_s16 i, y_s16 y_start)
if (y_s16sgt(s, t) != (si16 > sj16))
{
y_printf("16-bit sgt: %lu\n", (unsigned long) s);
y_exit(y_STATUS_MISC_ERR);
y_exit(y_status_exits[y_STATUS_MISC_ERR]);
}
if (sj16 != end) sj16 += 1;
@ -158,7 +158,7 @@ main()
{
y_Status s = y_main(false, false);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(s);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(y_status_exits[s]);
cycle8(INT8_MIN, 0, y_s8_min);
cycle8(0, INT8_MAX, 0);
@ -166,5 +166,5 @@ main()
cycle16(INT16_MIN, 0, y_s16_min);
cycle16(0, INT16_MAX, 0);
y_exit(y_STATUS_SUCCESS);
y_exit(y_status_exits[y_STATUS_SUCCESS]);
}

8
tests/arith/arith_sle.c

@ -87,7 +87,7 @@ cycleinner8(int8_t start, int8_t end, int8_t si8, y_s8 i, y_s8 y_start)
if (y_s8sle(s, t) != (si8 <= sj8))
{
y_printf("8-bit sle: %lu\n", (unsigned long) s);
y_exit(y_STATUS_MISC_ERR);
y_exit(y_status_exits[y_STATUS_MISC_ERR]);
}
if (sj8 != end) sj8 += 1;
@ -128,7 +128,7 @@ cycleinner16(int16_t start, int16_t end, int16_t si16, y_s16 i, y_s16 y_start)
if (y_s16sle(s, t) != (si16 <= sj16))
{
y_printf("16-bit sle: %lu\n", (unsigned long) s);
y_exit(y_STATUS_MISC_ERR);
y_exit(y_status_exits[y_STATUS_MISC_ERR]);
}
if (sj16 != end) sj16 += 1;
@ -158,7 +158,7 @@ main()
{
y_Status s = y_main(false, false);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(s);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(y_status_exits[s]);
cycle8(INT8_MIN, 0, y_s8_min);
cycle8(0, INT8_MAX, 0);
@ -166,5 +166,5 @@ main()
cycle16(INT16_MIN, 0, y_s16_min);
cycle16(0, INT16_MAX, 0);
y_exit(y_STATUS_SUCCESS);
y_exit(y_status_exits[y_STATUS_SUCCESS]);
}

8
tests/arith/arith_slt.c

@ -87,7 +87,7 @@ cycleinner8(int8_t start, int8_t end, int8_t si8, y_s8 i, y_s8 y_start)
if (y_s8slt(s, t) != (si8 < sj8))
{
y_printf("8-bit slt: %lu\n", (unsigned long) s);
y_exit(y_STATUS_MISC_ERR);
y_exit(y_status_exits[y_STATUS_MISC_ERR]);
}
if (sj8 != end) sj8 += 1;
@ -128,7 +128,7 @@ cycleinner16(int16_t start, int16_t end, int16_t si16, y_s16 i, y_s16 y_start)
if (y_s16slt(s, t) != (si16 < sj16))
{
y_printf("16-bit slt: %lu\n", (unsigned long) s);
y_exit(y_STATUS_MISC_ERR);
y_exit(y_status_exits[y_STATUS_MISC_ERR]);
}
if (sj16 != end) sj16 += 1;
@ -158,7 +158,7 @@ main()
{
y_Status s = y_main(false, false);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(s);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(y_status_exits[s]);
cycle8(INT8_MIN, 0, y_s8_min);
cycle8(0, INT8_MAX, 0);
@ -166,5 +166,5 @@ main()
cycle16(INT16_MIN, 0, y_s16_min);
cycle16(0, INT16_MAX, 0);
y_exit(y_STATUS_SUCCESS);
y_exit(y_status_exits[y_STATUS_SUCCESS]);
}

10
tests/arith/arith_sn.c

@ -76,7 +76,7 @@ main()
y_Status s = y_main(false, false);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(s);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(y_status_exits[s]);
for (i = 0; i < TOP8; ++i)
{
@ -85,7 +85,7 @@ main()
if (y_s8sn(s8) != (s8 >= y_s8_min))
{
y_printf("8-bit sn: %lu\n", (unsigned long) s8);
y_exit(y_STATUS_MISC_ERR);
y_exit(y_status_exits[y_STATUS_MISC_ERR]);
}
}
@ -96,7 +96,7 @@ main()
if (y_s16sn(s16) != (s16 >= y_s16_min))
{
y_printf("16-bit sn: %lu\n", (unsigned long) s16);
y_exit(y_STATUS_MISC_ERR);
y_exit(y_status_exits[y_STATUS_MISC_ERR]);
}
}
@ -107,9 +107,9 @@ main()
if (y_s32sn(s32) != (s32 >= y_s32_min))
{
y_printf("32-bit sn: %lu\n", (unsigned long) s32);
y_exit(y_STATUS_MISC_ERR);
y_exit(y_status_exits[y_STATUS_MISC_ERR]);
}
}
y_exit(y_STATUS_SUCCESS);
y_exit(y_status_exits[y_STATUS_SUCCESS]);
}

12
tests/arith/arith_sshr.c

@ -80,7 +80,7 @@ main(void)
y_s16 u16 = 0, s16 = y_s16_min;
s = y_main(false, false);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(s);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(y_status_exits[s]);
for (i = 0; i <= 9; ++i)
{
@ -90,13 +90,13 @@ main(void)
if (us != 0)
{
s = y_printf("8-bit sshr: %lu\n", (unsigned long) us);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(s);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(y_status_exits[s]);
}
if ((i >= 8 && ss != 0) || (ss != (y_s8) (~((1ULL << (8 - i)) - 1))))
{
s = y_printf("8-bit sshr: %lu\n", (unsigned long) ss);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(s);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(y_status_exits[s]);
}
}
@ -108,15 +108,15 @@ main(void)
if (us != 0)
{
s = y_printf("16-bit sshr: %lu\n", (unsigned long) us);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(s);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(y_status_exits[s]);
}
if ((i >= 16 && ss != 0) || (ss != (y_s16) (~((1ULL << (16 - i)) - 1))))
{
s = y_printf("16-bit sshr: %lu\n", (unsigned long) ss);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(s);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(y_status_exits[s]);
}
}
y_exit(y_STATUS_SUCCESS);
y_exit(y_status_exits[y_STATUS_SUCCESS]);
}

12
tests/arith/arith_ushr.c

@ -80,7 +80,7 @@ main(void)
y_u16 u16 = 0, s16 = y_s16_min;
s = y_main(false, false);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(s);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(y_status_exits[s]);
for (i = 0; i <= 9; ++i)
{
@ -90,13 +90,13 @@ main(void)
if (us != 0)
{
s = y_printf("8-bit ushr: %lu\n", (unsigned long) us);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(s);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(y_status_exits[s]);
}
if ((i >= 8 && ss != y_u8_max) || (ss != (y_u8) (1ULL << (8 - i))))
{
s = y_printf("8-bit ushr: %lu\n", (unsigned long) ss);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(s);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(y_status_exits[s]);
}
}
@ -108,15 +108,15 @@ main(void)
if (us != 0)
{
s = y_printf("16-bit ushr: %lu\n", (unsigned long) us);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(s);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(y_status_exits[s]);
}
if ((i >= 16 && ss != y_u8_max) || (ss != (y_u16) (1ULL << (16 - i))))
{
s = y_printf("16-bit ushr: %lu\n", (unsigned long) ss);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(s);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(y_status_exits[s]);
}
}
y_exit(y_STATUS_SUCCESS);
y_exit(y_status_exits[y_STATUS_SUCCESS]);
}

4
tests/container/array_all.c

@ -80,7 +80,7 @@ main()
{
y_Status s = y_main(false, false);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(s);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(y_status_exits[s]);
y_str str = y_STR("this is a test");
@ -98,5 +98,5 @@ main()
y_printf("%c\n", c);
#endif // 0
y_exit(s);
y_exit(y_status_exits[s]);
}

16
tests/container/map_all.c

@ -102,13 +102,13 @@ main(int argc, char* argv[])
int errors = 0;
y_Status s = y_main(false, false);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(s);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(y_status_exits[s]);
y_Vector words = y_vec_createStringVec(8192);
if (y_err(words == NULL)) y_exit(y_STATUS_MISC_ERR);
if (y_err(words == NULL)) y_exit(y_status_exits[y_STATUS_MISC_ERR]);
y_Map map = y_map_createStringKeyMap(0.9f, sizeof(size_t), NULL);
if (y_err(map == NULL)) y_exit(y_STATUS_MISC_ERR);
if (y_err(map == NULL)) y_exit(y_status_exits[y_STATUS_MISC_ERR]);
char* name = "/usr/share/dict/words";
if (argc > 1) name = argv[1];
@ -116,12 +116,12 @@ main(int argc, char* argv[])
y_Path path;
s = y_fs_path_init_cstr(&path, name);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(s);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(y_status_exits[s]);
y_File f;
s = y_fs_file_open(&f, path, y_FILE_READ);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(s);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(y_status_exits[s]);
while ((s = y_fgets(f, (y_uchar*) line, MAX_CHARS, NULL)) ==
y_STATUS_SUCCESS)
@ -155,7 +155,7 @@ main(int argc, char* argv[])
}
bool* indices = y_calloc(len, sizeof(bool));
if (y_err(indices == NULL)) y_exit(y_STATUS_MALLOC_FAIL);
if (y_err(indices == NULL)) y_exit(y_status_exits[y_STATUS_MALLOC_FAIL]);
y_str* it = y_map_begin(map);
for (i = 0; i < len && it; ++i, it = y_map_next(map, it))
@ -200,7 +200,7 @@ main(int argc, char* argv[])
for (i = len - 1; i < len; --i)
{
char* str = (char*) ((y_str*) y_vec_get(words, i))->a;
errors += y_map_removeStringKey(map, str) ? 1 : 0;
y_map_removeStringKey(map, str);
errors += y_map_size(map) != i;
}
@ -209,5 +209,5 @@ main(int argc, char* argv[])
free(indices);
y_exit(errors ? y_STATUS_MISC_ERR : y_STATUS_SUCCESS);
y_exit(y_status_exits[errors ? y_STATUS_MISC_ERR : y_STATUS_SUCCESS]);
}

26
tests/container/map_countwords.c

@ -206,7 +206,7 @@ increment(char* word, size_t word_len)
size_t i;
count c = { .word = w, .count = 0 };
if (y_err(val == NULL)) y_exit(y_STATUS_MISC_ERR);
if (y_err(val == NULL)) y_exit(y_status_exits[y_STATUS_MISC_ERR]);
*val += 1;
@ -227,7 +227,7 @@ increment(char* word, size_t word_len)
if (w.word == NULL)
{
y_eprintf("Could not allocate\n");
y_exit(y_STATUS_MALLOC_FAIL);
y_exit(y_status_exits[y_STATUS_MALLOC_FAIL]);
}
// NOLINTNEXTLINE
@ -239,7 +239,7 @@ increment(char* word, size_t word_len)
if (s != y_STATUS_SUCCESS)
{
y_eprintf("Could not insert\n");
y_exit(y_STATUS_MISC_ERR);
y_exit(y_status_exits[y_STATUS_MISC_ERR]);
}
count c = { .word = w, .count = wcount };
@ -249,7 +249,7 @@ increment(char* word, size_t word_len)
if (s != y_STATUS_SUCCESS)
{
y_eprintf("Could not push\n");
y_exit(y_STATUS_MISC_ERR);
y_exit(y_status_exits[y_STATUS_MISC_ERR]);
}
assert(y_vec_sorted(vec, cmp_safe));
@ -262,7 +262,7 @@ increment(char* word, size_t word_len)
y_map_exists_kv(table, &w, &temp, &val);
#endif // YC_DEBUG
if (y_err(temp == NULL)) y_exit(y_STATUS_MISC_ERR);
if (y_err(temp == NULL)) y_exit(y_status_exits[y_STATUS_MISC_ERR]);
y_printf("%s: %zu (%zu)\n", temp->word, *val, y_map_size(table));
}
@ -271,7 +271,7 @@ int
main()
{
y_Status s = y_main(false, false);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(s);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(y_status_exits[s]);
// Allocate hash table buckets.
table = y_map_create(0.96f, sizeof(word_data), sizeof(size_t), hash, eq,
@ -281,7 +281,7 @@ main()
if (table == NULL || vec == NULL)
{
y_eprintf("Out of memory\n");
y_exit(y_STATUS_MALLOC_FAIL);
y_exit(y_status_exits[y_STATUS_MALLOC_FAIL]);
}
char* buf = strdup(kjvbible_array);
@ -342,14 +342,14 @@ main()
if (num_unique != y_vec_len(vec))
{
y_eprintf("Vector and map are different sizes\n");
y_exit(y_STATUS_MISC_ERR);
y_exit(y_status_exits[y_STATUS_MISC_ERR]);
}
if (num_unique != 32187)
{
y_eprintf("Vector and map are the wrong size;\n");
y_eprintf("Expected 32187, got %zu\n", num_unique);
y_exit(y_STATUS_MISC_ERR);
y_exit(y_status_exits[y_STATUS_MISC_ERR]);
}
count* ordered_map = calloc(num_unique, sizeof(count));
@ -358,7 +358,7 @@ main()
if (ordered_map == NULL || ordered_vec == NULL)
{
y_eprintf("Out of memory\n");
y_exit(y_STATUS_MALLOC_FAIL);
y_exit(y_status_exits[y_STATUS_MALLOC_FAIL]);
}
i = 0;
@ -387,7 +387,7 @@ main()
if (!y_map_exists(table, &ordered_vec[i].word))
{
y_eprintf("Map does not have an element that the vector does\n");
y_exit(y_STATUS_MISC_ERR);
y_exit(y_status_exits[y_STATUS_MISC_ERR]);
}
}
@ -422,7 +422,7 @@ main()
}
}
if (bad) y_exit(y_STATUS_MISC_ERR);
if (bad) y_exit(y_status_exits[y_STATUS_MISC_ERR]);
}
for (i = 0; i < num_unique; i++)
@ -435,5 +435,5 @@ main()
y_vec_free(vec);
y_map_free(table);
y_exit(y_STATUS_SUCCESS);
y_exit(y_status_exits[y_STATUS_SUCCESS]);
}

4
tests/container/map_stress.c

@ -69,7 +69,7 @@ main()
int errors = 0;
y_Status s = y_main(false, false);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(s);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(y_status_exits[s]);
y_Map map = y_map_create(0.99f, sizeof(uint64_t), sizeof(uint64_t), NULL,
NULL, NULL, NULL);
@ -86,5 +86,5 @@ main()
y_map_free(map);
y_exit(errors ? y_STATUS_MISC_ERR : y_STATUS_SUCCESS);
y_exit(y_status_exits[errors ? y_STATUS_MISC_ERR : y_STATUS_SUCCESS]);
}

4
tests/container/ntree_add.c

@ -72,7 +72,7 @@ main()
int errors = 0;
y_Status s = y_main(false, false);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(s);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(y_status_exits[s]);
y_NTree ctree = y_ntree_create(5, 6, sizeof(unsigned char), NULL, NULL);
errors += ctree ? 0 : 1;
@ -92,5 +92,5 @@ main()
y_ntree_free(ctree);
y_ntree_free(itree);
y_exit(errors ? y_STATUS_MISC_ERR : y_STATUS_SUCCESS);
y_exit(y_status_exits[errors ? y_STATUS_MISC_ERR : y_STATUS_SUCCESS]);
}

4
tests/container/ntree_copy.c

@ -74,7 +74,7 @@ main()
int errors = 0;
y_Status s = y_main(false, false);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(s);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(y_status_exits[s]);
y_NTree ctree = y_ntree_create(5, 6, sizeof(unsigned char), NULL, NULL);
errors += ctree ? 0 : 1;
@ -114,5 +114,5 @@ main()
y_ntree_free(itree);
y_ntree_free(itree2);
y_exit(errors ? y_STATUS_MISC_ERR : y_STATUS_SUCCESS);
y_exit(y_status_exits[errors ? y_STATUS_MISC_ERR : y_STATUS_SUCCESS]);
}

4
tests/container/ntree_empty.c

@ -74,7 +74,7 @@ main()
int errors = 0;
y_Status s = y_main(false, false);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(s);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(y_status_exits[s]);
y_NTree ctree = y_ntree_create(5, 6, sizeof(unsigned char), NULL, NULL);
errors += ctree ? 0 : 1;
@ -110,5 +110,5 @@ main()
y_ntree_free(ctree);
y_ntree_free(itree);
y_exit(errors ? y_STATUS_MISC_ERR : y_STATUS_SUCCESS);
y_exit(y_status_exits[errors ? y_STATUS_MISC_ERR : y_STATUS_SUCCESS]);
}

4
tests/container/ntree_iterator.c

@ -99,7 +99,7 @@ main()
int errors = 0;
y_Status s = y_main(false, false);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(s);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(y_status_exits[s]);
y_NTree t = y_ntree_create(5, 6, sizeof(unsigned char), NULL, NULL);
errors += t ? 0 : 1;
@ -234,5 +234,5 @@ main()
y_ntree_free(t);
y_exit(errors ? y_STATUS_MISC_ERR : y_STATUS_SUCCESS);
y_exit(y_status_exits[errors ? y_STATUS_MISC_ERR : y_STATUS_SUCCESS]);
}

4
tests/container/ntree_remove.c

@ -72,7 +72,7 @@ main()
int errors = 0;
y_Status status = y_main(false, false);
if (y_err(status != y_STATUS_SUCCESS)) y_exit(status);
if (y_err(status != y_STATUS_SUCCESS)) y_exit(y_status_exits[status]);
y_NTree ctree = y_ntree_create(5, 6, sizeof(unsigned char), NULL, NULL);
errors += ctree ? 0 : 1;
@ -112,5 +112,5 @@ main()
y_ntree_free(ctree);
y_ntree_free(itree);
y_exit(errors ? y_STATUS_MISC_ERR : y_STATUS_SUCCESS);
y_exit(y_status_exits[errors ? y_STATUS_MISC_ERR : y_STATUS_SUCCESS]);
}

4
tests/container/nvec_add.c

@ -69,7 +69,7 @@ main()
int errors = 0;
y_Status s = y_main(false, false);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(s);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(y_status_exits[s]);
y_NVector v = y_nvec_vcreate(2, 16, NULL, NULL, sizeof(uint32_t),
sizeof(size_t));
@ -84,5 +84,5 @@ main()
y_nvec_free(v);
y_exit(errors ? y_STATUS_MISC_ERR : y_STATUS_SUCCESS);
y_exit(y_status_exits[errors ? y_STATUS_MISC_ERR : y_STATUS_SUCCESS]);
}

4
tests/container/nvec_copy.c

@ -71,7 +71,7 @@ main()
int errors = 0;
y_Status s = y_main(false, false);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(s);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(y_status_exits[s]);
y_NVector v = y_nvec_vcreate(2, 16, NULL, NULL, sizeof(uint32_t),
sizeof(size_t));
@ -99,5 +99,5 @@ main()
y_nvec_free(v);
y_exit(errors ? y_STATUS_MISC_ERR : y_STATUS_SUCCESS);
y_exit(y_status_exits[errors ? y_STATUS_MISC_ERR : y_STATUS_SUCCESS]);
}

4
tests/container/nvec_nadd.c

@ -69,7 +69,7 @@ main()
int errors = 0;
y_Status s = y_main(false, false);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(s);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(y_status_exits[s]);
y_NVector v = y_nvec_vcreate(2, 16, NULL, NULL, sizeof(uint32_t),
sizeof(size_t));
@ -83,5 +83,5 @@ main()
y_nvec_free(v);
y_exit(errors ? y_STATUS_MISC_ERR : y_STATUS_SUCCESS);
y_exit(y_status_exits[errors ? y_STATUS_MISC_ERR : y_STATUS_SUCCESS]);
}

6
tests/container/nvec_npop.c

@ -69,7 +69,7 @@ main()
int errors = 0;
y_Status s = y_main(false, false);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(s);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(y_status_exits[s]);
y_NVector v = y_nvec_vcreate(2, 16, NULL, NULL, sizeof(uint32_t),
sizeof(size_t));
@ -79,7 +79,7 @@ main()
size_t len = y_nvec_len(v);
errors += (len != 16 * 5);
errors += nvec_npop(v, 16, 4);
nvec_npop(v, 16, 4);
len = y_nvec_len(v);
errors += (len != 16);
@ -88,5 +88,5 @@ main()
y_nvec_free(v);
y_exit(errors ? y_STATUS_MISC_ERR : y_STATUS_SUCCESS);
y_exit(y_status_exits[errors ? y_STATUS_MISC_ERR : y_STATUS_SUCCESS]);
}

4
tests/container/nvec_npush.c

@ -69,7 +69,7 @@ main()
int errors = 0;
y_Status status = y_main(false, false);
if (y_err(status != y_STATUS_SUCCESS)) y_exit(status);
if (y_err(status != y_STATUS_SUCCESS)) y_exit(y_status_exits[status]);
y_NVector v = y_nvec_vcreate(2, 16, NULL, NULL, sizeof(uint32_t),
sizeof(size_t));
@ -91,5 +91,5 @@ main()
y_nvec_free(v);
y_exit(errors ? y_STATUS_MISC_ERR : y_STATUS_SUCCESS);
y_exit(y_status_exits[errors ? y_STATUS_MISC_ERR : y_STATUS_SUCCESS]);
}

6
tests/container/nvec_nremove.c

@ -71,7 +71,7 @@ main()
int errors = 0;
y_Status status = y_main(false, false);
if (y_err(status != y_STATUS_SUCCESS)) y_exit(status);
if (y_err(status != y_STATUS_SUCCESS)) y_exit(y_status_exits[status]);
y_NVector v = y_nvec_vcreate(2, 16, NULL, NULL, sizeof(uint32_t),
sizeof(size_t));
@ -95,10 +95,10 @@ main()
len = y_nvec_len(v);
errors += (len != 32);
errors += y_nvec_nremove(v, 0, 16);
y_nvec_nremove(v, 0, 16);
errors += nvec_check(v) ? 0 : 1;
y_nvec_free(v);
y_exit(errors ? y_STATUS_MISC_ERR : y_STATUS_SUCCESS);
y_exit(y_status_exits[errors ? y_STATUS_MISC_ERR : y_STATUS_SUCCESS]);
}

6
tests/container/nvec_pop.c

@ -69,7 +69,7 @@ main()
int errors = 0;
y_Status s = y_main(false, false);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(s);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(y_status_exits[s]);
y_NVector v = y_nvec_vcreate(2, 16, NULL, NULL, sizeof(uint32_t),
sizeof(size_t));
@ -80,7 +80,7 @@ main()
size_t len = y_nvec_len(v);
errors += (len != 16 * 2);
errors += nvec_pop(v, 16);
nvec_pop(v, 16);
len = y_nvec_len(v);
errors += (len != 16);
@ -89,5 +89,5 @@ main()
y_nvec_free(v);
y_exit(errors ? y_STATUS_MISC_ERR : y_STATUS_SUCCESS);
y_exit(y_status_exits[errors ? y_STATUS_MISC_ERR : y_STATUS_SUCCESS]);
}

4
tests/container/nvec_push.c

@ -69,7 +69,7 @@ main()
int errors = 0;
y_Status status = y_main(false, false);
if (y_err(status != y_STATUS_SUCCESS)) y_exit(status);
if (y_err(status != y_STATUS_SUCCESS)) y_exit(y_status_exits[status]);
y_NVector v = y_nvec_vcreate(2, 16, NULL, NULL, sizeof(uint32_t),
sizeof(size_t));
@ -91,5 +91,5 @@ main()
y_nvec_free(v);
y_exit(errors ? y_STATUS_MISC_ERR : y_STATUS_SUCCESS);
y_exit(y_status_exits[errors ? y_STATUS_MISC_ERR : y_STATUS_SUCCESS]);
}

4
tests/container/nvec_remove.c

@ -71,7 +71,7 @@ main()
int errors = 0;
y_Status status = y_main(false, false);
if (y_err(status != y_STATUS_SUCCESS)) y_exit(status);
if (y_err(status != y_STATUS_SUCCESS)) y_exit(y_status_exits[status]);
y_NVector v = y_nvec_vcreate(2, 16, NULL, NULL, sizeof(uint32_t),
sizeof(size_t));
@ -104,5 +104,5 @@ main()
y_nvec_free(v);
y_exit(errors ? y_STATUS_MISC_ERR : y_STATUS_SUCCESS);
y_exit(y_status_exits[errors ? y_STATUS_MISC_ERR : y_STATUS_SUCCESS]);
}

4
tests/container/nvec_setcap.c

@ -69,7 +69,7 @@ main()
int errors = 0;
y_Status s = y_main(false, false);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(s);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(y_status_exits[s]);
y_NVector v = y_nvec_vcreate(2, 16, NULL, NULL, sizeof(uint32_t),
sizeof(size_t));
@ -110,5 +110,5 @@ main()
y_nvec_free(v);
y_exit(errors ? y_STATUS_MISC_ERR : y_STATUS_SUCCESS);
y_exit(y_status_exits[errors ? y_STATUS_MISC_ERR : y_STATUS_SUCCESS]);
}

4
tests/container/nvec_setlen.c

@ -69,7 +69,7 @@ main()
int errors = 0;
y_Status s = y_main(false, false);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(s);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(y_status_exits[s]);
y_NVector v = y_nvec_vcreate(2, 16, NULL, NULL, sizeof(uint32_t),
sizeof(size_t));
@ -91,5 +91,5 @@ main()
y_nvec_free(v);
y_exit(errors ? y_STATUS_MISC_ERR : y_STATUS_SUCCESS);
y_exit(y_status_exits[errors ? y_STATUS_MISC_ERR : y_STATUS_SUCCESS]);
}

4
tests/container/nvec_stress.c

@ -69,7 +69,7 @@ main()
int errors = 0;
y_Status status = y_main(false, false);
if (y_err(status != y_STATUS_SUCCESS)) y_exit(status);
if (y_err(status != y_STATUS_SUCCESS)) y_exit(y_status_exits[status]);
y_NVector v = y_nvec_vcreate(2, 10000000, NULL, NULL, sizeof(uint32_t),
sizeof(size_t));
@ -97,5 +97,5 @@ main()
y_nvec_free(v);
y_exit(errors ? y_STATUS_MISC_ERR : y_STATUS_SUCCESS);
y_exit(y_status_exits[errors ? y_STATUS_MISC_ERR : y_STATUS_SUCCESS]);
}

20
tests/container/nvec_tests.c

@ -192,26 +192,22 @@ nvec_fillPop(y_NVector v, uint32_t amt, uint32_t repeat)
return errors;
}
int
void
nvec_pop(y_NVector v, uint32_t amt)
{
int errors = y_nvec_pop(v) ? 1 : 0;
for (size_t i = 0; i < amt - 1; ++i)
for (size_t i = 0; i < amt; ++i)
{
errors += y_nvec_popAt(v, i) ? 1 : 0;
y_nvec_popAt(v, i);
}
return errors;
}
int
void
nvec_npop(y_NVector v, uint32_t amt, uint32_t repeat)
{
int errors = y_nvec_npop(v, repeat) ? 1 : 0;
for (size_t i = 0; i < amt - 1; ++i)
errors += y_nvec_npopAt(v, i, repeat) ? 1 : 0;
return errors;
for (size_t i = 0; i < amt; ++i)
{
y_nvec_npopAt(v, i, repeat);
}
}
bool

4
tests/container/nvec_tests.h

@ -85,9 +85,9 @@ int
nvec_nadd(y_NVector v, uint32_t amt, uint32_t chunkSize);
int
nvec_fillPop(y_NVector v, uint32_t amt, uint32_t repeat);
int
void
nvec_pop(y_NVector v, uint32_t amt);
int
void
nvec_npop(y_NVector v, uint32_t amt, uint32_t repeat);
bool
nvec_check(y_NVector v);

4
tests/container/stack_all.c

@ -99,7 +99,7 @@ main()
int errors = 0;
y_Status status = y_main(false, false);
if (y_err(status != y_STATUS_SUCCESS)) y_exit(status);
if (y_err(status != y_STATUS_SUCCESS)) y_exit(y_status_exits[status]);
y_Stack s = y_stack_create(0, sizeof(uint32_t), NULL, NULL);
@ -109,5 +109,5 @@ main()
y_stack_free(s);
y_exit(errors ? y_STATUS_MISC_ERR : y_STATUS_SUCCESS);
y_exit(y_status_exits[errors ? y_STATUS_MISC_ERR : y_STATUS_SUCCESS]);
}

4
tests/container/svec_npop.c

@ -69,7 +69,7 @@ main()
uint32_t i;
y_Status s = y_main(false, false);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(s);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(y_status_exits[s]);
y_SVector cvec = y_svec_create(sizeof(unsigned char), NULL, NULL);
errors += cvec ? 0 : 1;
@ -158,5 +158,5 @@ main()
y_svec_free(cvec);
y_svec_free(ivec);
y_exit(errors ? y_STATUS_MISC_ERR : y_STATUS_SUCCESS);
y_exit(y_status_exits[errors ? y_STATUS_MISC_ERR : y_STATUS_SUCCESS]);
}

4
tests/container/svec_npush.c

@ -68,7 +68,7 @@ main()
int errors = 0;
y_Status s = y_main(false, false);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(s);
if (y_err(s != y_STATUS_SUCCESS)) y_exit(y_status_exits[s]);
y_SVector cvec = y_svec_create(sizeof(unsigned char), NULL, NULL);