mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 14:54:07 +10:00
Added valgrind to the CI, fixed tests
This exposed an issue with my dev environment, which I had to patch. Fixed #153
This commit is contained in:
@@ -81,4 +81,4 @@ build-run-valgrind: $(addprefix $(TEST_OUTDIR)/,$(notdir $(TEST_CASESFILES:%.c=%
|
||||
|
||||
.PRECIOUS: $(TEST_OUTDIR)/%.run-valgrind
|
||||
$(TEST_OUTDIR)/%.run-valgrind: $(TEST_OUTDIR)/%.exe
|
||||
valgrind $< --leak-check=full --show-leak-kinds=all --track-origins=yes --verbose
|
||||
valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes $<
|
||||
|
||||
@@ -210,7 +210,7 @@ int test_string_concatenation() {
|
||||
|
||||
//check the refcounts
|
||||
if (strlen(buffer) != 11 ||
|
||||
strcmp(buffer, "Hello world") != 0)
|
||||
strncmp(buffer, "Hello world", 11) != 0)
|
||||
{
|
||||
fprintf(stderr, TOY_CC_ERROR "ERROR: Failed to get the raw buffer from concatenated string\n" TOY_CC_RESET);
|
||||
free(buffer);
|
||||
@@ -267,7 +267,7 @@ int test_string_with_stressed_bucket() {
|
||||
//grab the buffer
|
||||
char* buffer = Toy_getStringRawBuffer(str);
|
||||
|
||||
if (strcmp(buffer, "thequickbrownfoxjumpedoverthelazydog") != 0 ||
|
||||
if (strncmp(buffer, "thequickbrownfoxjumpedoverthelazydog", 36) != 0 ||
|
||||
strlen(buffer) != 36)
|
||||
{
|
||||
fprintf(stderr, TOY_CC_ERROR "ERROR: Unexpected state of the raw buffer after string stress test: '%s'\n" TOY_CC_RESET, buffer);
|
||||
|
||||
Reference in New Issue
Block a user