# HG changeset patch # User Sebastien Jodogne # Date 1585292360 -3600 # Node ID df7b4f8a0437fda76e20a679729c136ab9a1d443 # Parent fef9a239df5c9cc862fb859ad787337ad8c65cfd coverage statistics diff -r fef9a239df5c -r df7b4f8a0437 CodeAnalysis/ParseOrthancSDK.py --- 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))