Store 'null' as the covered percentage when there are 0 covered and 0 uncovered lines. Fixes #16

This commit is contained in:
Marco Castelluccio 2017-03-17 13:48:44 +01:00
Родитель ae491fabae
Коммит b380ef88dc
6 изменённых файлов: 12 добавлений и 12 удалений

Просмотреть файл

@ -538,7 +538,7 @@ fn output_activedata_etl(results: &mut HashMap<String,Result>) {
"uncovered": orphan_uncovered,
"total_covered": orphan_covered.len(),
"total_uncovered": orphan_uncovered.len(),
"percentage_covered": orphan_covered.len() as f32 / cmp::max(1, orphan_covered.len() + orphan_uncovered.len()) as f32,
"percentage_covered": orphan_covered.len() as f32 / (orphan_covered.len() + orphan_uncovered.len()) as f32,
}
}));
}

Просмотреть файл

@ -1,2 +1,2 @@
{"language":"c/c++","file":{"name":"main.c"},"method":{"covered":[{"line":3},{"line":5},{"line":6},{"line":7},{"line":10},{"line":15}],"name":"main","percentage_covered":0.8571428656578064,"total_covered":6,"total_uncovered":1,"uncovered":[11]}}
{"language":"c/c++","file":{"covered":[{"line":3},{"line":5},{"line":6},{"line":7},{"line":10},{"line":15}],"name":"main.c","percentage_covered":0.8571428656578064,"total_covered":6,"total_uncovered":1,"uncovered":[11]},"is_file":true,"method":{"covered":[],"percentage_covered":0.0,"total_covered":0,"total_uncovered":0,"uncovered":[]}}
{"language":"c/c++","file":{"covered":[{"line":3},{"line":5},{"line":6},{"line":7},{"line":10},{"line":15}],"name":"main.c","percentage_covered":0.8571428656578064,"total_covered":6,"total_uncovered":1,"uncovered":[11]},"is_file":true,"method":{"covered":[],"percentage_covered":null,"total_covered":0,"total_uncovered":0,"uncovered":[]}}

Просмотреть файл

@ -1,5 +1,5 @@
{"language":"c/c++","file":{"name":"/usr/include/c++/6/bits/basic_string.h"},"method":{"covered":[{"line":5084},{"line":5086}],"name":"_ZSteqIcSt11char_traitsIcESaIcEEbRKNSt7__cxx1112basic_stringIT_T0_T1_EEPKS5_","percentage_covered":1.0,"total_covered":2,"total_uncovered":0,"uncovered":[]}}
{"language":"c/c++","file":{"covered":[{"line":5084},{"line":5086}],"name":"/usr/include/c++/6/bits/basic_string.h","percentage_covered":1.0,"total_covered":2,"total_uncovered":0,"uncovered":[]},"is_file":true,"method":{"covered":[],"percentage_covered":0.0,"total_covered":0,"total_uncovered":0,"uncovered":[]}}
{"language":"c/c++","file":{"covered":[{"line":5084},{"line":5086}],"name":"/usr/include/c++/6/bits/basic_string.h","percentage_covered":1.0,"total_covered":2,"total_uncovered":0,"uncovered":[]},"is_file":true,"method":{"covered":[],"percentage_covered":null,"total_covered":0,"total_uncovered":0,"uncovered":[]}}
{"language":"c/c++","file":{"covered":[{"line":74}],"name":"/usr/include/c++/6/iostream","percentage_covered":1.0,"total_covered":1,"total_uncovered":0,"uncovered":[]},"is_file":true,"method":{"covered":[{"line":74}],"percentage_covered":1.0,"total_covered":1,"total_uncovered":0,"uncovered":[]}}
{"language":"c/c++","file":{"name":"main.cpp"},"method":{"covered":[{"line":36}],"name":"_Z41__static_initialization_and_destruction_0ii","percentage_covered":1.0,"total_covered":1,"total_uncovered":0,"uncovered":[]}}
{"language":"c/c++","file":{"name":"main.cpp"},"method":{"covered":[{"line":24},{"line":26},{"line":28},{"line":29},{"line":31},{"line":35}],"name":"main","percentage_covered":0.8571428656578064,"total_covered":6,"total_uncovered":1,"uncovered":[32]}}
@ -9,4 +9,4 @@
{"language":"c/c++","file":{"name":"main.cpp"},"method":{"covered":[{"line":12},{"line":13}],"name":"_ZN4Ciao7getNameB5cxx11Ev","percentage_covered":1.0,"total_covered":2,"total_uncovered":0,"uncovered":[]}}
{"language":"c/c++","file":{"name":"main.cpp"},"method":{"covered":[{"line":8},{"line":9},{"line":10}],"name":"_ZN4Ciao7setNameENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE","percentage_covered":1.0,"total_covered":3,"total_uncovered":0,"uncovered":[]}}
{"language":"c/c++","file":{"name":"main.cpp"},"method":{"covered":[],"name":"_ZN4Ciao8uncalledEv","percentage_covered":0.0,"total_covered":0,"total_uncovered":3,"uncovered":[16,17,18]}}
{"language":"c/c++","file":{"covered":[{"line":6},{"line":8},{"line":9},{"line":10},{"line":12},{"line":13},{"line":24},{"line":26},{"line":28},{"line":29},{"line":31},{"line":35},{"line":36}],"name":"main.cpp","percentage_covered":0.7647058963775635,"total_covered":13,"total_uncovered":4,"uncovered":[16,17,18,32]},"is_file":true,"method":{"covered":[],"percentage_covered":0.0,"total_covered":0,"total_uncovered":0,"uncovered":[]}}
{"language":"c/c++","file":{"covered":[{"line":6},{"line":8},{"line":9},{"line":10},{"line":12},{"line":13},{"line":24},{"line":26},{"line":28},{"line":29},{"line":31},{"line":35},{"line":36}],"name":"main.cpp","percentage_covered":0.7647058963775635,"total_covered":13,"total_uncovered":4,"uncovered":[16,17,18,32]},"is_file":true,"method":{"covered":[],"percentage_covered":null,"total_covered":0,"total_uncovered":0,"uncovered":[]}}

Просмотреть файл

@ -3,12 +3,12 @@
{"language":"c/c++","file":{"name":"file.cpp"},"method":{"covered":[{"line":7},{"line":8},{"line":9}],"name":"_ZN4Ciao7getNameB5cxx11Ev","percentage_covered":1.0,"total_covered":3,"total_uncovered":0,"uncovered":[]}}
{"language":"c/c++","file":{"name":"file.cpp"},"method":{"covered":[{"line":3},{"line":4},{"line":5}],"name":"_ZN4Ciao7setNameENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE","percentage_covered":1.0,"total_covered":3,"total_uncovered":0,"uncovered":[]}}
{"language":"c/c++","file":{"name":"file.cpp"},"method":{"covered":[{"line":10}],"name":"_GLOBAL__sub_I__ZN4Ciao7setNameENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE","percentage_covered":1.0,"total_covered":1,"total_uncovered":0,"uncovered":[]}}
{"language":"c/c++","file":{"covered":[{"line":3},{"line":4},{"line":5},{"line":7},{"line":8},{"line":9},{"line":10}],"name":"file.cpp","percentage_covered":1.0,"total_covered":7,"total_uncovered":0,"uncovered":[]},"is_file":true,"method":{"covered":[],"percentage_covered":0.0,"total_covered":0,"total_uncovered":0,"uncovered":[]}}
{"language":"c/c++","file":{"covered":[{"line":3},{"line":4},{"line":5},{"line":7},{"line":8},{"line":9},{"line":10}],"name":"file.cpp","percentage_covered":1.0,"total_covered":7,"total_uncovered":0,"uncovered":[]},"is_file":true,"method":{"covered":[],"percentage_covered":null,"total_covered":0,"total_uncovered":0,"uncovered":[]}}
{"language":"c/c++","file":{"name":"include.h"},"method":{"covered":[{"line":10},{"line":11},{"line":12}],"name":"_ZN4Ciao14calledFromFileEv","percentage_covered":1.0,"total_covered":3,"total_uncovered":0,"uncovered":[]}}
{"language":"c/c++","file":{"name":"include.h"},"method":{"covered":[{"line":6}],"name":"_ZN4CiaoD2Ev","percentage_covered":1.0,"total_covered":1,"total_uncovered":0,"uncovered":[]}}
{"language":"c/c++","file":{"name":"include.h"},"method":{"covered":[{"line":6}],"name":"_ZN4CiaoC2Ev","percentage_covered":1.0,"total_covered":1,"total_uncovered":0,"uncovered":[]}}
{"language":"c/c++","file":{"covered":[{"line":6},{"line":10},{"line":11},{"line":12}],"name":"include.h","percentage_covered":1.0,"total_covered":4,"total_uncovered":0,"uncovered":[]},"is_file":true,"method":{"covered":[],"percentage_covered":0.0,"total_covered":0,"total_uncovered":0,"uncovered":[]}}
{"language":"c/c++","file":{"covered":[{"line":6},{"line":10},{"line":11},{"line":12}],"name":"include.h","percentage_covered":1.0,"total_covered":4,"total_uncovered":0,"uncovered":[]},"is_file":true,"method":{"covered":[],"percentage_covered":null,"total_covered":0,"total_uncovered":0,"uncovered":[]}}
{"language":"c/c++","file":{"name":"main.cpp"},"method":{"covered":[{"line":11}],"name":"_Z41__static_initialization_and_destruction_0ii","percentage_covered":1.0,"total_covered":1,"total_uncovered":0,"uncovered":[]}}
{"language":"c/c++","file":{"name":"main.cpp"},"method":{"covered":[{"line":11}],"name":"_GLOBAL__sub_I_main","percentage_covered":1.0,"total_covered":1,"total_uncovered":0,"uncovered":[]}}
{"language":"c/c++","file":{"name":"main.cpp"},"method":{"covered":[{"line":3},{"line":5},{"line":7},{"line":8},{"line":10}],"name":"main","percentage_covered":1.0,"total_covered":5,"total_uncovered":0,"uncovered":[]}}
{"language":"c/c++","file":{"covered":[{"line":3},{"line":5},{"line":7},{"line":8},{"line":10},{"line":11}],"name":"main.cpp","percentage_covered":1.0,"total_covered":6,"total_uncovered":0,"uncovered":[]},"is_file":true,"method":{"covered":[],"percentage_covered":0.0,"total_covered":0,"total_uncovered":0,"uncovered":[]}}
{"language":"c/c++","file":{"covered":[{"line":3},{"line":5},{"line":7},{"line":8},{"line":10},{"line":11}],"name":"main.cpp","percentage_covered":1.0,"total_covered":6,"total_uncovered":0,"uncovered":[]},"is_file":true,"method":{"covered":[],"percentage_covered":null,"total_covered":0,"total_uncovered":0,"uncovered":[]}}

Просмотреть файл

@ -1,16 +1,16 @@
{"language":"c/c++","file":{"name":"main.cpp"},"method":{"covered":[{"line":3},{"line":5},{"line":7},{"line":8},{"line":10},{"line":14}],"name":"main","percentage_covered":0.8571428656578064,"total_covered":6,"total_uncovered":1,"uncovered":[11]}}
{"language":"c/c++","file":{"name":"main.cpp"},"method":{"covered":[{"line":15}],"name":"_Z41__static_initialization_and_destruction_0ii","percentage_covered":1.0,"total_covered":1,"total_uncovered":0,"uncovered":[]}}
{"language":"c/c++","file":{"name":"main.cpp"},"method":{"covered":[{"line":15}],"name":"_GLOBAL__sub_I_main","percentage_covered":1.0,"total_covered":1,"total_uncovered":0,"uncovered":[]}}
{"language":"c/c++","file":{"covered":[{"line":3},{"line":5},{"line":7},{"line":8},{"line":10},{"line":14},{"line":15}],"name":"main.cpp","percentage_covered":0.875,"total_covered":7,"total_uncovered":1,"uncovered":[11]},"is_file":true,"method":{"covered":[],"percentage_covered":0.0,"total_covered":0,"total_uncovered":0,"uncovered":[]}}
{"language":"c/c++","file":{"covered":[{"line":3},{"line":5},{"line":7},{"line":8},{"line":10},{"line":14},{"line":15}],"name":"main.cpp","percentage_covered":0.875,"total_covered":7,"total_uncovered":1,"uncovered":[11]},"is_file":true,"method":{"covered":[],"percentage_covered":null,"total_covered":0,"total_uncovered":0,"uncovered":[]}}
{"language":"c/c++","file":{"name":"/usr/include/c++/6/bits/basic_string.h"},"method":{"covered":[{"line":5084},{"line":5086}],"name":"_ZSteqIcSt11char_traitsIcESaIcEEbRKNSt7__cxx1112basic_stringIT_T0_T1_EEPKS5_","percentage_covered":1.0,"total_covered":2,"total_uncovered":0,"uncovered":[]}}
{"language":"c/c++","file":{"covered":[{"line":5084},{"line":5086}],"name":"/usr/include/c++/6/bits/basic_string.h","percentage_covered":1.0,"total_covered":2,"total_uncovered":0,"uncovered":[]},"is_file":true,"method":{"covered":[],"percentage_covered":0.0,"total_covered":0,"total_uncovered":0,"uncovered":[]}}
{"language":"c/c++","file":{"covered":[{"line":5084},{"line":5086}],"name":"/usr/include/c++/6/bits/basic_string.h","percentage_covered":1.0,"total_covered":2,"total_uncovered":0,"uncovered":[]},"is_file":true,"method":{"covered":[],"percentage_covered":null,"total_covered":0,"total_uncovered":0,"uncovered":[]}}
{"language":"c/c++","file":{"name":"include.h"},"method":{"covered":[{"line":10},{"line":11},{"line":12}],"name":"_ZN4Ciao14calledFromFileEv","percentage_covered":1.0,"total_covered":3,"total_uncovered":0,"uncovered":[]}}
{"language":"c/c++","file":{"name":"include.h"},"method":{"covered":[{"line":6}],"name":"_ZN4CiaoC2Ev","percentage_covered":1.0,"total_covered":1,"total_uncovered":0,"uncovered":[]}}
{"language":"c/c++","file":{"name":"include.h"},"method":{"covered":[{"line":6}],"name":"_ZN4CiaoD2Ev","percentage_covered":1.0,"total_covered":1,"total_uncovered":0,"uncovered":[]}}
{"language":"c/c++","file":{"covered":[{"line":6},{"line":10},{"line":11},{"line":12}],"name":"include.h","percentage_covered":1.0,"total_covered":4,"total_uncovered":0,"uncovered":[]},"is_file":true,"method":{"covered":[],"percentage_covered":0.0,"total_covered":0,"total_uncovered":0,"uncovered":[]}}
{"language":"c/c++","file":{"covered":[{"line":6},{"line":10},{"line":11},{"line":12}],"name":"include.h","percentage_covered":1.0,"total_covered":4,"total_uncovered":0,"uncovered":[]},"is_file":true,"method":{"covered":[],"percentage_covered":null,"total_covered":0,"total_uncovered":0,"uncovered":[]}}
{"language":"c/c++","file":{"covered":[{"line":74}],"name":"/usr/include/c++/6/iostream","percentage_covered":1.0,"total_covered":1,"total_uncovered":0,"uncovered":[]},"is_file":true,"method":{"covered":[{"line":74}],"percentage_covered":1.0,"total_covered":1,"total_uncovered":0,"uncovered":[]}}
{"language":"c/c++","file":{"name":"file.cpp"},"method":{"covered":[{"line":7},{"line":8},{"line":9}],"name":"_ZN4Ciao7getNameB5cxx11Ev","percentage_covered":1.0,"total_covered":3,"total_uncovered":0,"uncovered":[]}}
{"language":"c/c++","file":{"name":"file.cpp"},"method":{"covered":[{"line":10}],"name":"_GLOBAL__sub_I__ZN4Ciao7setNameENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE","percentage_covered":1.0,"total_covered":1,"total_uncovered":0,"uncovered":[]}}
{"language":"c/c++","file":{"name":"file.cpp"},"method":{"covered":[{"line":10}],"name":"_Z41__static_initialization_and_destruction_0ii","percentage_covered":1.0,"total_covered":1,"total_uncovered":0,"uncovered":[]}}
{"language":"c/c++","file":{"name":"file.cpp"},"method":{"covered":[{"line":3},{"line":4},{"line":5}],"name":"_ZN4Ciao7setNameENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE","percentage_covered":1.0,"total_covered":3,"total_uncovered":0,"uncovered":[]}}
{"language":"c/c++","file":{"covered":[{"line":3},{"line":4},{"line":5},{"line":7},{"line":8},{"line":9},{"line":10}],"name":"file.cpp","percentage_covered":1.0,"total_covered":7,"total_uncovered":0,"uncovered":[]},"is_file":true,"method":{"covered":[],"percentage_covered":0.0,"total_covered":0,"total_uncovered":0,"uncovered":[]}}
{"language":"c/c++","file":{"covered":[{"line":3},{"line":4},{"line":5},{"line":7},{"line":8},{"line":9},{"line":10}],"name":"file.cpp","percentage_covered":1.0,"total_covered":7,"total_uncovered":0,"uncovered":[]},"is_file":true,"method":{"covered":[],"percentage_covered":null,"total_covered":0,"total_uncovered":0,"uncovered":[]}}

Просмотреть файл

@ -7,4 +7,4 @@
{"language":"c/c++","file":{"name":"main.cpp"},"method":{"covered":[{"line":24},{"line":25},{"line":26},{"line":28},{"line":29},{"line":30},{"line":31},{"line":32}],"name":"main","percentage_covered":1.0,"total_covered":8,"total_uncovered":0,"uncovered":[]}}
{"language":"c/c++","file":{"name":"main.cpp"},"method":{"covered":[{"line":6}],"name":"_ZN4CiaoINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEC2Ev","percentage_covered":1.0,"total_covered":1,"total_uncovered":0,"uncovered":[]}}
{"language":"c/c++","file":{"name":"main.cpp"},"method":{"covered":[{"line":6}],"name":"_ZN4CiaoINSt7__cxx1112basic_stringIwSt11char_traitsIwESaIwEEEEC2Ev","percentage_covered":1.0,"total_covered":1,"total_uncovered":0,"uncovered":[]}}
{"language":"c/c++","file":{"covered":[{"line":6},{"line":11},{"line":12},{"line":13},{"line":15},{"line":16},{"line":19},{"line":20},{"line":24},{"line":25},{"line":26},{"line":28},{"line":29},{"line":30},{"line":31},{"line":32}],"name":"main.cpp","percentage_covered":1.0,"total_covered":16,"total_uncovered":0,"uncovered":[]},"is_file":true,"method":{"covered":[],"percentage_covered":0.0,"total_covered":0,"total_uncovered":0,"uncovered":[]}}
{"language":"c/c++","file":{"covered":[{"line":6},{"line":11},{"line":12},{"line":13},{"line":15},{"line":16},{"line":19},{"line":20},{"line":24},{"line":25},{"line":26},{"line":28},{"line":29},{"line":30},{"line":31},{"line":32}],"name":"main.cpp","percentage_covered":1.0,"total_covered":16,"total_uncovered":0,"uncovered":[]},"is_file":true,"method":{"covered":[],"percentage_covered":null,"total_covered":0,"total_uncovered":0,"uncovered":[]}}