diff --git a/scripts/func_coverage.py b/scripts/func_coverage.py new file mode 100755 index 0000000..542c65e --- /dev/null +++ b/scripts/func_coverage.py @@ -0,0 +1,41 @@ +#!/usr/bin/env python3 + +import os + +funcs = {} + +for filename in os.listdir("."): + if filename.endswith(".scad"): + filepath = os.path.join(".",filename) + with open(filepath, "r") as f: + for i,line in enumerate(f.readlines()): + if line.startswith("function "): + funcname = line[9:].strip().split("(")[0].strip() + if funcname.startswith("_"): + continue + if funcname in funcs: + print("WARNING!!! Function {} re-defined at {}:{}".format(funcname, filename, i)); + print(" Previously defined at {}".format(funcs[funcname])); + else: + funcs[funcname] = filename + ":" + str(i) + +covered = [] +for filename in os.listdir("tests"): + if filename.startswith("test_") and filename.endswith(".scad"): + filepath = os.path.join("tests",filename) + with open(filepath, "r") as f: + for i,line in enumerate(f.readlines()): + if line.startswith("module "): + funcname = line[7:].strip().split("(")[0].strip().split("_",1)[1] + if funcname in funcs: + covered.append(funcname) + del funcs[funcname] + +for funcname in sorted(covered): + print("COVERED: function {}".format(funcname)) + +for funcname in sorted(list(funcs.keys())): + print("NOT COVERED: function {} ({})".format(funcname, funcs[funcname])) + + +# vim: expandtab tabstop=4 shiftwidth=4 softtabstop=4 nowrap diff --git a/version.scad b/version.scad index 45c5acf..910b538 100644 --- a/version.scad +++ b/version.scad @@ -8,7 +8,7 @@ ////////////////////////////////////////////////////////////////////// -BOSL_VERSION = [2,0,10]; +BOSL_VERSION = [2,0,11]; // Section: BOSL Library Version Functions