Move tests to relevant subprojects (#615)

- Moved test projects to the parent project they belong to
- Improved test stability/corectness
- Improved recursive directory deletion by safely ignoring current- and parent-directory entries.
- Update docs
This commit is contained in:
Ken Van Hoeylandt
2026-08-13 23:01:12 +02:00
committed by GitHub
parent d6b1d15e56
commit f943c4dd69
64 changed files with 137 additions and 1539 deletions
@@ -0,0 +1,28 @@
#include "doctest.h"
#include <crypt/hash.h>
#include <cstring>
TEST_CASE("djb2_str of an empty string returns the DJB2 seed value") {
CHECK_EQ(djb2_str(""), 5381u);
}
TEST_CASE("djb2_str produces the well-known DJB2 hash for a string") {
CHECK_EQ(djb2_str("hello"), 261238937u);
}
TEST_CASE("djb2_str is deterministic for the same input") {
CHECK_EQ(djb2_str("tactility"), djb2_str("tactility"));
}
TEST_CASE("djb2_str produces different hashes for different input") {
CHECK_NE(djb2_str("tactility"), djb2_str("Tactility"));
}
TEST_CASE("djb2_data of an empty buffer returns the DJB2 seed value") {
CHECK_EQ(djb2_data("", 0), 5381u);
}
TEST_CASE("djb2_data matches djb2_str for the same bytes") {
const char* text = "tactility";
CHECK_EQ(djb2_data(text, strlen(text)), djb2_str(text));
}