MCPcopy Create free account
hub / github.com/andreasfertig/cppinsights / testCompare

Function testCompare

tests/runTest.py:42–58  ·  view source on GitHub ↗
(tmpFileName, stdout, expectFile, f, args, time)

Source from the content-addressed store, hash-verified

40#------------------------------------------------------------------------------
41
42def testCompare(tmpFileName, stdout, expectFile, f, args, time):
43 expect = open(expectFile, 'r', encoding='utf-8').read()
44
45 # align line-endings under Windows to Unix-style
46 if os.name == 'nt':
47 stdout = stdout.replace('\r\n', '\n')
48
49 if stdout != expect:
50 print('[FAILED] %s - %s' %(f, time))
51
52 for line in difflib.unified_diff(expect.splitlines(keepends=True), stdout.splitlines(keepends=True), fromfile=expectFile, tofile='stdout', n=3):
53 print('%s' %((line[1:] if line.startswith(' ') else line) ), end='')
54 else:
55 print('[PASSED] %-50s - %s' %(f, time))
56 return True
57
58 return False
59#------------------------------------------------------------------------------
60
61def testCompile(tmpFileName, f, args, fileName, cppStd):

Callers 1

mainFunction · 0.85

Calls 1

printFunction · 0.85

Tested by

no test coverage detected