MCPcopy Create free account
hub / github.com/Kitware/VTK / TestFile

Method TestFile

Testing/Core/HeaderTesting.py:95–128  ·  view source on GitHub ↗
(self, filename)

Source from the content-addressed store, hash-verified

93 self.Print( "* %s" % a )
94
95 def TestFile(self, filename):
96 self.FileName = filename
97 self.FileLines = []
98 self.ClassName = ""
99 self.ParentName = ""
100 self.HasIncludes = False
101 self.HasTypedef = False
102 self.HasClass = False
103 self.HasFunction = False
104
105 classre = "^class(\\s+VTK_DEPRECATED)?(\\s+[^\\s]*_EXPORT)?\\s+(vtkm?[A-Z0-9_][^ :\n]*)\\s*:\\s*public\\s+(vtk[^ \n\\{]*)"
106 regx = re.compile(classre)
107 try:
108 file = open(filename, encoding='ascii', errors='ignore')
109 self.FileLines = file.readlines()
110 file.close()
111 funcre = "[a-zA-Z0-9_]*\\s+[a-zA-Z0-9_]*\\s*\\([^\n\\{]*\\);"
112 funcregex = re.compile(funcre)
113
114 for l in self.FileLines:
115 line = l.strip()
116 if "#include" == line[:8]:
117 self.HasIncludes = True
118 if regx.match(line):
119 self.HasClass = True
120 if "typedef" == line[:7] or "using" == line[:5]:
121 self.HasTypedef = True
122 if funcregex.match(line):
123 self.HasFunction = True
124 except:
125 self.Print("Problem reading file %s:\n%s" %
126 (filename, str(sys.exc_info()[1])))
127 sys.exit(1)
128 return not self.CheckExclude()
129
130 def CheckExclude(self):
131 self.ExcludeNamespaceCheck = False

Callers 1

HeaderTesting.pyFile · 0.80

Calls 7

PrintMethod · 0.95
CheckExcludeMethod · 0.95
strFunction · 0.85
compileMethod · 0.80
closeMethod · 0.45
matchMethod · 0.45
exitMethod · 0.45

Tested by

no test coverage detected