make
make test
Last active
July 3, 2016 06:46
-
-
Save holyshared/bd90337a7573895fb1507c60e1ee683f to your computer and use it in GitHub Desktop.
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
#include "func1.h" | |
#include "func2.h" | |
int main(int argc, char* argv[]) | |
{ | |
func1(0, 2); | |
func1(1, 1); | |
func2(0, 2); | |
func2(1, 1); | |
} |
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
#include <stdio.h> | |
#include <stdlib.h> | |
#include "func1.h" | |
void func1(int con1, int con2) | |
{ | |
int x = 1; | |
if (con1 == 0) { | |
x = x + 1; | |
} | |
if (con2 > 1) { | |
x = x * 2; | |
} | |
printf ("x = %d\n", x); | |
} |
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
extern void func1(int con1, int con2); |
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
#include <stdio.h> | |
#include <stdlib.h> | |
#include "func1.h" | |
void func2(int con1, int con2) | |
{ | |
int x = 1; | |
if (con1 == 0) { | |
x = x + 1; | |
} | |
if (con2 > 1) { | |
x = x * 2; | |
} | |
printf ("x = %d\n", x); | |
} |
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
extern void func2(int con1, int con2); |
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
all: | |
gcc -g --coverage fixture.c func1.c func2.c -o fixture | |
test: | |
./fixture | |
gcov -fbc fixture.c | |
lcov -t example -c -d . -o fixture.info --checksum --rc=lcov_branch_coverage=1 | |
clean: | |
rm fixture *.gcda *.gcno *.info |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment