Mercurial > hg > orthanc-python
changeset 2:df7b4f8a0437
coverage statistics
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 27 Mar 2020 07:59:20 +0100 |
parents | fef9a239df5c |
children | 26762eb9d704 |
files | CodeAnalysis/ParseOrthancSDK.py |
diffstat | 1 files changed, 15 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/CodeAnalysis/ParseOrthancSDK.py Thu Mar 26 18:50:10 2020 +0100 +++ b/CodeAnalysis/ParseOrthancSDK.py Fri Mar 27 07:59:20 2020 +0100 @@ -94,6 +94,8 @@ classes = {} enumerations = {} globalFunctions = [] +countAllFunctions = 0 +countSupportedFunctions = 0 def IsSourceStringType(t): return (t.kind == clang.cindex.TypeKind.POINTER and @@ -349,6 +351,7 @@ continue # Discard the context from the arguments + countAllFunctions += 1 args = args[1:] if not IsSupportedTargetType(node.result_type): @@ -360,6 +363,7 @@ print('Destructor: %s' % node.spelling) className = args[0].type.get_pointee().spelling classes[className]['destructor'] = node.spelling + countSupportedFunctions += 1 elif CheckOnlySupportedArguments(args): if IsClassType(node.result_type): @@ -369,6 +373,7 @@ body = GenerateFunctionBodyTemplate(node.spelling, node.result_type, args) globalFunctions.append(body) + countSupportedFunctions += 1 elif (len(args) >= 2 and IsTargetMemoryBufferType(args[0].type) and @@ -377,6 +382,7 @@ body = GenerateFunctionBodyTemplate(node.spelling, args[0].type, args[1:]) globalFunctions.append(body) + countSupportedFunctions += 1 elif (IsClassType(args[0].type) and CheckOnlySupportedArguments(args[1:])): @@ -390,6 +396,7 @@ method = GenerateFunctionBodyTemplate(node.spelling, node.result_type, args[1:]) method['self'] = ', self->object_' classes[className]['methods'].append(method) + countSupportedFunctions += 1 elif (len(args) >= 2 and IsTargetMemoryBufferType(args[0].type) and @@ -402,6 +409,7 @@ method = GenerateFunctionBodyTemplate(node.spelling, args[0].type, args[2:]) method['self'] = ', self->object_' classes[className]['methods'].append(method) + countSupportedFunctions += 1 else: print('*** UNSUPPORTED INPUT: %s' % node.spelling) @@ -466,3 +474,10 @@ h.write(renderer.render(f.read(), { 'classes' : FlattenDictionary(classes), })) + + +print('') +print('Total functions in the SDK: %d' % countAllFunctions) +print('Total supported functions: %d' % countSupportedFunctions) +print('Coverage: %.0f%%' % (float(countSupportedFunctions) / + float(countAllFunctions) * 100.0))