mirror of
https://github.com/meekrosoft/fff
synced 2026-01-23 16:35:59 +01:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
de617dedc7 | ||
|
|
88d194cc1d | ||
|
|
9d36a91ace | ||
|
|
c066468236 |
25
coverage.sh
Executable file
25
coverage.sh
Executable file
@@ -0,0 +1,25 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
fff_len=`cat fff.h | wc -l`
|
||||||
|
|
||||||
|
# test/fff_test_c.c
|
||||||
|
gcc -E test/fff_test_c.c > out
|
||||||
|
comm -13 <(sort < fff.h | uniq) <(sort < out | uniq) > unique_to_out # strip out fff.h include
|
||||||
|
awk 'FNR==NR{a[$1];next}($1 in a){print}' fff.h unique_to_out > matched # find unique matches
|
||||||
|
awk 'FNR==NR{a[$1];next}($1 in a){print}' matched fff.h > coverage # find coverage of matches in fff.h
|
||||||
|
cov_len=`cat coverage | wc -l`
|
||||||
|
echo "test/fff_test_c.c coverage:"
|
||||||
|
echo "$cov_len / $fff_len" | bc -l
|
||||||
|
|
||||||
|
# test/fff_test_cpp.cpp
|
||||||
|
gcc -E test/fff_test_cpp.cpp -I . > out
|
||||||
|
comm -13 <(sort < fff.h | uniq) <(sort < out | uniq) > unique_to_out
|
||||||
|
awk 'FNR==NR{a[$1];next}($1 in a){print}' fff.h unique_to_out > matched
|
||||||
|
awk 'FNR==NR{a[$1];next}($1 in a){print}' matched fff.h > coverage
|
||||||
|
cov_len_2=`cat coverage | wc -l`
|
||||||
|
echo "test/fff_test_cpp.cpp coverage:"
|
||||||
|
echo "$cov_len_2 / $fff_len" | bc -l
|
||||||
|
|
||||||
|
# total coverage
|
||||||
|
echo "TOTAL COVERAGE:"
|
||||||
|
echo "($cov_len + $cov_len_2) / ($fff_len * 2)" | bc -l
|
||||||
Reference in New Issue
Block a user