-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Process test results with printf output that's not terminated by a ne…
…wline
- Loading branch information
1 parent
84e8968
commit 36e6a08
Showing
9 changed files
with
3,065 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"version": 2, | ||
"status": "pass", | ||
"message": null, | ||
"tests": [ | ||
{ | ||
"name": "test_add", | ||
"status": "pass", | ||
"output": "no newline" | ||
}, | ||
{ | ||
"name": "test_sub", | ||
"status": "pass" | ||
}, | ||
{ | ||
"name": "test_mul", | ||
"status": "pass" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
### If you wish to use extra libraries (math.h for instance), | ||
### add their flags here (-lm in our case) in the "LIBS" variable. | ||
|
||
LIBS = -lm | ||
|
||
### | ||
CFLAGS = -std=c99 | ||
CFLAGS += -g | ||
CFLAGS += -Wall | ||
CFLAGS += -Wextra | ||
CFLAGS += -pedantic | ||
CFLAGS += -Werror | ||
CFLAGS += -Wmissing-declarations | ||
CFLAGS += -DUNITY_SUPPORT_64 -DUNITY_OUTPUT_COLOR | ||
|
||
ASANFLAGS = -fsanitize=address | ||
ASANFLAGS += -fno-common | ||
ASANFLAGS += -fno-omit-frame-pointer | ||
|
||
.PHONY: test | ||
test: tests.out | ||
@./tests.out | ||
|
||
.PHONY: memcheck | ||
memcheck: ./*.c ./*.h | ||
@echo Compiling $@ | ||
@$(CC) $(ASANFLAGS) $(CFLAGS) test-framework/unity.c ./*.c -o memcheck.out $(LIBS) | ||
@./memcheck.out | ||
@echo "Memory check passed" | ||
|
||
.PHONY: clean | ||
clean: | ||
rm -rf *.o *.out *.out.dSYM | ||
|
||
tests.out: ./*.c ./*.h | ||
@echo Compiling $@ | ||
@$(CC) $(CFLAGS) test-framework/unity.c ./*.c -o tests.out $(LIBS) |
18 changes: 18 additions & 0 deletions
18
tests/printf-output-with-no-newline/printf_output_with_no_newline.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#include <stdio.h> | ||
#include "printf_output_with_no_newline.h" | ||
|
||
int add(int x, int y) | ||
{ | ||
printf("no newline"); | ||
return x + y; | ||
} | ||
|
||
int sub(int x, int y) | ||
{ | ||
return x - y; | ||
} | ||
|
||
int mul(int x, int y) | ||
{ | ||
return x * y; | ||
} |
8 changes: 8 additions & 0 deletions
8
tests/printf-output-with-no-newline/printf_output_with_no_newline.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#ifndef PRINTF_OUTPUT_WITH_NO_NEWLINE_H | ||
#define PRINTF_OUTPUT_WITH_NO_NEWLINE_H | ||
|
||
int add(int x, int y); | ||
int sub(int x, int y); | ||
int mul(int x, int y); | ||
|
||
#endif |
Oops, something went wrong.