diff --git a/scripts/sivalidateVSTests.py b/scripts/sivalidateVSTests.py new file mode 100644 index 00000000..f21a48a1 --- /dev/null +++ b/scripts/sivalidateVSTests.py @@ -0,0 +1,768 @@ +#!/c/Python27/python + +import os +import sys +import subprocess +import re + +import xml.etree.cElementTree as etree + +from scriptCommon import catchPath +from catch_test_run import TestRunApprovedHandler +from catch_test_run import TestRunData +from catch_test_run import TestRunResultHandler +from catch_test_case import TestCaseResultParser +from catch_test_case import TestCaseData +from catch_conditions import RandomOutput + +rootPath = os.path.join(os.path.join(os.path.join( catchPath, 'single_include_projects'), 'SelfTest'), 'Baselines' ) + +if len(sys.argv) == 2: + cmdPath = sys.argv[1] +else: + if sys.platform == 'win32': + cmdPath = os.path.join( catchPath, 'single_include_projects\\VS2010\\TestCatch\\Release\\TestCatch.exe' ) + # VS2010 + dllPath = os.path.join( catchPath, 'single_include_projects\\VS2010\\ManagedTestCatch\\Release\\ManagedTestCatch.dll' ) + #dllPath = os.path.join( catchPath, 'single_include_projects\\VS2010\\ManagedTestCatch\\Debug\\ManagedTestCatch.dll' ) + # VS2012 managed + #dllPath = os.path.join( catchPath, 'single_include_projects\\VS2012\\ManagedTestCatch\\Debug\\ManagedTestCatch.dll' ) + # VS2012 native + #dllPath = os.path.join( catchPath, 'single_include_projects\\VS2012\\NativeTestCatch\\Debug\\NativeTestCatch.dll' ) + else: + cmdPath = os.path.join( catchPath, 'single_include_projects/XCode4/CatchSelfTest/DerivedData/CatchSelfTest/Build/Products/Debug/CatchSelfTest' ) + +print cmdPath + +overallResult = 0 + +def approve( baseName, args ): + global overallResult + args[0:0] = [cmdPath] + baselinesPath = os.path.join( rootPath, '{0}.approved.txt'.format( baseName ) ) + baselinesSortedPath = os.path.join( rootPath, '{0}.sorted.approved.txt'.format( baseName ) ) + rawResultsPath = os.path.join( rootPath, '_{0}.tmp'.format( baseName ) ) + if os.path.exists( baselinesPath ): + approvedFileHandler = TestRunApprovedHandler(baselinesPath) + #baselinesPathNew = os.path.join( rootPath, '{0}.approved.new.txt'.format( baseName ) ) + #approvedFileHandler.writeRawFile(baselinesPathNew) + approvedFileHandler.writeSortedRawFile(baselinesSortedPath) + else: + raise Exception("Base file does not exist: '" + baselinesPath + "'") + + if not(os.path.exists( args[0] )): + raise Exception("Executable does not exist: '" + args[0] + "'") + + f = open( rawResultsPath, 'w' ) + subprocess.call( args, stdout=f, stderr=f ) + f.close() + + if os.path.exists( rawResultsPath ): + resultFileHandler = TestRunResultHandler(rawResultsPath) + #rawPathNew = os.path.join( rootPath, '{0}.rewrite.txt'.format( baseName ) ) + #print "F:",rawPathNew,",",approvedFileHandler.current.outputLine + #resultFileHandler.writeRawFile(rawPathNew) + rawPathNewSorted = os.path.join( rootPath, '{0}.sorted.unapproved.txt'.format( baseName ) ) + resultFileHandler.writeSortedUnapprovedFile(rawPathNewSorted, approvedFileHandler.current.outputLine) + os.remove( rawResultsPath ) + else: + raise Exception("Results file does not exist: '" + rawResultsPath + "'") + +def callDiff(): + #os.remove( rawResultsPath ) + print + print baseName + ":" + if os.path.exists( baselinesSortedPath ) and os.path.exists( rawPathNewSorted ): + diffResult = subprocess.call([ "diff", "--ignore-all-space", baselinesSortedPath, rawPathNewSorted ] ) + if diffResult == 0: + #os.remove( filteredResultsPath ) + if not(sys.platform == 'win32'): + print " \033[92mResults matched" + else: + print " Results matched" + else: + if not(sys.platform == 'win32'): + print " \n****************************\n \033[91mResults differed" + else: + print " \n****************************\n Results differed" + if diffResult > overallResult: + overallResult = diffResult + if not(sys.platform == 'win32'): + print "\033[0m" + +def approveJunit( baseName, args ): + global overallResult + args[0:0] = [cmdPath] + baselinesPath = os.path.join( rootPath, '{0}.approved.txt'.format( baseName ) ) + baselinesSortedPath = os.path.join( rootPath, '{0}.sorted.approved.txt'.format( baseName ) ) + #baselinesFixedPath = os.path.join( rootPath, '{0}.rewrite.approved.txt'.format( baseName ) ) + rawResultsPath = os.path.join( rootPath, '_{0}.tmp'.format( baseName ) ) + if os.path.exists( baselinesPath ): + xml = "" + f = open( baselinesPath, 'r' ) + for line in f: + xml += line + xml = xml.replace("", "<line number>") + xml = xml.replace("", "<hex digits>") + #f2 = open( baselinesFixedPath, 'wb' ) + #f2.write(xml) + #f2.close() + + # ClassTests.cpp: + otherApprovedTestParser = re.compile( r'(.*\..pp).*:<(.*).*>' ) + testRun = TestRunData() + testcase = None + root = etree.fromstring(xml) + for testsuites in root: + if testsuites.tag == "testsuite": + testRun = TestRunData() + testRun.appname = testsuites.get("name") + testRun.errors = testsuites.get("errors") + testRun.failures = testsuites.get("failures") + testRun.tests = testsuites.get("tests") + for tc in testsuites: + if tc.tag == "testcase": + cls = tc.get("classname") + #print "C:",cls,tc + if len(cls): + testcase = testRun.addClassTestCase(cls, tc.get("name")) + else: + testcase = testRun.addTestCase(tc.get("name")) + for prop in tc: + if prop.tag == "failure": + text = prop.text.strip() + lines = text.splitlines() + filename = "" + lineNumber = "" + output = [] + for l in lines: + m = otherApprovedTestParser.match(l) + if m: + filename = m.group(1) + lineNumber = m.group(2) + else: + output.append(l) + testcase.addFailure(filename, lineNumber, output, prop.get("message"), prop.get("type")) + elif prop.tag == "error": + text = prop.text.strip() + lines = text.splitlines() + filename = "" + lineNumber = "" + output = [] + for l in lines: + m = otherApprovedTestParser.match(l) + if m: + filename = m.group(1) + lineNumber = m.group(2) + else: + output.append(l) + testcase.addError(filename, lineNumber, output, prop.get("message"), prop.get("type")) + elif prop.tag == "system-out": + text = prop.text.strip() + lines = text.splitlines() + testcase.addSysout(lines) + elif prop.tag == "system-err": + text = prop.text.strip() + lines = text.splitlines() + testcase.addSyserr(lines) + elif tc.tag == "system-out": + text = tc.text.strip() + lines = text.splitlines() + testRun.addSysout(lines) + elif tc.tag == "system-err": + text = tc.text.strip() + lines = text.splitlines() + testRun.addSyserr(lines) + else: + print tc.tag + + lines = testRun.generateSortedUnapprovedJunit() + + rawWriteFile = open( baselinesSortedPath, 'wb' ) + for line in lines: + #print "L:",line + rawWriteFile.write(line + "\n") + rawWriteFile.close() + + if not(os.path.exists( args[0] )): + raise Exception("Executable does not exist: '" + args[0] + "'") + + f = open( rawResultsPath, 'w' ) + subprocess.call( args, stdout=f, stderr=f ) + f.close() + + rawSortedPath = os.path.join( rootPath, '{0}.sorted.unapproved.txt'.format( baseName ) ) + if os.path.exists( rawResultsPath ): + xml = "" + f = open( rawResultsPath, 'r' ) + for line in f: + xml += line + #xml = xml.replace("", "<line number>") + #xml = xml.replace("", "<hex digits>") + + # ClassTests.cpp: + otherResultsTestParser = re.compile( r'(.*\\)(.*\..pp).*\((.*).*\)' ) + testRun = TestRunData() + testcase = None + root = etree.fromstring(xml) + for testsuites in root: + if testsuites.tag == "testsuite": + testRun = TestRunData() + testRun.appname = testsuites.get("name") + testRun.errors = testsuites.get("errors") + testRun.failures = testsuites.get("failures") + testRun.tests = testsuites.get("tests") + for tc in testsuites: + if tc.tag == "testcase": + cls = tc.get("classname") + #print "C:",cls,tc + if len(cls): + if cls.startswith("::"): + cls = cls[2:] + testcase = testRun.addClassTestCase(cls, tc.get("name")) + else: + testcase = testRun.addTestCase(tc.get("name")) + for prop in tc: + if prop.tag == "failure": + text = prop.text.strip() + lines = text.splitlines() + filename = "" + lineNumber = "" + output = [] + for l in lines: + m = otherResultsTestParser.match(l) + if m: + filename = m.group(2) + lineNumber = "line number" + else: + output.append(l) + testcase.addFailure(filename, lineNumber, output, prop.get("message"), prop.get("type")) + elif prop.tag == "error": + text = prop.text.strip() + lines = text.splitlines() + filename = "" + lineNumber = "" + output = [] + for l in lines: + m = otherResultsTestParser.match(l) + if m: + filename = m.group(2) + lineNumber = "line number" + else: + output.append(l) + testcase.addError(filename, lineNumber, output, prop.get("message"), prop.get("type")) + elif prop.tag == "system-out": + text = prop.text.strip() + lines = text.splitlines() + testcase.addSysout(lines) + elif prop.tag == "system-err": + text = prop.text.strip() + lines = text.splitlines() + testcase.addSyserr(lines) + elif tc.tag == "system-out": + text = tc.text.strip() + lines = text.splitlines() + testRun.addSysout(lines) + elif tc.tag == "system-err": + text = tc.text.strip() + lines = text.splitlines() + testRun.addSyserr(lines) + else: + print tc.tag + + lines = testRun.generateSortedUnapprovedJunit() + + rawWriteFile = open( rawSortedPath, 'wb' ) + for line in lines: + #print "L:",line + rawWriteFile.write(line + "\n") + rawWriteFile.close() + +def addSubSection(testcase, section, exp): + r = exp.find("OverallResults") + if r != None: + ores = [] + ores.append(r.get("successes")) + ores.append(r.get("failures")) + if section == None: + section = testcase.addSection(exp.get("name"), exp.get("description"), ores) + else: + section = testcase.addSubSection(section, exp.get("name"), exp.get("description"), ores) + e1 = False + for tmp in exp: + if tmp.tag == "OverallResults": + pass + elif tmp.tag == "Exception": + filename = tmp.get("filename") + text = tmp.text + ls = text.splitlines() + testcase.addSubException(section, filename, ls) + elif tmp.tag == "Section": + addSubSection(testcase, section, tmp) + elif tmp.tag == "Failure": + text = tmp.text + ls = text.splitlines() + testcase.addSubFailure(section, ls) + elif tmp.tag == "Expression": + #print "Exp:",tmp + e1 = True + result = tmp.get("success") + filename = tmp.get("filename") + subSection = testcase.addSubExpression(section,result,filename) + subExp = [] + for cond in tmp: + if cond.tag == "Original": + text = cond.text + ls = text.splitlines() + subExp.append(ls) + elif cond.tag == "Expanded" and len(subExp) == 1: + text = cond.text + ls = text.splitlines() + subExp.append(ls) + elif cond.tag == "Exception" and len(subExp) == 2: + subExp.append(cond.get("filename")) + text = cond.text + ls = text.splitlines() + subExp.append(ls) + else: + print "SX:",cond.tag + if len(subExp) >= 2: + testcase.addExpressionDetails(subSection, subExp) + else: + print "Z:",tmp.tag + #if e1: + # print "Section:",section + +def addResultsSubSection(otherResultsTestParser, testcase, section, exp): + r = exp.find("OverallResults") + if r != None: + ores = [] + ores.append(r.get("successes")) + ores.append(r.get("failures")) + if section == None: + section = testcase.addSection(exp.get("name"), exp.get("description"), ores) + else: + section = testcase.addSubSection(section, exp.get("name"), exp.get("description"), ores) + e1 = False + for tmp in exp: + if tmp.tag == "OverallResults": + pass + elif tmp.tag == "Exception": + filename = tmp.get("filename") + m = otherResultsTestParser.match(filename) + if m: + filename = "/Users/philnash/Dev/OSS/Catch/projects/SelfTest/" + m.group(2) + text = tmp.text + ls = text.splitlines() + testcase.addSubException(section, filename, ls) + elif tmp.tag == "Section": + addResultsSubSection(otherResultsTestParser, testcase, section, tmp) + elif tmp.tag == "Failure": + text = tmp.text + ls = text.splitlines() + testcase.addSubFailure(section, ls) + elif tmp.tag == "Expression": + #print "Exp:",tmp + e1 = True + result = tmp.get("success") + filename = tmp.get("filename") + m = otherResultsTestParser.match(filename) + if m: + filename = "/Users/philnash/Dev/OSS/Catch/projects/SelfTest/" + m.group(2) + subSection = testcase.addSubExpression(section,result,filename) + subExp = [] + for cond in tmp: + if cond.tag == "Original": + text = cond.text + ls = text.splitlines() + subExp.append(ls) + elif cond.tag == "Expanded" and len(subExp) == 1: + text = cond.text + ls = text.splitlines() + subExp.append(ls) + elif cond.tag == "Exception" and len(subExp) == 2: + filename = cond.get("filename") + m = otherResultsTestParser.match(filename) + if m: + filename = "/Users/philnash/Dev/OSS/Catch/projects/SelfTest/" + m.group(2) + subExp.append(filename) + text = cond.text + ls = text.splitlines() + subExp.append(ls) + else: + print "SX:",cond.tag + if len(subExp) >= 2: + testcase.addExpressionDetails(subSection, subExp) + else: + print "Z:",tmp.tag + #if e1: + # print "Section:",section + +def approveXml( baseName, args ): + global overallResult + args[0:0] = [cmdPath] + baselinesPath = os.path.join( rootPath, '{0}.approved.txt'.format( baseName ) ) + baselinesSortedPath = os.path.join( rootPath, '{0}.sorted.approved.txt'.format( baseName ) ) + #baselinesFixedPath = os.path.join( rootPath, '{0}.rewrite.approved.txt'.format( baseName ) ) + rawResultsPath = os.path.join( rootPath, '_{0}.tmp'.format( baseName ) ) + if os.path.exists( baselinesPath ): + xml = "" + f = open( baselinesPath, 'r' ) + for line in f: + xml += line + xml = xml.replace("", "<hex digits>") + + #otherApprovedTestParser = re.compile( r'(.*\..pp).*:<(.*).*>' ) + testRun = TestRunData() + testcase = None + root = etree.fromstring(xml) + testRun.appname = root.get("name") + for ts in root: + #print ts.tag + for tc in ts: + if tc.tag == "TestCase": + testcase = testRun.addTestCase(tc.get("name")) + for exp in tc: + if exp.tag == "Expression": + result = exp.get("success") + filename = exp.get("filename") + section = testcase.addExpression(result,filename) + subExp = [] + for cond in exp: + if cond.tag == "Original": + text = cond.text + ls = text.splitlines() + subExp.append(ls) + elif cond.tag == "Expanded" and len(subExp) == 1: + text = cond.text + ls = text.splitlines() + subExp.append(ls) + elif cond.tag == "Exception" and len(subExp) == 2: + subExp.append(cond.get("filename")) + text = cond.text + ls = text.splitlines() + subExp.append(ls) + else: + print "X:",cond.tag + if len(subExp) >= 2: + testcase.addExpressionDetails(section, subExp) + elif exp.tag == "Exception": + filename = exp.get("filename") + text = exp.text + ls = text.splitlines() + section = testcase.addException(filename,ls) + elif exp.tag == "Section": + addSubSection(testcase, None, exp) + elif exp.tag == "Info": + text = exp.text + ls = text.splitlines() + section = testcase.addInfo(ls) + elif exp.tag == "Warning": + text = exp.text + ls = text.splitlines() + section = testcase.addWarning(ls) + elif exp.tag == "Failure": + ls = [] + if exp.text != None: + text = exp.text + ls = text.splitlines() + section = testcase.addSimpleFailure(ls) + elif exp.tag == "OverallResult": + testcase.addOverallResult(exp.get("success")) + else: + print "E:",exp.tag + elif tc.tag == "OverallResults": + testRun.tests = tc.get("successes") + testRun.failures = tc.get("failures") + else: + print "U:",tc.tag + + lines = testRun.generateSortedUnapprovedXml() + + rawWriteFile = open( baselinesSortedPath, 'wb' ) + for line in lines: + #print "L:",line + rawWriteFile.write(line + "\n") + rawWriteFile.close() + + if not(os.path.exists( args[0] )): + raise Exception("Executable does not exist: '" + args[0] + "'") + + f = open( rawResultsPath, 'w' ) + subprocess.call( args, stdout=f, stderr=f ) + f.close() + + rawSortedPath = os.path.join( rootPath, '{0}.sorted.unapproved.txt'.format( baseName ) ) + if os.path.exists( rawResultsPath ): + xml = "" + f = open( rawResultsPath, 'r' ) + for line in f: + xml += line + f.close() + #xml = xml.replace("", "<hex digits>") + os.remove( rawResultsPath ) + + otherResultsTestParser = re.compile( r'(.*\\)(.*\..pp)' ) + hexParser = re.compile( r'(.*)\b(0[xX][0-9a-fA-F]+)\b(.*)' ) + testRun = TestRunData() + testcase = None + root = etree.fromstring(xml) + testRun.appname = root.get("name") + if testRun.appname == "TestCatch.exe": + testRun.appname = "CatchSelfTest" + for ts in root: + #print ts.tag + for tc in ts: + if tc.tag == "TestCase": + testcase = testRun.addTestCase(tc.get("name")) + for exp in tc: + if exp.tag == "Expression": + result = exp.get("success") + filename = exp.get("filename") + m = otherResultsTestParser.match(filename) + if m: + filename = "/Users/philnash/Dev/OSS/Catch/projects/SelfTest/" + m.group(2) + section = testcase.addExpression(result,filename) + subExp = [] + for cond in exp: + if cond.tag == "Original": + text = cond.text + tmp = text.splitlines() + ls = [] + for li in tmp: + m = hexParser.match(li) + if m: + while m: + #print li, m.group(1), m.group(3) + li = m.group(1) + "0x" + m.group(3) + m = hexParser.match(li) + ls.append(li) + subExp.append(ls) + elif cond.tag == "Expanded" and len(subExp) == 1: + text = cond.text + tmp = text.splitlines() + ls = [] + for li in tmp: + m = hexParser.match(li) + if m: + while m: + #print li, m.group(1), m.group(3) + li = m.group(1) + "0x" + m.group(3) + m = hexParser.match(li) + ls.append(li) + subExp.append(ls) + elif cond.tag == "Exception" and len(subExp) == 2: + filename = cond.get("filename") + m = otherResultsTestParser.match(filename) + if m: + filename = "/Users/philnash/Dev/OSS/Catch/projects/SelfTest/" + m.group(2) + subExp.append(filename) + text = cond.text + ls = text.splitlines() + subExp.append(ls) + else: + print "X:",cond.tag + if len(subExp) >= 2: + testcase.addExpressionDetails(section, subExp) + elif exp.tag == "Exception": + filename = exp.get("filename") + m = otherResultsTestParser.match(filename) + if m: + filename = "/Users/philnash/Dev/OSS/Catch/projects/SelfTest/" + m.group(2) + text = exp.text + ls = text.splitlines() + section = testcase.addException(filename,ls) + elif exp.tag == "Section": + addResultsSubSection(otherResultsTestParser, testcase, None, exp) + elif exp.tag == "Info": + text = exp.text + ls = text.splitlines() + section = testcase.addInfo(ls) + elif exp.tag == "Warning": + text = exp.text + ls = text.splitlines() + section = testcase.addWarning(ls) + elif exp.tag == "Failure": + ls = [] + if exp.text != None: + text = exp.text + ls = text.splitlines() + section = testcase.addSimpleFailure(ls) + elif exp.tag == "OverallResult": + testcase.addOverallResult(exp.get("success")) + else: + print "E:",exp.tag + elif tc.tag == "OverallResults": + testRun.tests = tc.get("successes") + testRun.failures = tc.get("failures") + else: + print "U:",tc.tag + + lines = testRun.generateSortedUnapprovedXml() + + rawWriteFile = open( rawSortedPath, 'wb' ) + for line in lines: + #print "L:",line + rawWriteFile.write(line + "\n") + rawWriteFile.close() + +def parseTrxFile(baseName, trxFile): + print "TRX file:" ,trxFile + if os.path.exists( trxFile ): + xml = "" + f = open( trxFile, 'r' ) + for line in f: + xml += line + + #otherResultsTestParser = re.compile( r'(.*\\)(.*\..pp)' ) + #hexParser = re.compile( r'(.*)\b(0[xX][0-9a-fA-F]+)\b(.*)' ) + testRun = TestRunData() + testRun.appname = "CatchSelfTest" + root = etree.fromstring(xml) + if testRun.appname == "TestCatch.exe": + testRun.appname = "CatchSelfTest" + qname=re.compile("{(?P.*)}(?P.*)") + ids = [] + for ts in root: + m = qname.match(ts.tag) + if m: + tag = m.group(2) + print tag + if tag != None: + if tag == "TestDefinitions": + for tc in ts: + m = qname.match(tc.tag) + if m: + tag = m.group(2) + if tag != None and tag == "UnitTest": + name = tc.get("name") + id = tc.get("id") + for item in tc: + m = qname.match(item.tag) + if m: + tag = m.group(2) + if tag != None and tag == "Description": + desc = item.text + #print desc, id + ids.append([id,desc]) + elif tag == "Results": + #print ids + ids = dict(ids) + #print ids["87ec526a-e414-1a3f-ba0f-e210b204bb42"] + + lineNumber = 0 + resultParser = TestCaseResultParser() + for tc in ts: + m = qname.match(tc.tag) + if m: + tag = m.group(2) + if tag != None and tag == "UnitTestResult": + outcome = tc.get("outcome") + id = tc.get("testId") + if len(id) > 0: + for item in tc: + m = qname.match(item.tag) + if m: + tag = m.group(2) + if tag != None and tag == "Output": + for sub in item: + m = qname.match(sub.tag) + if m: + tag = m.group(2) + if tag != None and tag == "StdOut": + desc = sub.text + lines = desc.splitlines() + found = False + index = 0 + for tmp in lines: + if (len(lines) >= (index + 2) and + lines[index].startswith("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~") and + lines[index + 1].startswith("Batch run using") ): + found = True + break + index += 1 + lines = lines[index + 3:] + #print "*******",desc + #print lines + if found: + endOfRun = False + for line in lines: + if endOfRun: + testRun.results = line.strip() + else: + try: + testcase = resultParser.parseResultLine(line) + except RandomOutput as e: + #print "E:", self.lineNumber, ", ",e.output + testRun.output = e.output + testRun.outputLine = lineNumber - len(e.output) + if isinstance(testcase, TestCaseData): + testRun.testcases.append(testcase) + if line.startswith("==============================================================================="): + endOfRun = True + lineNumber += 1 + lines = testRun.generateSortedUnapprovedLines(testRun.outputLine) + + rawSortedPath = os.path.join( rootPath, '{0}.sorted.unapproved.txt'.format( baseName ) ) + rawWriteFile = open( rawSortedPath, 'wb' ) + for line in lines: + #print "L:",line + rawWriteFile.write(line + "\n") + rawWriteFile.close() + + +def approveMsTest( baseName, filter ): + rawResultsPath = os.path.join( rootPath, '_{0}.tmp'.format( baseName ) ) + if not(os.path.exists( dllPath )): + raise Exception("Managed DLL does not exist: '" + dllPath + "'") + + args = [] + # Options for VS2010 + args.append("MSTest.exe") + args.append("/testcontainer:" + dllPath) + args.append("/category:\"" + filter + "\"") + + # Options for VS2012 managed + #args.append("vstest.console.exe") + #args.append("/Logger:Trx") + #args.append(dllPath) + #args.append("/TestCaseFilter:TestCategory=" + filter) + + # Options for VS2012 native + #args.append("vstest.console.exe") + #args.append("/Logger:Trx") + #args.append(dllPath) + #args.append("/TestCaseFilter:Owner=" + filter) + + #print args + f = open( rawResultsPath, 'w' ) + subprocess.call( args, stdout=f, stderr=f ) + f.close() + + if os.path.exists( rawResultsPath ): + f = open( rawResultsPath, 'r' ) + for line in f: + if line.startswith("Results file:") or line.startswith("Results File:"): + trxFile = line[13:].strip() + parseTrxFile(baseName, trxFile) + f.close() + os.remove( rawResultsPath ) + +# Standard console reporter +approve( "console.std", ["~_"] ) +# console reporter, include passes, warn about No Assertions +approve( "console.sw", ["~_", "-s", "-w", "NoAssertions"] ) +# console reporter, include passes, warn about No Assertions, limit failures to first 4 +approve( "console.swa4", ["~_", "-s", "-w", "NoAssertions", "-x", "4"] ) +# junit reporter, include passes, warn about No Assertions +approveJunit( "junit.sw", ["~_", "-s", "-w", "NoAssertions", "-r", "junit"] ) +# xml reporter, include passes, warn about No Assertions +approveXml( "xml.sw", ["~_", "-s", "-w", "NoAssertions", "-r", "xml"] ) +# mstest runner, xml output +approveMsTest( "mstest.std", "all") +approveMsTest( "mstest.sw", "allSucceeding") +approveMsTest( "mstest.swa4", "allSucceedingAborting") + +if overallResult <> 0: + print "run approve.py to approve new baselines" +exit( overallResult) diff --git a/single_include_projects/CMake/CMakeLists.txt b/single_include_projects/CMake/CMakeLists.txt new file mode 100644 index 00000000..f1400d6a --- /dev/null +++ b/single_include_projects/CMake/CMakeLists.txt @@ -0,0 +1,39 @@ +cmake_minimum_required(VERSION 2.8) + +project(Catch) + +# define some folders +get_filename_component(CATCH_DIR "${CMAKE_CURRENT_SOURCE_DIR}" PATH) +get_filename_component(CATCH_DIR "${CATCH_DIR}" PATH) +set(SELF_TEST_DIR ${CATCH_DIR}/single_include_projects/SelfTest) + +# define the sources of the self test +set(SOURCES + ${SELF_TEST_DIR}/ApproxTests.cpp + ${SELF_TEST_DIR}/BDDTests.cpp + ${SELF_TEST_DIR}/ClassTests.cpp + ${SELF_TEST_DIR}/CmdLineTests.cpp + ${SELF_TEST_DIR}/ConditionTests.cpp + ${SELF_TEST_DIR}/ExceptionTests.cpp + ${SELF_TEST_DIR}/GeneratorTests.cpp + ${SELF_TEST_DIR}/MessageTests.cpp + ${SELF_TEST_DIR}/MiscTests.cpp + ${SELF_TEST_DIR}/SectionTrackerTests.cpp + ${SELF_TEST_DIR}/TestMain.cpp + ${SELF_TEST_DIR}/TrickyTests.cpp + ${SELF_TEST_DIR}/VariadicMacrosTests.cpp +) + +# configure the executable +include_directories(${CATCH_DIR}/single_include) +add_executable(SelfTest ${SOURCES}) + +# configure unit tests via CTest +enable_testing() +add_test(NAME RunTests COMMAND SelfTest) + +add_test(NAME ListTests COMMAND SelfTest --list-tests) +set_tests_properties(ListTests PROPERTIES PASS_REGULAR_EXPRESSION "[0-9]+ test cases") + +add_test(NAME ListTags COMMAND SelfTest --list-tags) +set_tests_properties(ListTags PROPERTIES PASS_REGULAR_EXPRESSION "[0-9]+ tags") diff --git a/single_include_projects/SelfTest/ApproxTests.cpp b/single_include_projects/SelfTest/ApproxTests.cpp new file mode 100644 index 00000000..1df76155 --- /dev/null +++ b/single_include_projects/SelfTest/ApproxTests.cpp @@ -0,0 +1,112 @@ +/* + * Created by Phil on 28/04/2011. + * Copyright 2011 Two Blue Cubes Ltd. All rights reserved. + * + * Distributed under the Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + */ + +#include "catch.hpp" + +/////////////////////////////////////////////////////////////////////////////// +TEST_CASE +( + "Some simple comparisons between doubles", + "[Approx]" +) +{ + double d = 1.23; + + REQUIRE( d == Approx( 1.23 ) ); + REQUIRE( d != Approx( 1.22 ) ); + REQUIRE( d != Approx( 1.24 ) ); + + REQUIRE( Approx( d ) == 1.23 ); + REQUIRE( Approx( d ) != 1.22 ); + REQUIRE( Approx( d ) != 1.24 ); +} + +/////////////////////////////////////////////////////////////////////////////// +TEST_CASE +( + "Approximate comparisons with different epsilons", + "[Approx]" + ) +{ + double d = 1.23; + + REQUIRE( d != Approx( 1.231 ) ); + REQUIRE( d == Approx( 1.231 ).epsilon( 0.1 ) ); +} + +/////////////////////////////////////////////////////////////////////////////// +TEST_CASE +( + "Approximate comparisons with floats", + "[Approx]" +) +{ + REQUIRE( 1.23f == Approx( 1.23f ) ); + REQUIRE( 0.0f == Approx( 0.0f ) ); +} + +/////////////////////////////////////////////////////////////////////////////// +TEST_CASE +( + "Approximate comparisons with ints", + "[Approx]" +) +{ + REQUIRE( 1 == Approx( 1 ) ); + REQUIRE( 0 == Approx( 0 ) ); +} + +/////////////////////////////////////////////////////////////////////////////// +TEST_CASE +( + "Approximate comparisons with mixed numeric types", + "[Approx]" +) +{ + const double dZero = 0; + const double dSmall = 0.00001; + const double dMedium = 1.234; + + REQUIRE( 1.0f == Approx( 1 ) ); + REQUIRE( 0 == Approx( dZero) ); + REQUIRE( 0 == Approx( dSmall ).epsilon( 0.001 ) ); + REQUIRE( 1.234f == Approx( dMedium ) ); + REQUIRE( dMedium == Approx( 1.234f ) ); +} + +/////////////////////////////////////////////////////////////////////////////// +TEST_CASE +( + "Use a custom approx", + "[Approx][custom]" +) +{ + double d = 1.23; + + Approx approx = Approx::custom().epsilon( 0.005 ); + + REQUIRE( d == approx( 1.23 ) ); + REQUIRE( d == approx( 1.22 ) ); + REQUIRE( d == approx( 1.24 ) ); + REQUIRE( d != approx( 1.25 ) ); + + REQUIRE( approx( d ) == 1.23 ); + REQUIRE( approx( d ) == 1.22 ); + REQUIRE( approx( d ) == 1.24 ); + REQUIRE( approx( d ) != 1.25 ); +} + +inline double divide( double a, double b ) { + return a/b; +} + +TEST_CASE( "Approximate PI", "[Approx][PI]" ) +{ + REQUIRE( divide( 22, 7 ) == Approx( 3.141 ).epsilon( 0.001 ) ); + REQUIRE( divide( 22, 7 ) != Approx( 3.141 ).epsilon( 0.0001 ) ); +} diff --git a/single_include_projects/SelfTest/BDDTests.cpp b/single_include_projects/SelfTest/BDDTests.cpp new file mode 100644 index 00000000..4220c820 --- /dev/null +++ b/single_include_projects/SelfTest/BDDTests.cpp @@ -0,0 +1,68 @@ +/* + * Created by Phil on 29/11/2010. + * Copyright 2010 Two Blue Cubes Ltd. All rights reserved. + * + * Distributed under the Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + */ + +#include "catch.hpp" + +inline bool itDoesThis(){ return true; } +inline bool itDoesThat(){ return true; } + +SCENARIO( "Do that thing with the thing", "[Tags]" ) { + GIVEN( "This stuff exists" ) { + // make stuff exist + WHEN( "I do this" ) { + // do this + THEN( "it should do this") + { + REQUIRE( itDoesThis() ); + AND_THEN( "do that") + REQUIRE( itDoesThat() ); + } + } + } +} + +SCENARIO( "Vector resizing affects size and capacity", "[vector][bdd][size][capacity]" ) { + GIVEN( "an empty vector" ) { + std::vector v; + REQUIRE( v.size() == 0 ); + + WHEN( "it is made larger" ) { + v.resize( 10 ); + THEN( "the size and capacity go up" ) { + REQUIRE( v.size() == 10 ); + REQUIRE( v.capacity() >= 10 ); + + AND_WHEN( "it is made smaller again" ) { + v.resize( 5 ); + THEN( "the size goes down but the capacity stays the same" ) { + REQUIRE( v.size() == 5 ); + REQUIRE( v.capacity() >= 10 ); + } + } + } + } + + WHEN( "we reserve more space" ) { + v.reserve( 10 ); + THEN( "The capacity is increased but the size remains the same" ) { + REQUIRE( v.capacity() >= 10 ); + REQUIRE( v.size() == 0 ); + } + } + } +} + +SCENARIO( "This is a really long scenario name to see how the list command deals with wrapping", + "[very long tags][lots][long][tags][verbose]" + "[one very long tag name that should cause line wrapping writing out using the list command]" + "[anotherReallyLongTagNameButThisOneHasNoObviousWrapPointsSoShouldSplitWithinAWordUsingADashCharacter]" ) { + GIVEN( "A section name that is so long that it cannot fit in a single console width" ) + WHEN( "The test headers are printed as part of the normal running of the scenario" ) + THEN( "The, deliberately very long and overly verbose (you see what I did there?) section names must wrap, along with an indent" ) + SUCCEED("boo!"); +} diff --git a/single_include_projects/SelfTest/Baselines/console.std.approved.txt b/single_include_projects/SelfTest/Baselines/console.std.approved.txt new file mode 100644 index 00000000..3bf4d6c2 --- /dev/null +++ b/single_include_projects/SelfTest/Baselines/console.std.approved.txt @@ -0,0 +1,754 @@ + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +CatchSelfTest is a host application. +Run with -? for options + +------------------------------------------------------------------------------- +A METHOD_AS_TEST_CASE based test run that fails +------------------------------------------------------------------------------- +ClassTests.cpp: +............................................................................... + +ClassTests.cpp:: FAILED: + REQUIRE( s == "world" ) +with expansion: + "hello" == "world" + +------------------------------------------------------------------------------- +A TEST_CASE_METHOD based test run that fails +------------------------------------------------------------------------------- +ClassTests.cpp: +............................................................................... + +ClassTests.cpp:: FAILED: + REQUIRE( m_a == 2 ) +with expansion: + 1 == 2 + +------------------------------------------------------------------------------- +Equality checks that should fail] +------------------------------------------------------------------------------- +ConditionTests.cpp: +............................................................................... + +ConditionTests.cpp:: FAILED: + CHECK( data.int_seven == 6 ) +with expansion: + 7 == 6 + +ConditionTests.cpp:: FAILED: + CHECK( data.int_seven == 8 ) +with expansion: + 7 == 8 + +ConditionTests.cpp:: FAILED: + CHECK( data.int_seven == 0 ) +with expansion: + 7 == 0 + +ConditionTests.cpp:: FAILED: + CHECK( data.float_nine_point_one == Approx( 9.11f ) ) +with expansion: + 9.1 == Approx( 9.1099996567 ) + +ConditionTests.cpp:: FAILED: + CHECK( data.float_nine_point_one == Approx( 9.0f ) ) +with expansion: + 9.1 == Approx( 9.0 ) + +ConditionTests.cpp:: FAILED: + CHECK( data.float_nine_point_one == Approx( 1 ) ) +with expansion: + 9.1 == Approx( 1.0 ) + +ConditionTests.cpp:: FAILED: + CHECK( data.float_nine_point_one == Approx( 0 ) ) +with expansion: + 9.1 == Approx( 0.0 ) + +ConditionTests.cpp:: FAILED: + CHECK( data.double_pi == Approx( 3.1415 ) ) +with expansion: + 3.1415926535 == Approx( 3.1415 ) + +ConditionTests.cpp:: FAILED: + CHECK( data.str_hello == "goodbye" ) +with expansion: + "hello" == "goodbye" + +ConditionTests.cpp:: FAILED: + CHECK( data.str_hello == "hell" ) +with expansion: + "hello" == "hell" + +ConditionTests.cpp:: FAILED: + CHECK( data.str_hello == "hello1" ) +with expansion: + "hello" == "hello1" + +ConditionTests.cpp:: FAILED: + CHECK( data.str_hello.size() == 6 ) +with expansion: + 5 == 6 + +ConditionTests.cpp:: FAILED: + CHECK( x == Approx( 1.301 ) ) +with expansion: + 1.3 == Approx( 1.301 ) + +------------------------------------------------------------------------------- +Inequality checks that should fails +------------------------------------------------------------------------------- +ConditionTests.cpp: +............................................................................... + +ConditionTests.cpp:: FAILED: + CHECK( data.int_seven != 7 ) +with expansion: + 7 != 7 + +ConditionTests.cpp:: FAILED: + CHECK( data.float_nine_point_one != Approx( 9.1f ) ) +with expansion: + 9.1 != Approx( 9.1000003815 ) + +ConditionTests.cpp:: FAILED: + CHECK( data.double_pi != Approx( 3.1415926535 ) ) +with expansion: + 3.1415926535 != Approx( 3.1415926535 ) + +ConditionTests.cpp:: FAILED: + CHECK( data.str_hello != "hello" ) +with expansion: + "hello" != "hello" + +ConditionTests.cpp:: FAILED: + CHECK( data.str_hello.size() != 5 ) +with expansion: + 5 != 5 + +------------------------------------------------------------------------------- +Ordering comparison checks that should fail +------------------------------------------------------------------------------- +ConditionTests.cpp: +............................................................................... + +ConditionTests.cpp:: FAILED: + CHECK( data.int_seven > 7 ) +with expansion: + 7 > 7 + +ConditionTests.cpp:: FAILED: + CHECK( data.int_seven < 7 ) +with expansion: + 7 < 7 + +ConditionTests.cpp:: FAILED: + CHECK( data.int_seven > 8 ) +with expansion: + 7 > 8 + +ConditionTests.cpp:: FAILED: + CHECK( data.int_seven < 6 ) +with expansion: + 7 < 6 + +ConditionTests.cpp:: FAILED: + CHECK( data.int_seven < 0 ) +with expansion: + 7 < 0 + +ConditionTests.cpp:: FAILED: + CHECK( data.int_seven < -1 ) +with expansion: + 7 < -1 + +ConditionTests.cpp:: FAILED: + CHECK( data.int_seven >= 8 ) +with expansion: + 7 >= 8 + +ConditionTests.cpp:: FAILED: + CHECK( data.int_seven <= 6 ) +with expansion: + 7 <= 6 + +ConditionTests.cpp:: FAILED: + CHECK( data.float_nine_point_one < 9 ) +with expansion: + 9.1 < 9 + +ConditionTests.cpp:: FAILED: + CHECK( data.float_nine_point_one > 10 ) +with expansion: + 9.1 > 10 + +ConditionTests.cpp:: FAILED: + CHECK( data.float_nine_point_one > 9.2 ) +with expansion: + 9.1 > 9.2 + +ConditionTests.cpp:: FAILED: + CHECK( data.str_hello > "hello" ) +with expansion: + "hello" > "hello" + +ConditionTests.cpp:: FAILED: + CHECK( data.str_hello < "hello" ) +with expansion: + "hello" < "hello" + +ConditionTests.cpp:: FAILED: + CHECK( data.str_hello > "hellp" ) +with expansion: + "hello" > "hellp" + +ConditionTests.cpp:: FAILED: + CHECK( data.str_hello > "z" ) +with expansion: + "hello" > "z" + +ConditionTests.cpp:: FAILED: + CHECK( data.str_hello < "hellm" ) +with expansion: + "hello" < "hellm" + +ConditionTests.cpp:: FAILED: + CHECK( data.str_hello < "a" ) +with expansion: + "hello" < "a" + +ConditionTests.cpp:: FAILED: + CHECK( data.str_hello >= "z" ) +with expansion: + "hello" >= "z" + +ConditionTests.cpp:: FAILED: + CHECK( data.str_hello <= "a" ) +with expansion: + "hello" <= "a" + +------------------------------------------------------------------------------- +'Not' checks that should fail +------------------------------------------------------------------------------- +ConditionTests.cpp: +............................................................................... + +ConditionTests.cpp:: FAILED: + CHECK( false != false ) + +ConditionTests.cpp:: FAILED: + CHECK( true != true ) + +ConditionTests.cpp:: FAILED: + CHECK( !true ) +with expansion: + false + +ConditionTests.cpp:: FAILED: + CHECK_FALSE( true ) + +ConditionTests.cpp:: FAILED: + CHECK( !trueValue ) +with expansion: + false + +ConditionTests.cpp:: FAILED: + CHECK_FALSE( trueValue ) +with expansion: + !true + +ConditionTests.cpp:: FAILED: + CHECK( !(1 == 1) ) +with expansion: + false + +ConditionTests.cpp:: FAILED: + CHECK_FALSE( 1 == 1 ) +with expansion: + !(1 == 1) + +------------------------------------------------------------------------------- +Expected exceptions that don't throw or unexpected exceptions fail the test +------------------------------------------------------------------------------- +ExceptionTests.cpp: +............................................................................... + +ExceptionTests.cpp:: FAILED: + CHECK_THROWS_AS( thisThrows() ) +due to unexpected exception with message: + expected exception + +ExceptionTests.cpp:: FAILED: + CHECK_THROWS_AS( thisDoesntThrow() ) +because no exception was thrown where one was expected: + +ExceptionTests.cpp:: FAILED: + CHECK_NOTHROW( thisThrows() ) +due to unexpected exception with message: + expected exception + +------------------------------------------------------------------------------- +When unchecked exceptions are thrown directly they are always failures +------------------------------------------------------------------------------- +ExceptionTests.cpp: +............................................................................... + +ExceptionTests.cpp:: FAILED: +due to unexpected exception with message: + unexpected exception + +------------------------------------------------------------------------------- +An unchecked exception reports the line of the last assertion +------------------------------------------------------------------------------- +ExceptionTests.cpp: +............................................................................... + +ExceptionTests.cpp:: FAILED: + {Unknown expression after the reported line} +due to unexpected exception with message: + unexpected exception + +------------------------------------------------------------------------------- +When unchecked exceptions are thrown from sections they are always failures + section name +------------------------------------------------------------------------------- +ExceptionTests.cpp: +............................................................................... + +ExceptionTests.cpp:: FAILED: +due to unexpected exception with message: + unexpected exception + +------------------------------------------------------------------------------- +When unchecked exceptions are thrown from functions they are always failures +------------------------------------------------------------------------------- +ExceptionTests.cpp: +............................................................................... + +ExceptionTests.cpp:: FAILED: + CHECK( thisThrows() == 0 ) +due to unexpected exception with message: + expected exception + +------------------------------------------------------------------------------- +Unexpected custom exceptions can be translated +------------------------------------------------------------------------------- +ExceptionTests.cpp: +............................................................................... + +ExceptionTests.cpp:: FAILED: +due to unexpected exception with message: + custom exception + +------------------------------------------------------------------------------- +Custom exceptions can be translated when testing for nothrow +------------------------------------------------------------------------------- +ExceptionTests.cpp: +............................................................................... + +ExceptionTests.cpp:: FAILED: + REQUIRE_NOTHROW( throwCustom() ) +due to unexpected exception with message: + custom exception - not std + +------------------------------------------------------------------------------- +Custom exceptions can be translated when testing for throwing as something else +------------------------------------------------------------------------------- +ExceptionTests.cpp: +............................................................................... + +ExceptionTests.cpp:: FAILED: + REQUIRE_THROWS_AS( throwCustom() ) +due to unexpected exception with message: + custom exception - not std + +------------------------------------------------------------------------------- +Unexpected exceptions can be translated +------------------------------------------------------------------------------- +ExceptionTests.cpp: +............................................................................... + +ExceptionTests.cpp:: FAILED: +due to unexpected exception with message: + 3.14 + +------------------------------------------------------------------------------- +INFO and WARN do not abort tests +------------------------------------------------------------------------------- +MessageTests.cpp: +............................................................................... + +MessageTests.cpp:: +warning: + this is a warning + +------------------------------------------------------------------------------- +INFO gets logged on failure +------------------------------------------------------------------------------- +MessageTests.cpp: +............................................................................... + +MessageTests.cpp:: FAILED: + REQUIRE( a == 1 ) +with expansion: + 2 == 1 +with messages: + this message should be logged + so should this + +------------------------------------------------------------------------------- +INFO gets logged on failure, even if captured before successful assertions +------------------------------------------------------------------------------- +MessageTests.cpp: +............................................................................... + +MessageTests.cpp:: FAILED: + CHECK( a == 1 ) +with expansion: + 2 == 1 +with messages: + this message may be logged later + this message should be logged + +MessageTests.cpp:: FAILED: + CHECK( a == 0 ) +with expansion: + 2 == 0 +with message: + and this, but later + +------------------------------------------------------------------------------- +FAIL aborts the test +------------------------------------------------------------------------------- +MessageTests.cpp: +............................................................................... + +MessageTests.cpp:: FAILED: +explicitly with message: + This is a failure + +------------------------------------------------------------------------------- +FAIL does not require an argument +------------------------------------------------------------------------------- +MessageTests.cpp: +............................................................................... + +MessageTests.cpp:: FAILED: + +------------------------------------------------------------------------------- +Output from all sections is reported + one +------------------------------------------------------------------------------- +MessageTests.cpp: +............................................................................... + +MessageTests.cpp:: FAILED: +explicitly with message: + Message from section one + +------------------------------------------------------------------------------- +Output from all sections is reported + two +------------------------------------------------------------------------------- +MessageTests.cpp: +............................................................................... + +MessageTests.cpp:: FAILED: +explicitly with message: + Message from section two + +Message from section one +Message from section two +------------------------------------------------------------------------------- +SCOPED_INFO is reset for each loop +------------------------------------------------------------------------------- +MessageTests.cpp: +............................................................................... + +MessageTests.cpp:: FAILED: + REQUIRE( i < 10 ) +with expansion: + 10 < 10 +with messages: + current counter 10 + i := 10 + +------------------------------------------------------------------------------- +just failure +------------------------------------------------------------------------------- +MessageTests.cpp: +............................................................................... + +MessageTests.cpp:: FAILED: +explicitly with message: + Previous info should not be seen + +------------------------------------------------------------------------------- +sends information to INFO +------------------------------------------------------------------------------- +MessageTests.cpp: +............................................................................... + +MessageTests.cpp:: FAILED: + REQUIRE( false ) +with messages: + hi + i := 7 + +------------------------------------------------------------------------------- +more nested SECTION tests + s1 + s2 +------------------------------------------------------------------------------- +MiscTests.cpp: +............................................................................... + +MiscTests.cpp:: FAILED: + REQUIRE( a == b ) +with expansion: + 1 == 2 + +------------------------------------------------------------------------------- +looped SECTION tests + s1 +------------------------------------------------------------------------------- +MiscTests.cpp: +............................................................................... + +MiscTests.cpp:: FAILED: + CHECK( b > a ) +with expansion: + 0 > 1 + +------------------------------------------------------------------------------- +looped tests +------------------------------------------------------------------------------- +MiscTests.cpp: +............................................................................... + +MiscTests.cpp:: FAILED: + CHECK( ( fib[i] % 2 ) == 0 ) +with expansion: + 1 == 0 +with message: + Testing if fib[0] (1) is even + +MiscTests.cpp:: FAILED: + CHECK( ( fib[i] % 2 ) == 0 ) +with expansion: + 1 == 0 +with message: + Testing if fib[1] (1) is even + +MiscTests.cpp:: FAILED: + CHECK( ( fib[i] % 2 ) == 0 ) +with expansion: + 1 == 0 +with message: + Testing if fib[3] (3) is even + +MiscTests.cpp:: FAILED: + CHECK( ( fib[i] % 2 ) == 0 ) +with expansion: + 1 == 0 +with message: + Testing if fib[4] (5) is even + +MiscTests.cpp:: FAILED: + CHECK( ( fib[i] % 2 ) == 0 ) +with expansion: + 1 == 0 +with message: + Testing if fib[6] (13) is even + +MiscTests.cpp:: FAILED: + CHECK( ( fib[i] % 2 ) == 0 ) +with expansion: + 1 == 0 +with message: + Testing if fib[7] (21) is even + +A string sent directly to stdout +A string sent directly to stderr +------------------------------------------------------------------------------- +checkedIf, failing +------------------------------------------------------------------------------- +MiscTests.cpp: +............................................................................... + +MiscTests.cpp:: FAILED: + CHECKED_IF( flag ) +with expansion: + false + +MiscTests.cpp:: FAILED: + REQUIRE( testCheckedIf( false ) ) +with expansion: + false + +------------------------------------------------------------------------------- +checkedElse, failing +------------------------------------------------------------------------------- +MiscTests.cpp: +............................................................................... + +MiscTests.cpp:: FAILED: + CHECKED_ELSE( flag ) +with expansion: + false + +MiscTests.cpp:: FAILED: + REQUIRE( testCheckedElse( false ) ) +with expansion: + false + +------------------------------------------------------------------------------- +send a single char to INFO +------------------------------------------------------------------------------- +MiscTests.cpp: +............................................................................... + +MiscTests.cpp:: FAILED: + REQUIRE( false ) +with message: + 3 + +------------------------------------------------------------------------------- +Contains string matcher +------------------------------------------------------------------------------- +MiscTests.cpp: +............................................................................... + +MiscTests.cpp:: FAILED: + CHECK_THAT( testStringForMatching() Contains( "not there" ) ) +with expansion: + "this string contains 'abc' as a substring" contains: "not there" + +------------------------------------------------------------------------------- +StartsWith string matcher +------------------------------------------------------------------------------- +MiscTests.cpp: +............................................................................... + +MiscTests.cpp:: FAILED: + CHECK_THAT( testStringForMatching() StartsWith( "string" ) ) +with expansion: + "this string contains 'abc' as a substring" starts with: "string" + +------------------------------------------------------------------------------- +EndsWith string matcher +------------------------------------------------------------------------------- +MiscTests.cpp: +............................................................................... + +MiscTests.cpp:: FAILED: + CHECK_THAT( testStringForMatching() EndsWith( "this" ) ) +with expansion: + "this string contains 'abc' as a substring" ends with: "this" + +------------------------------------------------------------------------------- +Equals string matcher +------------------------------------------------------------------------------- +MiscTests.cpp: +............................................................................... + +MiscTests.cpp:: FAILED: + CHECK_THAT( testStringForMatching() Equals( "something else" ) ) +with expansion: + "this string contains 'abc' as a substring" equals: "something else" + +------------------------------------------------------------------------------- +Nice descriptive name +------------------------------------------------------------------------------- +MiscTests.cpp: +............................................................................... + +MiscTests.cpp:: +warning: + This one ran + +------------------------------------------------------------------------------- +A couple of nested sections followed by a failure +------------------------------------------------------------------------------- +MiscTests.cpp: +............................................................................... + +MiscTests.cpp:: FAILED: +explicitly with message: + to infinity and beyond + +------------------------------------------------------------------------------- +A couple of nested sections followed by a failure +------------------------------------------------------------------------------- +MiscTests.cpp: +............................................................................... + +MiscTests.cpp:: FAILED: +explicitly with message: + to infinity and beyond + +------------------------------------------------------------------------------- +A couple of nested sections followed by a failure +------------------------------------------------------------------------------- +MiscTests.cpp: +............................................................................... + +MiscTests.cpp:: FAILED: +explicitly with message: + to infinity and beyond + +hello +hello +------------------------------------------------------------------------------- +Where the is more to the expression after the RHS[failing] +------------------------------------------------------------------------------- +TrickyTests.cpp: +............................................................................... + +TrickyTests.cpp:: +warning: + Uncomment the code in this test to check that it gives a sensible compiler + error + +------------------------------------------------------------------------------- +Where the LHS is not a simple value[failing] +------------------------------------------------------------------------------- +TrickyTests.cpp: +............................................................................... + +TrickyTests.cpp:: +warning: + Uncomment the code in this test to check that it gives a sensible compiler + error + +------------------------------------------------------------------------------- +A failing expression with a non streamable type is still captured[failing] +------------------------------------------------------------------------------- +TrickyTests.cpp: +............................................................................... + +TrickyTests.cpp:: FAILED: + CHECK( &o1 == &o2 ) +with expansion: + 0x == 0x + +TrickyTests.cpp:: FAILED: + CHECK( o1 == o2 ) +with expansion: + {?} == {?} + +------------------------------------------------------------------------------- +string literals of different sizes can be compared[failing] +------------------------------------------------------------------------------- +TrickyTests.cpp: +............................................................................... + +TrickyTests.cpp:: FAILED: + REQUIRE( std::string( "first" ) == "second" ) +with expansion: + "first" == "second" + +=============================================================================== +123 test cases - 36 failed (676 assertions - 91 failed) + diff --git a/single_include_projects/SelfTest/Baselines/console.sw.approved.txt b/single_include_projects/SelfTest/Baselines/console.sw.approved.txt new file mode 100644 index 00000000..64ed0577 --- /dev/null +++ b/single_include_projects/SelfTest/Baselines/console.sw.approved.txt @@ -0,0 +1,7162 @@ + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +CatchSelfTest is a host application. +Run with -? for options + +------------------------------------------------------------------------------- +Some simple comparisons between doubles +------------------------------------------------------------------------------- +ApproxTests.cpp: +............................................................................... + +ApproxTests.cpp:: +PASSED: + REQUIRE( d == Approx( 1.23 ) ) +with expansion: + 1.23 == Approx( 1.23 ) + +ApproxTests.cpp:: +PASSED: + REQUIRE( d != Approx( 1.22 ) ) +with expansion: + 1.23 != Approx( 1.22 ) + +ApproxTests.cpp:: +PASSED: + REQUIRE( d != Approx( 1.24 ) ) +with expansion: + 1.23 != Approx( 1.24 ) + +ApproxTests.cpp:: +PASSED: + REQUIRE( Approx( d ) == 1.23 ) +with expansion: + Approx( 1.23 ) == 1.23 + +ApproxTests.cpp:: +PASSED: + REQUIRE( Approx( d ) != 1.22 ) +with expansion: + Approx( 1.23 ) != 1.22 + +ApproxTests.cpp:: +PASSED: + REQUIRE( Approx( d ) != 1.24 ) +with expansion: + Approx( 1.23 ) != 1.24 + +------------------------------------------------------------------------------- +Approximate comparisons with different epsilons +------------------------------------------------------------------------------- +ApproxTests.cpp: +............................................................................... + +ApproxTests.cpp:: +PASSED: + REQUIRE( d != Approx( 1.231 ) ) +with expansion: + 1.23 != Approx( 1.231 ) + +ApproxTests.cpp:: +PASSED: + REQUIRE( d == Approx( 1.231 ).epsilon( 0.1 ) ) +with expansion: + 1.23 == Approx( 1.231 ) + +------------------------------------------------------------------------------- +Approximate comparisons with floats +------------------------------------------------------------------------------- +ApproxTests.cpp: +............................................................................... + +ApproxTests.cpp:: +PASSED: + REQUIRE( 1.23f == Approx( 1.23f ) ) +with expansion: + 1.23 == Approx( 1.2300000191 ) + +ApproxTests.cpp:: +PASSED: + REQUIRE( 0.0f == Approx( 0.0f ) ) +with expansion: + 0 == Approx( 0.0 ) + +------------------------------------------------------------------------------- +Approximate comparisons with ints +------------------------------------------------------------------------------- +ApproxTests.cpp: +............................................................................... + +ApproxTests.cpp:: +PASSED: + REQUIRE( 1 == Approx( 1 ) ) +with expansion: + 1 == Approx( 1.0 ) + +ApproxTests.cpp:: +PASSED: + REQUIRE( 0 == Approx( 0 ) ) +with expansion: + 0 == Approx( 0.0 ) + +------------------------------------------------------------------------------- +Approximate comparisons with mixed numeric types +------------------------------------------------------------------------------- +ApproxTests.cpp: +............................................................................... + +ApproxTests.cpp:: +PASSED: + REQUIRE( 1.0f == Approx( 1 ) ) +with expansion: + 1 == Approx( 1.0 ) + +ApproxTests.cpp:: +PASSED: + REQUIRE( 0 == Approx( dZero) ) +with expansion: + 0 == Approx( 0.0 ) + +ApproxTests.cpp:: +PASSED: + REQUIRE( 0 == Approx( dSmall ).epsilon( 0.001 ) ) +with expansion: + 0 == Approx( 0.00001 ) + +ApproxTests.cpp:: +PASSED: + REQUIRE( 1.234f == Approx( dMedium ) ) +with expansion: + 1.234 == Approx( 1.234 ) + +ApproxTests.cpp:: +PASSED: + REQUIRE( dMedium == Approx( 1.234f ) ) +with expansion: + 1.234 == Approx( 1.2339999676 ) + +------------------------------------------------------------------------------- +Use a custom approx +------------------------------------------------------------------------------- +ApproxTests.cpp: +............................................................................... + +ApproxTests.cpp:: +PASSED: + REQUIRE( d == approx( 1.23 ) ) +with expansion: + 1.23 == Approx( 1.23 ) + +ApproxTests.cpp:: +PASSED: + REQUIRE( d == approx( 1.22 ) ) +with expansion: + 1.23 == Approx( 1.22 ) + +ApproxTests.cpp:: +PASSED: + REQUIRE( d == approx( 1.24 ) ) +with expansion: + 1.23 == Approx( 1.24 ) + +ApproxTests.cpp:: +PASSED: + REQUIRE( d != approx( 1.25 ) ) +with expansion: + 1.23 != Approx( 1.25 ) + +ApproxTests.cpp:: +PASSED: + REQUIRE( approx( d ) == 1.23 ) +with expansion: + Approx( 1.23 ) == 1.23 + +ApproxTests.cpp:: +PASSED: + REQUIRE( approx( d ) == 1.22 ) +with expansion: + Approx( 1.23 ) == 1.22 + +ApproxTests.cpp:: +PASSED: + REQUIRE( approx( d ) == 1.24 ) +with expansion: + Approx( 1.23 ) == 1.24 + +ApproxTests.cpp:: +PASSED: + REQUIRE( approx( d ) != 1.25 ) +with expansion: + Approx( 1.23 ) != 1.25 + +------------------------------------------------------------------------------- +Approximate PI +------------------------------------------------------------------------------- +ApproxTests.cpp: +............................................................................... + +ApproxTests.cpp:: +PASSED: + REQUIRE( divide( 22, 7 ) == Approx( 3.141 ).epsilon( 0.001 ) ) +with expansion: + 3.1428571429 == Approx( 3.141 ) + +ApproxTests.cpp:: +PASSED: + REQUIRE( divide( 22, 7 ) != Approx( 3.141 ).epsilon( 0.0001 ) ) +with expansion: + 3.1428571429 != Approx( 3.141 ) + +------------------------------------------------------------------------------- +A METHOD_AS_TEST_CASE based test run that succeeds +------------------------------------------------------------------------------- +ClassTests.cpp: +............................................................................... + +ClassTests.cpp:: +PASSED: + REQUIRE( s == "hello" ) +with expansion: + "hello" == "hello" + +------------------------------------------------------------------------------- +A METHOD_AS_TEST_CASE based test run that fails +------------------------------------------------------------------------------- +ClassTests.cpp: +............................................................................... + +ClassTests.cpp:: FAILED: + REQUIRE( s == "world" ) +with expansion: + "hello" == "world" + +------------------------------------------------------------------------------- +A TEST_CASE_METHOD based test run that succeeds +------------------------------------------------------------------------------- +ClassTests.cpp: +............................................................................... + +ClassTests.cpp:: +PASSED: + REQUIRE( m_a == 1 ) +with expansion: + 1 == 1 + +------------------------------------------------------------------------------- +A TEST_CASE_METHOD based test run that fails +------------------------------------------------------------------------------- +ClassTests.cpp: +............................................................................... + +ClassTests.cpp:: FAILED: + REQUIRE( m_a == 2 ) +with expansion: + 1 == 2 + +------------------------------------------------------------------------------- +Equality checks that should succeed +------------------------------------------------------------------------------- +ConditionTests.cpp: +............................................................................... + +ConditionTests.cpp:: +PASSED: + REQUIRE( data.int_seven == 7 ) +with expansion: + 7 == 7 + +ConditionTests.cpp:: +PASSED: + REQUIRE( data.float_nine_point_one == Approx( 9.1f ) ) +with expansion: + 9.1 == Approx( 9.1000003815 ) + +ConditionTests.cpp:: +PASSED: + REQUIRE( data.double_pi == Approx( 3.1415926535 ) ) +with expansion: + 3.1415926535 == Approx( 3.1415926535 ) + +ConditionTests.cpp:: +PASSED: + REQUIRE( data.str_hello == "hello" ) +with expansion: + "hello" == "hello" + +ConditionTests.cpp:: +PASSED: + REQUIRE( "hello" == data.str_hello ) +with expansion: + "hello" == "hello" + +ConditionTests.cpp:: +PASSED: + REQUIRE( data.str_hello.size() == 5 ) +with expansion: + 5 == 5 + +ConditionTests.cpp:: +PASSED: + REQUIRE( x == Approx( 1.3 ) ) +with expansion: + 1.3 == Approx( 1.3 ) + +------------------------------------------------------------------------------- +Equality checks that should fail] +------------------------------------------------------------------------------- +ConditionTests.cpp: +............................................................................... + +ConditionTests.cpp:: FAILED: + CHECK( data.int_seven == 6 ) +with expansion: + 7 == 6 + +ConditionTests.cpp:: FAILED: + CHECK( data.int_seven == 8 ) +with expansion: + 7 == 8 + +ConditionTests.cpp:: FAILED: + CHECK( data.int_seven == 0 ) +with expansion: + 7 == 0 + +ConditionTests.cpp:: FAILED: + CHECK( data.float_nine_point_one == Approx( 9.11f ) ) +with expansion: + 9.1 == Approx( 9.1099996567 ) + +ConditionTests.cpp:: FAILED: + CHECK( data.float_nine_point_one == Approx( 9.0f ) ) +with expansion: + 9.1 == Approx( 9.0 ) + +ConditionTests.cpp:: FAILED: + CHECK( data.float_nine_point_one == Approx( 1 ) ) +with expansion: + 9.1 == Approx( 1.0 ) + +ConditionTests.cpp:: FAILED: + CHECK( data.float_nine_point_one == Approx( 0 ) ) +with expansion: + 9.1 == Approx( 0.0 ) + +ConditionTests.cpp:: FAILED: + CHECK( data.double_pi == Approx( 3.1415 ) ) +with expansion: + 3.1415926535 == Approx( 3.1415 ) + +ConditionTests.cpp:: FAILED: + CHECK( data.str_hello == "goodbye" ) +with expansion: + "hello" == "goodbye" + +ConditionTests.cpp:: FAILED: + CHECK( data.str_hello == "hell" ) +with expansion: + "hello" == "hell" + +ConditionTests.cpp:: FAILED: + CHECK( data.str_hello == "hello1" ) +with expansion: + "hello" == "hello1" + +ConditionTests.cpp:: FAILED: + CHECK( data.str_hello.size() == 6 ) +with expansion: + 5 == 6 + +ConditionTests.cpp:: FAILED: + CHECK( x == Approx( 1.301 ) ) +with expansion: + 1.3 == Approx( 1.301 ) + +------------------------------------------------------------------------------- +Inequality checks that should succeed +------------------------------------------------------------------------------- +ConditionTests.cpp: +............................................................................... + +ConditionTests.cpp:: +PASSED: + REQUIRE( data.int_seven != 6 ) +with expansion: + 7 != 6 + +ConditionTests.cpp:: +PASSED: + REQUIRE( data.int_seven != 8 ) +with expansion: + 7 != 8 + +ConditionTests.cpp:: +PASSED: + REQUIRE( data.float_nine_point_one != Approx( 9.11f ) ) +with expansion: + 9.1 != Approx( 9.1099996567 ) + +ConditionTests.cpp:: +PASSED: + REQUIRE( data.float_nine_point_one != Approx( 9.0f ) ) +with expansion: + 9.1 != Approx( 9.0 ) + +ConditionTests.cpp:: +PASSED: + REQUIRE( data.float_nine_point_one != Approx( 1 ) ) +with expansion: + 9.1 != Approx( 1.0 ) + +ConditionTests.cpp:: +PASSED: + REQUIRE( data.float_nine_point_one != Approx( 0 ) ) +with expansion: + 9.1 != Approx( 0.0 ) + +ConditionTests.cpp:: +PASSED: + REQUIRE( data.double_pi != Approx( 3.1415 ) ) +with expansion: + 3.1415926535 != Approx( 3.1415 ) + +ConditionTests.cpp:: +PASSED: + REQUIRE( data.str_hello != "goodbye" ) +with expansion: + "hello" != "goodbye" + +ConditionTests.cpp:: +PASSED: + REQUIRE( data.str_hello != "hell" ) +with expansion: + "hello" != "hell" + +ConditionTests.cpp:: +PASSED: + REQUIRE( data.str_hello != "hello1" ) +with expansion: + "hello" != "hello1" + +ConditionTests.cpp:: +PASSED: + REQUIRE( data.str_hello.size() != 6 ) +with expansion: + 5 != 6 + +------------------------------------------------------------------------------- +Inequality checks that should fails +------------------------------------------------------------------------------- +ConditionTests.cpp: +............................................................................... + +ConditionTests.cpp:: FAILED: + CHECK( data.int_seven != 7 ) +with expansion: + 7 != 7 + +ConditionTests.cpp:: FAILED: + CHECK( data.float_nine_point_one != Approx( 9.1f ) ) +with expansion: + 9.1 != Approx( 9.1000003815 ) + +ConditionTests.cpp:: FAILED: + CHECK( data.double_pi != Approx( 3.1415926535 ) ) +with expansion: + 3.1415926535 != Approx( 3.1415926535 ) + +ConditionTests.cpp:: FAILED: + CHECK( data.str_hello != "hello" ) +with expansion: + "hello" != "hello" + +ConditionTests.cpp:: FAILED: + CHECK( data.str_hello.size() != 5 ) +with expansion: + 5 != 5 + +------------------------------------------------------------------------------- +Ordering comparison checks that should succeed +------------------------------------------------------------------------------- +ConditionTests.cpp: +............................................................................... + +ConditionTests.cpp:: +PASSED: + REQUIRE( data.int_seven < 8 ) +with expansion: + 7 < 8 + +ConditionTests.cpp:: +PASSED: + REQUIRE( data.int_seven > 6 ) +with expansion: + 7 > 6 + +ConditionTests.cpp:: +PASSED: + REQUIRE( data.int_seven > 0 ) +with expansion: + 7 > 0 + +ConditionTests.cpp:: +PASSED: + REQUIRE( data.int_seven > -1 ) +with expansion: + 7 > -1 + +ConditionTests.cpp:: +PASSED: + REQUIRE( data.int_seven >= 7 ) +with expansion: + 7 >= 7 + +ConditionTests.cpp:: +PASSED: + REQUIRE( data.int_seven >= 6 ) +with expansion: + 7 >= 6 + +ConditionTests.cpp:: +PASSED: + REQUIRE( data.int_seven <= 7 ) +with expansion: + 7 <= 7 + +ConditionTests.cpp:: +PASSED: + REQUIRE( data.int_seven <= 8 ) +with expansion: + 7 <= 8 + +ConditionTests.cpp:: +PASSED: + REQUIRE( data.float_nine_point_one > 9 ) +with expansion: + 9.1 > 9 + +ConditionTests.cpp:: +PASSED: + REQUIRE( data.float_nine_point_one < 10 ) +with expansion: + 9.1 < 10 + +ConditionTests.cpp:: +PASSED: + REQUIRE( data.float_nine_point_one < 9.2 ) +with expansion: + 9.1 < 9.2 + +ConditionTests.cpp:: +PASSED: + REQUIRE( data.str_hello <= "hello" ) +with expansion: + "hello" <= "hello" + +ConditionTests.cpp:: +PASSED: + REQUIRE( data.str_hello >= "hello" ) +with expansion: + "hello" >= "hello" + +ConditionTests.cpp:: +PASSED: + REQUIRE( data.str_hello < "hellp" ) +with expansion: + "hello" < "hellp" + +ConditionTests.cpp:: +PASSED: + REQUIRE( data.str_hello < "zebra" ) +with expansion: + "hello" < "zebra" + +ConditionTests.cpp:: +PASSED: + REQUIRE( data.str_hello > "hellm" ) +with expansion: + "hello" > "hellm" + +ConditionTests.cpp:: +PASSED: + REQUIRE( data.str_hello > "a" ) +with expansion: + "hello" > "a" + +------------------------------------------------------------------------------- +Ordering comparison checks that should fail +------------------------------------------------------------------------------- +ConditionTests.cpp: +............................................................................... + +ConditionTests.cpp:: FAILED: + CHECK( data.int_seven > 7 ) +with expansion: + 7 > 7 + +ConditionTests.cpp:: FAILED: + CHECK( data.int_seven < 7 ) +with expansion: + 7 < 7 + +ConditionTests.cpp:: FAILED: + CHECK( data.int_seven > 8 ) +with expansion: + 7 > 8 + +ConditionTests.cpp:: FAILED: + CHECK( data.int_seven < 6 ) +with expansion: + 7 < 6 + +ConditionTests.cpp:: FAILED: + CHECK( data.int_seven < 0 ) +with expansion: + 7 < 0 + +ConditionTests.cpp:: FAILED: + CHECK( data.int_seven < -1 ) +with expansion: + 7 < -1 + +ConditionTests.cpp:: FAILED: + CHECK( data.int_seven >= 8 ) +with expansion: + 7 >= 8 + +ConditionTests.cpp:: FAILED: + CHECK( data.int_seven <= 6 ) +with expansion: + 7 <= 6 + +ConditionTests.cpp:: FAILED: + CHECK( data.float_nine_point_one < 9 ) +with expansion: + 9.1 < 9 + +ConditionTests.cpp:: FAILED: + CHECK( data.float_nine_point_one > 10 ) +with expansion: + 9.1 > 10 + +ConditionTests.cpp:: FAILED: + CHECK( data.float_nine_point_one > 9.2 ) +with expansion: + 9.1 > 9.2 + +ConditionTests.cpp:: FAILED: + CHECK( data.str_hello > "hello" ) +with expansion: + "hello" > "hello" + +ConditionTests.cpp:: FAILED: + CHECK( data.str_hello < "hello" ) +with expansion: + "hello" < "hello" + +ConditionTests.cpp:: FAILED: + CHECK( data.str_hello > "hellp" ) +with expansion: + "hello" > "hellp" + +ConditionTests.cpp:: FAILED: + CHECK( data.str_hello > "z" ) +with expansion: + "hello" > "z" + +ConditionTests.cpp:: FAILED: + CHECK( data.str_hello < "hellm" ) +with expansion: + "hello" < "hellm" + +ConditionTests.cpp:: FAILED: + CHECK( data.str_hello < "a" ) +with expansion: + "hello" < "a" + +ConditionTests.cpp:: FAILED: + CHECK( data.str_hello >= "z" ) +with expansion: + "hello" >= "z" + +ConditionTests.cpp:: FAILED: + CHECK( data.str_hello <= "a" ) +with expansion: + "hello" <= "a" + +------------------------------------------------------------------------------- +Comparisons with int literals don't warn when mixing signed/ unsigned +------------------------------------------------------------------------------- +ConditionTests.cpp: +............................................................................... + +ConditionTests.cpp:: +PASSED: + REQUIRE( i == 1 ) +with expansion: + 1 == 1 + +ConditionTests.cpp:: +PASSED: + REQUIRE( ui == 2 ) +with expansion: + 2 == 2 + +ConditionTests.cpp:: +PASSED: + REQUIRE( l == 3 ) +with expansion: + 3 == 3 + +ConditionTests.cpp:: +PASSED: + REQUIRE( ul == 4 ) +with expansion: + 4 == 4 + +ConditionTests.cpp:: +PASSED: + REQUIRE( c == 5 ) +with expansion: + 5 == 5 + +ConditionTests.cpp:: +PASSED: + REQUIRE( uc == 6 ) +with expansion: + 6 == 6 + +ConditionTests.cpp:: +PASSED: + REQUIRE( 1 == i ) +with expansion: + 1 == 1 + +ConditionTests.cpp:: +PASSED: + REQUIRE( 2 == ui ) +with expansion: + 2 == 2 + +ConditionTests.cpp:: +PASSED: + REQUIRE( 3 == l ) +with expansion: + 3 == 3 + +ConditionTests.cpp:: +PASSED: + REQUIRE( 4 == ul ) +with expansion: + 4 == 4 + +ConditionTests.cpp:: +PASSED: + REQUIRE( 5 == c ) +with expansion: + 5 == 5 + +ConditionTests.cpp:: +PASSED: + REQUIRE( 6 == uc ) +with expansion: + 6 == 6 + +ConditionTests.cpp:: +PASSED: + REQUIRE( (std::numeric_limits::max)() > ul ) +with expansion: + 0x > 4 + +------------------------------------------------------------------------------- +comparisons between int variables +------------------------------------------------------------------------------- +ConditionTests.cpp: +............................................................................... + +ConditionTests.cpp:: +PASSED: + REQUIRE( long_var == unsigned_char_var ) +with expansion: + 1 == 1 + +ConditionTests.cpp:: +PASSED: + REQUIRE( long_var == unsigned_short_var ) +with expansion: + 1 == 1 + +ConditionTests.cpp:: +PASSED: + REQUIRE( long_var == unsigned_int_var ) +with expansion: + 1 == 1 + +ConditionTests.cpp:: +PASSED: + REQUIRE( long_var == unsigned_long_var ) +with expansion: + 1 == 1 + +------------------------------------------------------------------------------- +comparisons between const int variables +------------------------------------------------------------------------------- +ConditionTests.cpp: +............................................................................... + +ConditionTests.cpp:: +PASSED: + REQUIRE( unsigned_char_var == 1 ) +with expansion: + 1 == 1 + +ConditionTests.cpp:: +PASSED: + REQUIRE( unsigned_short_var == 1 ) +with expansion: + 1 == 1 + +ConditionTests.cpp:: +PASSED: + REQUIRE( unsigned_int_var == 1 ) +with expansion: + 1 == 1 + +ConditionTests.cpp:: +PASSED: + REQUIRE( unsigned_long_var == 1 ) +with expansion: + 1 == 1 + +------------------------------------------------------------------------------- +Comparisons between unsigned ints and negative signed ints match c++ standard +behaviour +------------------------------------------------------------------------------- +ConditionTests.cpp: +............................................................................... + +ConditionTests.cpp:: +PASSED: + CHECK( ( -1 > 2u ) ) +with expansion: + true + +ConditionTests.cpp:: +PASSED: + CHECK( -1 > 2u ) +with expansion: + -1 > 2 + +ConditionTests.cpp:: +PASSED: + CHECK( ( 2u < -1 ) ) +with expansion: + true + +ConditionTests.cpp:: +PASSED: + CHECK( 2u < -1 ) +with expansion: + 2 < -1 + +ConditionTests.cpp:: +PASSED: + CHECK( ( minInt > 2u ) ) +with expansion: + true + +ConditionTests.cpp:: +PASSED: + CHECK( minInt > 2u ) +with expansion: + -2147483648 > 2 + +------------------------------------------------------------------------------- +Comparisons between ints where one side is computed +------------------------------------------------------------------------------- +ConditionTests.cpp: +............................................................................... + +ConditionTests.cpp:: +PASSED: + CHECK( 54 == 6*9 ) +with expansion: + 54 == 54 + +------------------------------------------------------------------------------- +Pointers can be compared to null +------------------------------------------------------------------------------- +ConditionTests.cpp: +............................................................................... + +ConditionTests.cpp:: +PASSED: + REQUIRE( p == __null ) +with expansion: + __null == 0 + +ConditionTests.cpp:: +PASSED: + REQUIRE( p == pNULL ) +with expansion: + __null == __null + +ConditionTests.cpp:: +PASSED: + REQUIRE( p != __null ) +with expansion: + 0x != 0 + +ConditionTests.cpp:: +PASSED: + REQUIRE( cp != __null ) +with expansion: + 0x != 0 + +ConditionTests.cpp:: +PASSED: + REQUIRE( cpc != __null ) +with expansion: + 0x != 0 + +ConditionTests.cpp:: +PASSED: + REQUIRE( returnsNull() == __null ) +with expansion: + {null string} == 0 + +ConditionTests.cpp:: +PASSED: + REQUIRE( returnsConstNull() == __null ) +with expansion: + {null string} == 0 + +ConditionTests.cpp:: +PASSED: + REQUIRE( __null != p ) +with expansion: + 0 != 0x + +------------------------------------------------------------------------------- +'Not' checks that should succeed +------------------------------------------------------------------------------- +ConditionTests.cpp: +............................................................................... + +ConditionTests.cpp:: +PASSED: + REQUIRE( false == false ) + +ConditionTests.cpp:: +PASSED: + REQUIRE( true == true ) + +ConditionTests.cpp:: +PASSED: + REQUIRE( !false ) +with expansion: + true + +ConditionTests.cpp:: +PASSED: + REQUIRE_FALSE( false ) + +ConditionTests.cpp:: +PASSED: + REQUIRE( !falseValue ) +with expansion: + true + +ConditionTests.cpp:: +PASSED: + REQUIRE_FALSE( falseValue ) +with expansion: + !false + +ConditionTests.cpp:: +PASSED: + REQUIRE( !(1 == 2) ) +with expansion: + true + +ConditionTests.cpp:: +PASSED: + REQUIRE_FALSE( 1 == 2 ) +with expansion: + !(1 == 2) + +------------------------------------------------------------------------------- +'Not' checks that should fail +------------------------------------------------------------------------------- +ConditionTests.cpp: +............................................................................... + +ConditionTests.cpp:: FAILED: + CHECK( false != false ) + +ConditionTests.cpp:: FAILED: + CHECK( true != true ) + +ConditionTests.cpp:: FAILED: + CHECK( !true ) +with expansion: + false + +ConditionTests.cpp:: FAILED: + CHECK_FALSE( true ) + +ConditionTests.cpp:: FAILED: + CHECK( !trueValue ) +with expansion: + false + +ConditionTests.cpp:: FAILED: + CHECK_FALSE( trueValue ) +with expansion: + !true + +ConditionTests.cpp:: FAILED: + CHECK( !(1 == 1) ) +with expansion: + false + +ConditionTests.cpp:: FAILED: + CHECK_FALSE( 1 == 1 ) +with expansion: + !(1 == 1) + +------------------------------------------------------------------------------- +When checked exceptions are thrown they can be expected or unexpected +------------------------------------------------------------------------------- +ExceptionTests.cpp: +............................................................................... + +ExceptionTests.cpp:: +PASSED: + REQUIRE_THROWS_AS( thisThrows() ) + +ExceptionTests.cpp:: +PASSED: + REQUIRE_NOTHROW( thisDoesntThrow() ) + +ExceptionTests.cpp:: +PASSED: + REQUIRE_THROWS( thisThrows() ) + +------------------------------------------------------------------------------- +Expected exceptions that don't throw or unexpected exceptions fail the test +------------------------------------------------------------------------------- +ExceptionTests.cpp: +............................................................................... + +ExceptionTests.cpp:: FAILED: + CHECK_THROWS_AS( thisThrows() ) +due to unexpected exception with message: + expected exception + +ExceptionTests.cpp:: FAILED: + CHECK_THROWS_AS( thisDoesntThrow() ) +because no exception was thrown where one was expected: + +ExceptionTests.cpp:: FAILED: + CHECK_NOTHROW( thisThrows() ) +due to unexpected exception with message: + expected exception + +------------------------------------------------------------------------------- +When unchecked exceptions are thrown directly they are always failures +------------------------------------------------------------------------------- +ExceptionTests.cpp: +............................................................................... + +ExceptionTests.cpp:: FAILED: +due to unexpected exception with message: + unexpected exception + +------------------------------------------------------------------------------- +An unchecked exception reports the line of the last assertion +------------------------------------------------------------------------------- +ExceptionTests.cpp: +............................................................................... + +ExceptionTests.cpp:: +PASSED: + CHECK( 1 == 1 ) + +ExceptionTests.cpp:: FAILED: + {Unknown expression after the reported line} +due to unexpected exception with message: + unexpected exception + +------------------------------------------------------------------------------- +When unchecked exceptions are thrown from sections they are always failures + section name +------------------------------------------------------------------------------- +ExceptionTests.cpp: +............................................................................... + +ExceptionTests.cpp:: FAILED: +due to unexpected exception with message: + unexpected exception + +------------------------------------------------------------------------------- +When unchecked exceptions are thrown from functions they are always failures +------------------------------------------------------------------------------- +ExceptionTests.cpp: +............................................................................... + +ExceptionTests.cpp:: FAILED: + CHECK( thisThrows() == 0 ) +due to unexpected exception with message: + expected exception + +------------------------------------------------------------------------------- +When unchecked exceptions are thrown, but caught, they do not affect the test +------------------------------------------------------------------------------- +ExceptionTests.cpp: +............................................................................... + + +No assertions in test case 'When unchecked exceptions are thrown, but caught, they do not affect the test' + +------------------------------------------------------------------------------- +Unexpected custom exceptions can be translated +------------------------------------------------------------------------------- +ExceptionTests.cpp: +............................................................................... + +ExceptionTests.cpp:: FAILED: +due to unexpected exception with message: + custom exception + +------------------------------------------------------------------------------- +Custom exceptions can be translated when testing for nothrow +------------------------------------------------------------------------------- +ExceptionTests.cpp: +............................................................................... + +ExceptionTests.cpp:: FAILED: + REQUIRE_NOTHROW( throwCustom() ) +due to unexpected exception with message: + custom exception - not std + +------------------------------------------------------------------------------- +Custom exceptions can be translated when testing for throwing as something else +------------------------------------------------------------------------------- +ExceptionTests.cpp: +............................................................................... + +ExceptionTests.cpp:: FAILED: + REQUIRE_THROWS_AS( throwCustom() ) +due to unexpected exception with message: + custom exception - not std + +------------------------------------------------------------------------------- +Unexpected exceptions can be translated +------------------------------------------------------------------------------- +ExceptionTests.cpp: +............................................................................... + +ExceptionTests.cpp:: FAILED: +due to unexpected exception with message: + 3.14 + +------------------------------------------------------------------------------- +NotImplemented exception +------------------------------------------------------------------------------- +ExceptionTests.cpp: +............................................................................... + +ExceptionTests.cpp:: +PASSED: + REQUIRE_THROWS( thisFunctionNotImplemented( 7 ) ) + +------------------------------------------------------------------------------- +Generators over two ranges +------------------------------------------------------------------------------- +GeneratorTests.cpp: +............................................................................... + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( i, 2 ) == i*2 ) +with expansion: + 2 == 2 + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( j, 2 ) == j*2 ) +with expansion: + 200 == 200 + +------------------------------------------------------------------------------- +Generators over two ranges +------------------------------------------------------------------------------- +GeneratorTests.cpp: +............................................................................... + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( i, 2 ) == i*2 ) +with expansion: + 4 == 4 + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( j, 2 ) == j*2 ) +with expansion: + 200 == 200 + +------------------------------------------------------------------------------- +Generators over two ranges +------------------------------------------------------------------------------- +GeneratorTests.cpp: +............................................................................... + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( i, 2 ) == i*2 ) +with expansion: + 6 == 6 + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( j, 2 ) == j*2 ) +with expansion: + 200 == 200 + +------------------------------------------------------------------------------- +Generators over two ranges +------------------------------------------------------------------------------- +GeneratorTests.cpp: +............................................................................... + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( i, 2 ) == i*2 ) +with expansion: + 8 == 8 + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( j, 2 ) == j*2 ) +with expansion: + 200 == 200 + +------------------------------------------------------------------------------- +Generators over two ranges +------------------------------------------------------------------------------- +GeneratorTests.cpp: +............................................................................... + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( i, 2 ) == i*2 ) +with expansion: + 10 == 10 + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( j, 2 ) == j*2 ) +with expansion: + 200 == 200 + +------------------------------------------------------------------------------- +Generators over two ranges +------------------------------------------------------------------------------- +GeneratorTests.cpp: +............................................................................... + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( i, 2 ) == i*2 ) +with expansion: + 30 == 30 + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( j, 2 ) == j*2 ) +with expansion: + 200 == 200 + +------------------------------------------------------------------------------- +Generators over two ranges +------------------------------------------------------------------------------- +GeneratorTests.cpp: +............................................................................... + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( i, 2 ) == i*2 ) +with expansion: + 40 == 40 + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( j, 2 ) == j*2 ) +with expansion: + 200 == 200 + +------------------------------------------------------------------------------- +Generators over two ranges +------------------------------------------------------------------------------- +GeneratorTests.cpp: +............................................................................... + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( i, 2 ) == i*2 ) +with expansion: + 42 == 42 + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( j, 2 ) == j*2 ) +with expansion: + 200 == 200 + +------------------------------------------------------------------------------- +Generators over two ranges +------------------------------------------------------------------------------- +GeneratorTests.cpp: +............................................................................... + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( i, 2 ) == i*2 ) +with expansion: + 72 == 72 + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( j, 2 ) == j*2 ) +with expansion: + 200 == 200 + +------------------------------------------------------------------------------- +Generators over two ranges +------------------------------------------------------------------------------- +GeneratorTests.cpp: +............................................................................... + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( i, 2 ) == i*2 ) +with expansion: + 2 == 2 + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( j, 2 ) == j*2 ) +with expansion: + 202 == 202 + +------------------------------------------------------------------------------- +Generators over two ranges +------------------------------------------------------------------------------- +GeneratorTests.cpp: +............................................................................... + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( i, 2 ) == i*2 ) +with expansion: + 4 == 4 + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( j, 2 ) == j*2 ) +with expansion: + 202 == 202 + +------------------------------------------------------------------------------- +Generators over two ranges +------------------------------------------------------------------------------- +GeneratorTests.cpp: +............................................................................... + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( i, 2 ) == i*2 ) +with expansion: + 6 == 6 + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( j, 2 ) == j*2 ) +with expansion: + 202 == 202 + +------------------------------------------------------------------------------- +Generators over two ranges +------------------------------------------------------------------------------- +GeneratorTests.cpp: +............................................................................... + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( i, 2 ) == i*2 ) +with expansion: + 8 == 8 + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( j, 2 ) == j*2 ) +with expansion: + 202 == 202 + +------------------------------------------------------------------------------- +Generators over two ranges +------------------------------------------------------------------------------- +GeneratorTests.cpp: +............................................................................... + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( i, 2 ) == i*2 ) +with expansion: + 10 == 10 + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( j, 2 ) == j*2 ) +with expansion: + 202 == 202 + +------------------------------------------------------------------------------- +Generators over two ranges +------------------------------------------------------------------------------- +GeneratorTests.cpp: +............................................................................... + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( i, 2 ) == i*2 ) +with expansion: + 30 == 30 + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( j, 2 ) == j*2 ) +with expansion: + 202 == 202 + +------------------------------------------------------------------------------- +Generators over two ranges +------------------------------------------------------------------------------- +GeneratorTests.cpp: +............................................................................... + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( i, 2 ) == i*2 ) +with expansion: + 40 == 40 + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( j, 2 ) == j*2 ) +with expansion: + 202 == 202 + +------------------------------------------------------------------------------- +Generators over two ranges +------------------------------------------------------------------------------- +GeneratorTests.cpp: +............................................................................... + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( i, 2 ) == i*2 ) +with expansion: + 42 == 42 + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( j, 2 ) == j*2 ) +with expansion: + 202 == 202 + +------------------------------------------------------------------------------- +Generators over two ranges +------------------------------------------------------------------------------- +GeneratorTests.cpp: +............................................................................... + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( i, 2 ) == i*2 ) +with expansion: + 72 == 72 + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( j, 2 ) == j*2 ) +with expansion: + 202 == 202 + +------------------------------------------------------------------------------- +Generators over two ranges +------------------------------------------------------------------------------- +GeneratorTests.cpp: +............................................................................... + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( i, 2 ) == i*2 ) +with expansion: + 2 == 2 + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( j, 2 ) == j*2 ) +with expansion: + 204 == 204 + +------------------------------------------------------------------------------- +Generators over two ranges +------------------------------------------------------------------------------- +GeneratorTests.cpp: +............................................................................... + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( i, 2 ) == i*2 ) +with expansion: + 4 == 4 + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( j, 2 ) == j*2 ) +with expansion: + 204 == 204 + +------------------------------------------------------------------------------- +Generators over two ranges +------------------------------------------------------------------------------- +GeneratorTests.cpp: +............................................................................... + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( i, 2 ) == i*2 ) +with expansion: + 6 == 6 + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( j, 2 ) == j*2 ) +with expansion: + 204 == 204 + +------------------------------------------------------------------------------- +Generators over two ranges +------------------------------------------------------------------------------- +GeneratorTests.cpp: +............................................................................... + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( i, 2 ) == i*2 ) +with expansion: + 8 == 8 + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( j, 2 ) == j*2 ) +with expansion: + 204 == 204 + +------------------------------------------------------------------------------- +Generators over two ranges +------------------------------------------------------------------------------- +GeneratorTests.cpp: +............................................................................... + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( i, 2 ) == i*2 ) +with expansion: + 10 == 10 + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( j, 2 ) == j*2 ) +with expansion: + 204 == 204 + +------------------------------------------------------------------------------- +Generators over two ranges +------------------------------------------------------------------------------- +GeneratorTests.cpp: +............................................................................... + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( i, 2 ) == i*2 ) +with expansion: + 30 == 30 + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( j, 2 ) == j*2 ) +with expansion: + 204 == 204 + +------------------------------------------------------------------------------- +Generators over two ranges +------------------------------------------------------------------------------- +GeneratorTests.cpp: +............................................................................... + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( i, 2 ) == i*2 ) +with expansion: + 40 == 40 + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( j, 2 ) == j*2 ) +with expansion: + 204 == 204 + +------------------------------------------------------------------------------- +Generators over two ranges +------------------------------------------------------------------------------- +GeneratorTests.cpp: +............................................................................... + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( i, 2 ) == i*2 ) +with expansion: + 42 == 42 + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( j, 2 ) == j*2 ) +with expansion: + 204 == 204 + +------------------------------------------------------------------------------- +Generators over two ranges +------------------------------------------------------------------------------- +GeneratorTests.cpp: +............................................................................... + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( i, 2 ) == i*2 ) +with expansion: + 72 == 72 + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( j, 2 ) == j*2 ) +with expansion: + 204 == 204 + +------------------------------------------------------------------------------- +Generators over two ranges +------------------------------------------------------------------------------- +GeneratorTests.cpp: +............................................................................... + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( i, 2 ) == i*2 ) +with expansion: + 2 == 2 + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( j, 2 ) == j*2 ) +with expansion: + 206 == 206 + +------------------------------------------------------------------------------- +Generators over two ranges +------------------------------------------------------------------------------- +GeneratorTests.cpp: +............................................................................... + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( i, 2 ) == i*2 ) +with expansion: + 4 == 4 + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( j, 2 ) == j*2 ) +with expansion: + 206 == 206 + +------------------------------------------------------------------------------- +Generators over two ranges +------------------------------------------------------------------------------- +GeneratorTests.cpp: +............................................................................... + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( i, 2 ) == i*2 ) +with expansion: + 6 == 6 + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( j, 2 ) == j*2 ) +with expansion: + 206 == 206 + +------------------------------------------------------------------------------- +Generators over two ranges +------------------------------------------------------------------------------- +GeneratorTests.cpp: +............................................................................... + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( i, 2 ) == i*2 ) +with expansion: + 8 == 8 + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( j, 2 ) == j*2 ) +with expansion: + 206 == 206 + +------------------------------------------------------------------------------- +Generators over two ranges +------------------------------------------------------------------------------- +GeneratorTests.cpp: +............................................................................... + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( i, 2 ) == i*2 ) +with expansion: + 10 == 10 + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( j, 2 ) == j*2 ) +with expansion: + 206 == 206 + +------------------------------------------------------------------------------- +Generators over two ranges +------------------------------------------------------------------------------- +GeneratorTests.cpp: +............................................................................... + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( i, 2 ) == i*2 ) +with expansion: + 30 == 30 + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( j, 2 ) == j*2 ) +with expansion: + 206 == 206 + +------------------------------------------------------------------------------- +Generators over two ranges +------------------------------------------------------------------------------- +GeneratorTests.cpp: +............................................................................... + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( i, 2 ) == i*2 ) +with expansion: + 40 == 40 + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( j, 2 ) == j*2 ) +with expansion: + 206 == 206 + +------------------------------------------------------------------------------- +Generators over two ranges +------------------------------------------------------------------------------- +GeneratorTests.cpp: +............................................................................... + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( i, 2 ) == i*2 ) +with expansion: + 42 == 42 + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( j, 2 ) == j*2 ) +with expansion: + 206 == 206 + +------------------------------------------------------------------------------- +Generators over two ranges +------------------------------------------------------------------------------- +GeneratorTests.cpp: +............................................................................... + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( i, 2 ) == i*2 ) +with expansion: + 72 == 72 + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( j, 2 ) == j*2 ) +with expansion: + 206 == 206 + +------------------------------------------------------------------------------- +Generators over two ranges +------------------------------------------------------------------------------- +GeneratorTests.cpp: +............................................................................... + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( i, 2 ) == i*2 ) +with expansion: + 2 == 2 + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( j, 2 ) == j*2 ) +with expansion: + 208 == 208 + +------------------------------------------------------------------------------- +Generators over two ranges +------------------------------------------------------------------------------- +GeneratorTests.cpp: +............................................................................... + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( i, 2 ) == i*2 ) +with expansion: + 4 == 4 + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( j, 2 ) == j*2 ) +with expansion: + 208 == 208 + +------------------------------------------------------------------------------- +Generators over two ranges +------------------------------------------------------------------------------- +GeneratorTests.cpp: +............................................................................... + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( i, 2 ) == i*2 ) +with expansion: + 6 == 6 + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( j, 2 ) == j*2 ) +with expansion: + 208 == 208 + +------------------------------------------------------------------------------- +Generators over two ranges +------------------------------------------------------------------------------- +GeneratorTests.cpp: +............................................................................... + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( i, 2 ) == i*2 ) +with expansion: + 8 == 8 + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( j, 2 ) == j*2 ) +with expansion: + 208 == 208 + +------------------------------------------------------------------------------- +Generators over two ranges +------------------------------------------------------------------------------- +GeneratorTests.cpp: +............................................................................... + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( i, 2 ) == i*2 ) +with expansion: + 10 == 10 + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( j, 2 ) == j*2 ) +with expansion: + 208 == 208 + +------------------------------------------------------------------------------- +Generators over two ranges +------------------------------------------------------------------------------- +GeneratorTests.cpp: +............................................................................... + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( i, 2 ) == i*2 ) +with expansion: + 30 == 30 + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( j, 2 ) == j*2 ) +with expansion: + 208 == 208 + +------------------------------------------------------------------------------- +Generators over two ranges +------------------------------------------------------------------------------- +GeneratorTests.cpp: +............................................................................... + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( i, 2 ) == i*2 ) +with expansion: + 40 == 40 + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( j, 2 ) == j*2 ) +with expansion: + 208 == 208 + +------------------------------------------------------------------------------- +Generators over two ranges +------------------------------------------------------------------------------- +GeneratorTests.cpp: +............................................................................... + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( i, 2 ) == i*2 ) +with expansion: + 42 == 42 + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( j, 2 ) == j*2 ) +with expansion: + 208 == 208 + +------------------------------------------------------------------------------- +Generators over two ranges +------------------------------------------------------------------------------- +GeneratorTests.cpp: +............................................................................... + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( i, 2 ) == i*2 ) +with expansion: + 72 == 72 + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( j, 2 ) == j*2 ) +with expansion: + 208 == 208 + +------------------------------------------------------------------------------- +Generators over two ranges +------------------------------------------------------------------------------- +GeneratorTests.cpp: +............................................................................... + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( i, 2 ) == i*2 ) +with expansion: + 2 == 2 + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( j, 2 ) == j*2 ) +with expansion: + 210 == 210 + +------------------------------------------------------------------------------- +Generators over two ranges +------------------------------------------------------------------------------- +GeneratorTests.cpp: +............................................................................... + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( i, 2 ) == i*2 ) +with expansion: + 4 == 4 + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( j, 2 ) == j*2 ) +with expansion: + 210 == 210 + +------------------------------------------------------------------------------- +Generators over two ranges +------------------------------------------------------------------------------- +GeneratorTests.cpp: +............................................................................... + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( i, 2 ) == i*2 ) +with expansion: + 6 == 6 + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( j, 2 ) == j*2 ) +with expansion: + 210 == 210 + +------------------------------------------------------------------------------- +Generators over two ranges +------------------------------------------------------------------------------- +GeneratorTests.cpp: +............................................................................... + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( i, 2 ) == i*2 ) +with expansion: + 8 == 8 + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( j, 2 ) == j*2 ) +with expansion: + 210 == 210 + +------------------------------------------------------------------------------- +Generators over two ranges +------------------------------------------------------------------------------- +GeneratorTests.cpp: +............................................................................... + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( i, 2 ) == i*2 ) +with expansion: + 10 == 10 + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( j, 2 ) == j*2 ) +with expansion: + 210 == 210 + +------------------------------------------------------------------------------- +Generators over two ranges +------------------------------------------------------------------------------- +GeneratorTests.cpp: +............................................................................... + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( i, 2 ) == i*2 ) +with expansion: + 30 == 30 + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( j, 2 ) == j*2 ) +with expansion: + 210 == 210 + +------------------------------------------------------------------------------- +Generators over two ranges +------------------------------------------------------------------------------- +GeneratorTests.cpp: +............................................................................... + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( i, 2 ) == i*2 ) +with expansion: + 40 == 40 + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( j, 2 ) == j*2 ) +with expansion: + 210 == 210 + +------------------------------------------------------------------------------- +Generators over two ranges +------------------------------------------------------------------------------- +GeneratorTests.cpp: +............................................................................... + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( i, 2 ) == i*2 ) +with expansion: + 42 == 42 + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( j, 2 ) == j*2 ) +with expansion: + 210 == 210 + +------------------------------------------------------------------------------- +Generators over two ranges +------------------------------------------------------------------------------- +GeneratorTests.cpp: +............................................................................... + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( i, 2 ) == i*2 ) +with expansion: + 72 == 72 + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( j, 2 ) == j*2 ) +with expansion: + 210 == 210 + +------------------------------------------------------------------------------- +Generators over two ranges +------------------------------------------------------------------------------- +GeneratorTests.cpp: +............................................................................... + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( i, 2 ) == i*2 ) +with expansion: + 2 == 2 + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( j, 2 ) == j*2 ) +with expansion: + 212 == 212 + +------------------------------------------------------------------------------- +Generators over two ranges +------------------------------------------------------------------------------- +GeneratorTests.cpp: +............................................................................... + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( i, 2 ) == i*2 ) +with expansion: + 4 == 4 + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( j, 2 ) == j*2 ) +with expansion: + 212 == 212 + +------------------------------------------------------------------------------- +Generators over two ranges +------------------------------------------------------------------------------- +GeneratorTests.cpp: +............................................................................... + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( i, 2 ) == i*2 ) +with expansion: + 6 == 6 + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( j, 2 ) == j*2 ) +with expansion: + 212 == 212 + +------------------------------------------------------------------------------- +Generators over two ranges +------------------------------------------------------------------------------- +GeneratorTests.cpp: +............................................................................... + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( i, 2 ) == i*2 ) +with expansion: + 8 == 8 + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( j, 2 ) == j*2 ) +with expansion: + 212 == 212 + +------------------------------------------------------------------------------- +Generators over two ranges +------------------------------------------------------------------------------- +GeneratorTests.cpp: +............................................................................... + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( i, 2 ) == i*2 ) +with expansion: + 10 == 10 + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( j, 2 ) == j*2 ) +with expansion: + 212 == 212 + +------------------------------------------------------------------------------- +Generators over two ranges +------------------------------------------------------------------------------- +GeneratorTests.cpp: +............................................................................... + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( i, 2 ) == i*2 ) +with expansion: + 30 == 30 + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( j, 2 ) == j*2 ) +with expansion: + 212 == 212 + +------------------------------------------------------------------------------- +Generators over two ranges +------------------------------------------------------------------------------- +GeneratorTests.cpp: +............................................................................... + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( i, 2 ) == i*2 ) +with expansion: + 40 == 40 + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( j, 2 ) == j*2 ) +with expansion: + 212 == 212 + +------------------------------------------------------------------------------- +Generators over two ranges +------------------------------------------------------------------------------- +GeneratorTests.cpp: +............................................................................... + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( i, 2 ) == i*2 ) +with expansion: + 42 == 42 + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( j, 2 ) == j*2 ) +with expansion: + 212 == 212 + +------------------------------------------------------------------------------- +Generators over two ranges +------------------------------------------------------------------------------- +GeneratorTests.cpp: +............................................................................... + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( i, 2 ) == i*2 ) +with expansion: + 72 == 72 + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( j, 2 ) == j*2 ) +with expansion: + 212 == 212 + +------------------------------------------------------------------------------- +Generators over two ranges +------------------------------------------------------------------------------- +GeneratorTests.cpp: +............................................................................... + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( i, 2 ) == i*2 ) +with expansion: + 2 == 2 + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( j, 2 ) == j*2 ) +with expansion: + 214 == 214 + +------------------------------------------------------------------------------- +Generators over two ranges +------------------------------------------------------------------------------- +GeneratorTests.cpp: +............................................................................... + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( i, 2 ) == i*2 ) +with expansion: + 4 == 4 + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( j, 2 ) == j*2 ) +with expansion: + 214 == 214 + +------------------------------------------------------------------------------- +Generators over two ranges +------------------------------------------------------------------------------- +GeneratorTests.cpp: +............................................................................... + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( i, 2 ) == i*2 ) +with expansion: + 6 == 6 + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( j, 2 ) == j*2 ) +with expansion: + 214 == 214 + +------------------------------------------------------------------------------- +Generators over two ranges +------------------------------------------------------------------------------- +GeneratorTests.cpp: +............................................................................... + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( i, 2 ) == i*2 ) +with expansion: + 8 == 8 + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( j, 2 ) == j*2 ) +with expansion: + 214 == 214 + +------------------------------------------------------------------------------- +Generators over two ranges +------------------------------------------------------------------------------- +GeneratorTests.cpp: +............................................................................... + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( i, 2 ) == i*2 ) +with expansion: + 10 == 10 + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( j, 2 ) == j*2 ) +with expansion: + 214 == 214 + +------------------------------------------------------------------------------- +Generators over two ranges +------------------------------------------------------------------------------- +GeneratorTests.cpp: +............................................................................... + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( i, 2 ) == i*2 ) +with expansion: + 30 == 30 + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( j, 2 ) == j*2 ) +with expansion: + 214 == 214 + +------------------------------------------------------------------------------- +Generators over two ranges +------------------------------------------------------------------------------- +GeneratorTests.cpp: +............................................................................... + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( i, 2 ) == i*2 ) +with expansion: + 40 == 40 + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( j, 2 ) == j*2 ) +with expansion: + 214 == 214 + +------------------------------------------------------------------------------- +Generators over two ranges +------------------------------------------------------------------------------- +GeneratorTests.cpp: +............................................................................... + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( i, 2 ) == i*2 ) +with expansion: + 42 == 42 + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( j, 2 ) == j*2 ) +with expansion: + 214 == 214 + +------------------------------------------------------------------------------- +Generators over two ranges +------------------------------------------------------------------------------- +GeneratorTests.cpp: +............................................................................... + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( i, 2 ) == i*2 ) +with expansion: + 72 == 72 + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( multiply( j, 2 ) == j*2 ) +with expansion: + 214 == 214 + +------------------------------------------------------------------------------- +Generator over a range of pairs +------------------------------------------------------------------------------- +GeneratorTests.cpp: +............................................................................... + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( i->first == i->second-1 ) +with expansion: + 0 == 0 + +------------------------------------------------------------------------------- +Generator over a range of pairs +------------------------------------------------------------------------------- +GeneratorTests.cpp: +............................................................................... + +GeneratorTests.cpp:: +PASSED: + CATCH_REQUIRE( i->first == i->second-1 ) +with expansion: + 2 == 2 + +------------------------------------------------------------------------------- +INFO and WARN do not abort tests +------------------------------------------------------------------------------- +MessageTests.cpp: +............................................................................... + +MessageTests.cpp:: +warning: + this is a message + this is a warning + + +No assertions in test case 'INFO and WARN do not abort tests' + +------------------------------------------------------------------------------- +SUCCEED counts as a test pass +------------------------------------------------------------------------------- +MessageTests.cpp: +............................................................................... + +MessageTests.cpp:: +PASSED: +with message: + this is a success + +------------------------------------------------------------------------------- +INFO gets logged on failure +------------------------------------------------------------------------------- +MessageTests.cpp: +............................................................................... + +MessageTests.cpp:: FAILED: + REQUIRE( a == 1 ) +with expansion: + 2 == 1 +with messages: + this message should be logged + so should this + +------------------------------------------------------------------------------- +INFO gets logged on failure, even if captured before successful assertions +------------------------------------------------------------------------------- +MessageTests.cpp: +............................................................................... + +MessageTests.cpp:: +PASSED: + CHECK( a == 2 ) +with expansion: + 2 == 2 +with message: + this message may be logged later + +MessageTests.cpp:: FAILED: + CHECK( a == 1 ) +with expansion: + 2 == 1 +with message: + this message should be logged + +MessageTests.cpp:: FAILED: + CHECK( a == 0 ) +with expansion: + 2 == 0 +with message: + and this, but later + +MessageTests.cpp:: +PASSED: + CHECK( a == 2 ) +with expansion: + 2 == 2 +with message: + but not this + +------------------------------------------------------------------------------- +FAIL aborts the test +------------------------------------------------------------------------------- +MessageTests.cpp: +............................................................................... + +MessageTests.cpp:: FAILED: +explicitly with message: + This is a failure + +------------------------------------------------------------------------------- +FAIL does not require an argument +------------------------------------------------------------------------------- +MessageTests.cpp: +............................................................................... + +MessageTests.cpp:: FAILED: + +------------------------------------------------------------------------------- +SUCCESS does not require an argument +------------------------------------------------------------------------------- +MessageTests.cpp: +............................................................................... + +MessageTests.cpp:: +PASSED: + +------------------------------------------------------------------------------- +Output from all sections is reported + one +------------------------------------------------------------------------------- +MessageTests.cpp: +............................................................................... + +MessageTests.cpp:: FAILED: +explicitly with message: + Message from section one + +------------------------------------------------------------------------------- +Output from all sections is reported + two +------------------------------------------------------------------------------- +MessageTests.cpp: +............................................................................... + +MessageTests.cpp:: FAILED: +explicitly with message: + Message from section two + +Message from section one +------------------------------------------------------------------------------- +Standard output from all sections is reported + one +------------------------------------------------------------------------------- +MessageTests.cpp: +............................................................................... + + +No assertions in section 'one' + +Message from section two +------------------------------------------------------------------------------- +Standard output from all sections is reported + two +------------------------------------------------------------------------------- +MessageTests.cpp: +............................................................................... + + +No assertions in section 'two' + +------------------------------------------------------------------------------- +SCOPED_INFO is reset for each loop +------------------------------------------------------------------------------- +MessageTests.cpp: +............................................................................... + +MessageTests.cpp:: +PASSED: + REQUIRE( i < 10 ) +with expansion: + 0 < 10 +with messages: + current counter 0 + i := 0 + +MessageTests.cpp:: +PASSED: + REQUIRE( i < 10 ) +with expansion: + 1 < 10 +with messages: + current counter 1 + i := 1 + +MessageTests.cpp:: +PASSED: + REQUIRE( i < 10 ) +with expansion: + 2 < 10 +with messages: + current counter 2 + i := 2 + +MessageTests.cpp:: +PASSED: + REQUIRE( i < 10 ) +with expansion: + 3 < 10 +with messages: + current counter 3 + i := 3 + +MessageTests.cpp:: +PASSED: + REQUIRE( i < 10 ) +with expansion: + 4 < 10 +with messages: + current counter 4 + i := 4 + +MessageTests.cpp:: +PASSED: + REQUIRE( i < 10 ) +with expansion: + 5 < 10 +with messages: + current counter 5 + i := 5 + +MessageTests.cpp:: +PASSED: + REQUIRE( i < 10 ) +with expansion: + 6 < 10 +with messages: + current counter 6 + i := 6 + +MessageTests.cpp:: +PASSED: + REQUIRE( i < 10 ) +with expansion: + 7 < 10 +with messages: + current counter 7 + i := 7 + +MessageTests.cpp:: +PASSED: + REQUIRE( i < 10 ) +with expansion: + 8 < 10 +with messages: + current counter 8 + i := 8 + +MessageTests.cpp:: +PASSED: + REQUIRE( i < 10 ) +with expansion: + 9 < 10 +with messages: + current counter 9 + i := 9 + +MessageTests.cpp:: FAILED: + REQUIRE( i < 10 ) +with expansion: + 10 < 10 +with messages: + current counter 10 + i := 10 + +------------------------------------------------------------------------------- +The NO_FAIL macro reports a failure but does not fail the test +------------------------------------------------------------------------------- +MessageTests.cpp: +............................................................................... + +MessageTests.cpp:: +FAILED - but was ok: + CHECK_NOFAIL( 1 == 2 ) + + +No assertions in test case 'The NO_FAIL macro reports a failure but does not fail the test' + +------------------------------------------------------------------------------- +just info +------------------------------------------------------------------------------- +MessageTests.cpp: +............................................................................... + + +No assertions in test case 'just info' + +------------------------------------------------------------------------------- +just failure +------------------------------------------------------------------------------- +MessageTests.cpp: +............................................................................... + +MessageTests.cpp:: FAILED: +explicitly with message: + Previous info should not be seen + +------------------------------------------------------------------------------- +sends information to INFO +------------------------------------------------------------------------------- +MessageTests.cpp: +............................................................................... + +MessageTests.cpp:: FAILED: + REQUIRE( false ) +with messages: + hi + i := 7 + +------------------------------------------------------------------------------- +random SECTION tests + s1 +------------------------------------------------------------------------------- +MiscTests.cpp: +............................................................................... + +MiscTests.cpp:: +PASSED: + REQUIRE( a != b ) +with expansion: + 1 != 2 + +MiscTests.cpp:: +PASSED: + REQUIRE( b != a ) +with expansion: + 2 != 1 + +------------------------------------------------------------------------------- +random SECTION tests + s2 +------------------------------------------------------------------------------- +MiscTests.cpp: +............................................................................... + +MiscTests.cpp:: +PASSED: + REQUIRE( a != b ) +with expansion: + 1 != 2 + +------------------------------------------------------------------------------- +nested SECTION tests + s1 +------------------------------------------------------------------------------- +MiscTests.cpp: +............................................................................... + +MiscTests.cpp:: +PASSED: + REQUIRE( a != b ) +with expansion: + 1 != 2 + +MiscTests.cpp:: +PASSED: + REQUIRE( b != a ) +with expansion: + 2 != 1 + +------------------------------------------------------------------------------- +nested SECTION tests + s1 +------------------------------------------------------------------------------- +MiscTests.cpp: +............................................................................... + +MiscTests.cpp:: +PASSED: + REQUIRE( a != b ) +with expansion: + 1 != 2 + +MiscTests.cpp:: +PASSED: + REQUIRE( b != a ) +with expansion: + 2 != 1 + +------------------------------------------------------------------------------- +nested SECTION tests + s1 + s2 +------------------------------------------------------------------------------- +MiscTests.cpp: +............................................................................... + +MiscTests.cpp:: +PASSED: + REQUIRE( a != b ) +with expansion: + 1 != 2 + +------------------------------------------------------------------------------- +more nested SECTION tests + s1 + s2 +------------------------------------------------------------------------------- +MiscTests.cpp: +............................................................................... + +MiscTests.cpp:: FAILED: + REQUIRE( a == b ) +with expansion: + 1 == 2 + +------------------------------------------------------------------------------- +more nested SECTION tests + s1 + s3 +------------------------------------------------------------------------------- +MiscTests.cpp: +............................................................................... + +MiscTests.cpp:: +PASSED: + REQUIRE( a != b ) +with expansion: + 1 != 2 + +------------------------------------------------------------------------------- +more nested SECTION tests + s1 + s4 +------------------------------------------------------------------------------- +MiscTests.cpp: +............................................................................... + +MiscTests.cpp:: +PASSED: + REQUIRE( a < b ) +with expansion: + 1 < 2 + +------------------------------------------------------------------------------- +even more nested SECTION tests + c + d (leaf) +------------------------------------------------------------------------------- +MiscTests.cpp: +............................................................................... + + +No assertions in section 'd (leaf)' + +------------------------------------------------------------------------------- +even more nested SECTION tests + c + e (leaf) +------------------------------------------------------------------------------- +MiscTests.cpp: +............................................................................... + + +No assertions in section 'e (leaf)' + +------------------------------------------------------------------------------- +even more nested SECTION tests + f (leaf) +------------------------------------------------------------------------------- +MiscTests.cpp: +............................................................................... + + +No assertions in section 'f (leaf)' + +------------------------------------------------------------------------------- +looped SECTION tests + s1 +------------------------------------------------------------------------------- +MiscTests.cpp: +............................................................................... + +MiscTests.cpp:: FAILED: + CHECK( b > a ) +with expansion: + 0 > 1 + +------------------------------------------------------------------------------- +looped tests +------------------------------------------------------------------------------- +MiscTests.cpp: +............................................................................... + +MiscTests.cpp:: FAILED: + CHECK( ( fib[i] % 2 ) == 0 ) +with expansion: + 1 == 0 +with message: + Testing if fib[0] (1) is even + +MiscTests.cpp:: FAILED: + CHECK( ( fib[i] % 2 ) == 0 ) +with expansion: + 1 == 0 +with message: + Testing if fib[1] (1) is even + +MiscTests.cpp:: +PASSED: + CHECK( ( fib[i] % 2 ) == 0 ) +with expansion: + 0 == 0 +with message: + Testing if fib[2] (2) is even + +MiscTests.cpp:: FAILED: + CHECK( ( fib[i] % 2 ) == 0 ) +with expansion: + 1 == 0 +with message: + Testing if fib[3] (3) is even + +MiscTests.cpp:: FAILED: + CHECK( ( fib[i] % 2 ) == 0 ) +with expansion: + 1 == 0 +with message: + Testing if fib[4] (5) is even + +MiscTests.cpp:: +PASSED: + CHECK( ( fib[i] % 2 ) == 0 ) +with expansion: + 0 == 0 +with message: + Testing if fib[5] (8) is even + +MiscTests.cpp:: FAILED: + CHECK( ( fib[i] % 2 ) == 0 ) +with expansion: + 1 == 0 +with message: + Testing if fib[6] (13) is even + +MiscTests.cpp:: FAILED: + CHECK( ( fib[i] % 2 ) == 0 ) +with expansion: + 1 == 0 +with message: + Testing if fib[7] (21) is even + +A string sent directly to stdout +A string sent directly to stderr +------------------------------------------------------------------------------- +Sends stuff to stdout and stderr +------------------------------------------------------------------------------- +MiscTests.cpp: +............................................................................... + + +No assertions in test case 'Sends stuff to stdout and stderr' + +------------------------------------------------------------------------------- +null strings +------------------------------------------------------------------------------- +MiscTests.cpp: +............................................................................... + +MiscTests.cpp:: +PASSED: + REQUIRE( makeString( false ) != static_cast(__null) ) +with expansion: + "valid string" != {null string} + +MiscTests.cpp:: +PASSED: + REQUIRE( makeString( true ) == static_cast(__null) ) +with expansion: + {null string} == {null string} + +------------------------------------------------------------------------------- +checkedIf +------------------------------------------------------------------------------- +MiscTests.cpp: +............................................................................... + +MiscTests.cpp:: +PASSED: + CHECKED_IF( flag ) +with expansion: + true + +MiscTests.cpp:: +PASSED: + REQUIRE( testCheckedIf( true ) ) +with expansion: + true + +------------------------------------------------------------------------------- +checkedIf, failing +------------------------------------------------------------------------------- +MiscTests.cpp: +............................................................................... + +MiscTests.cpp:: FAILED: + CHECKED_IF( flag ) +with expansion: + false + +MiscTests.cpp:: FAILED: + REQUIRE( testCheckedIf( false ) ) +with expansion: + false + +------------------------------------------------------------------------------- +checkedElse +------------------------------------------------------------------------------- +MiscTests.cpp: +............................................................................... + +MiscTests.cpp:: +PASSED: + CHECKED_ELSE( flag ) +with expansion: + true + +MiscTests.cpp:: +PASSED: + REQUIRE( testCheckedElse( true ) ) +with expansion: + true + +------------------------------------------------------------------------------- +checkedElse, failing +------------------------------------------------------------------------------- +MiscTests.cpp: +............................................................................... + +MiscTests.cpp:: FAILED: + CHECKED_ELSE( flag ) +with expansion: + false + +MiscTests.cpp:: FAILED: + REQUIRE( testCheckedElse( false ) ) +with expansion: + false + +------------------------------------------------------------------------------- +xmlentitycheck + embedded xml +------------------------------------------------------------------------------- +MiscTests.cpp: +............................................................................... + + +No assertions in section 'embedded xml' + +------------------------------------------------------------------------------- +xmlentitycheck + encoded chars +------------------------------------------------------------------------------- +MiscTests.cpp: +............................................................................... + + +No assertions in section 'encoded chars' + +------------------------------------------------------------------------------- +send a single char to INFO +------------------------------------------------------------------------------- +MiscTests.cpp: +............................................................................... + +MiscTests.cpp:: FAILED: + REQUIRE( false ) +with message: + 3 + +------------------------------------------------------------------------------- +atomic if +------------------------------------------------------------------------------- +MiscTests.cpp: +............................................................................... + +MiscTests.cpp:: +PASSED: + REQUIRE( x == 0 ) +with expansion: + 0 == 0 + +------------------------------------------------------------------------------- +String matchers +------------------------------------------------------------------------------- +MiscTests.cpp: +............................................................................... + +MiscTests.cpp:: +PASSED: + REQUIRE_THAT( testStringForMatching() Contains( "string" ) ) +with expansion: + "this string contains 'abc' as a substring" contains: "string" + +MiscTests.cpp:: +PASSED: + CHECK_THAT( testStringForMatching() Contains( "abc" ) ) +with expansion: + "this string contains 'abc' as a substring" contains: "abc" + +MiscTests.cpp:: +PASSED: + CHECK_THAT( testStringForMatching() StartsWith( "this" ) ) +with expansion: + "this string contains 'abc' as a substring" starts with: "this" + +MiscTests.cpp:: +PASSED: + CHECK_THAT( testStringForMatching() EndsWith( "substring" ) ) +with expansion: + "this string contains 'abc' as a substring" ends with: "substring" + +------------------------------------------------------------------------------- +Contains string matcher +------------------------------------------------------------------------------- +MiscTests.cpp: +............................................................................... + +MiscTests.cpp:: FAILED: + CHECK_THAT( testStringForMatching() Contains( "not there" ) ) +with expansion: + "this string contains 'abc' as a substring" contains: "not there" + +------------------------------------------------------------------------------- +StartsWith string matcher +------------------------------------------------------------------------------- +MiscTests.cpp: +............................................................................... + +MiscTests.cpp:: FAILED: + CHECK_THAT( testStringForMatching() StartsWith( "string" ) ) +with expansion: + "this string contains 'abc' as a substring" starts with: "string" + +------------------------------------------------------------------------------- +EndsWith string matcher +------------------------------------------------------------------------------- +MiscTests.cpp: +............................................................................... + +MiscTests.cpp:: FAILED: + CHECK_THAT( testStringForMatching() EndsWith( "this" ) ) +with expansion: + "this string contains 'abc' as a substring" ends with: "this" + +------------------------------------------------------------------------------- +Equals string matcher +------------------------------------------------------------------------------- +MiscTests.cpp: +............................................................................... + +MiscTests.cpp:: FAILED: + CHECK_THAT( testStringForMatching() Equals( "something else" ) ) +with expansion: + "this string contains 'abc' as a substring" equals: "something else" + +------------------------------------------------------------------------------- +Equals string matcher, with NULL +------------------------------------------------------------------------------- +MiscTests.cpp: +............................................................................... + +MiscTests.cpp:: +PASSED: + REQUIRE_THAT( "" Equals(__null) ) +with expansion: + "" equals: "" + +------------------------------------------------------------------------------- +AllOf matcher +------------------------------------------------------------------------------- +MiscTests.cpp: +............................................................................... + +MiscTests.cpp:: +PASSED: + CHECK_THAT( testStringForMatching() AllOf( Catch::Contains( "string" ), Catch::Contains( "abc" ) ) ) +with expansion: + "this string contains 'abc' as a substring" ( contains: "string" and + contains: "abc" ) + +------------------------------------------------------------------------------- +AnyOf matcher +------------------------------------------------------------------------------- +MiscTests.cpp: +............................................................................... + +MiscTests.cpp:: +PASSED: + CHECK_THAT( testStringForMatching() AnyOf( Catch::Contains( "string" ), Catch::Contains( "not there" ) ) ) +with expansion: + "this string contains 'abc' as a substring" ( contains: "string" or contains: + "not there" ) + +MiscTests.cpp:: +PASSED: + CHECK_THAT( testStringForMatching() AnyOf( Catch::Contains( "not there" ), Catch::Contains( "string" ) ) ) +with expansion: + "this string contains 'abc' as a substring" ( contains: "not there" or + contains: "string" ) + +------------------------------------------------------------------------------- +Equals +------------------------------------------------------------------------------- +MiscTests.cpp: +............................................................................... + +MiscTests.cpp:: +PASSED: + CHECK_THAT( testStringForMatching() Equals( "this string contains 'abc' as a substring" ) ) +with expansion: + "this string contains 'abc' as a substring" equals: "this string contains + 'abc' as a substring" + +------------------------------------------------------------------------------- +Factorials are computed +------------------------------------------------------------------------------- +MiscTests.cpp: +............................................................................... + +MiscTests.cpp:: +PASSED: + REQUIRE( Factorial(0) == 1 ) +with expansion: + 1 == 1 + +MiscTests.cpp:: +PASSED: + REQUIRE( Factorial(1) == 1 ) +with expansion: + 1 == 1 + +MiscTests.cpp:: +PASSED: + REQUIRE( Factorial(2) == 2 ) +with expansion: + 2 == 2 + +MiscTests.cpp:: +PASSED: + REQUIRE( Factorial(3) == 6 ) +with expansion: + 6 == 6 + +MiscTests.cpp:: +PASSED: + REQUIRE( Factorial(10) == 3628800 ) +with expansion: + 0x == 3628800 + +------------------------------------------------------------------------------- +An empty test with no assertions +------------------------------------------------------------------------------- +MiscTests.cpp: +............................................................................... + + +No assertions in test case 'An empty test with no assertions' + +------------------------------------------------------------------------------- +Nice descriptive name +------------------------------------------------------------------------------- +MiscTests.cpp: +............................................................................... + +MiscTests.cpp:: +warning: + This one ran + + +No assertions in test case 'Nice descriptive name' + +------------------------------------------------------------------------------- +first tag +------------------------------------------------------------------------------- +MiscTests.cpp: +............................................................................... + + +No assertions in test case 'first tag' + +------------------------------------------------------------------------------- +second tag +------------------------------------------------------------------------------- +MiscTests.cpp: +............................................................................... + + +No assertions in test case 'second tag' + +------------------------------------------------------------------------------- +vectors can be sized and resized +------------------------------------------------------------------------------- +MiscTests.cpp: +............................................................................... + +MiscTests.cpp:: +PASSED: + REQUIRE( v.size() == 5 ) +with expansion: + 5 == 5 + +MiscTests.cpp:: +PASSED: + REQUIRE( v.capacity() >= 5 ) +with expansion: + 5 >= 5 + +------------------------------------------------------------------------------- +vectors can be sized and resized +------------------------------------------------------------------------------- +MiscTests.cpp: +............................................................................... + +MiscTests.cpp:: +PASSED: + REQUIRE( v.size() == 5 ) +with expansion: + 5 == 5 + +MiscTests.cpp:: +PASSED: + REQUIRE( v.capacity() >= 5 ) +with expansion: + 5 >= 5 + +------------------------------------------------------------------------------- +vectors can be sized and resized + resizing bigger changes size and capacity +------------------------------------------------------------------------------- +MiscTests.cpp: +............................................................................... + +MiscTests.cpp:: +PASSED: + REQUIRE( v.size() == 10 ) +with expansion: + 10 == 10 + +MiscTests.cpp:: +PASSED: + REQUIRE( v.capacity() >= 10 ) +with expansion: + 10 >= 10 + +------------------------------------------------------------------------------- +vectors can be sized and resized +------------------------------------------------------------------------------- +MiscTests.cpp: +............................................................................... + +MiscTests.cpp:: +PASSED: + REQUIRE( v.size() == 5 ) +with expansion: + 5 == 5 + +MiscTests.cpp:: +PASSED: + REQUIRE( v.capacity() >= 5 ) +with expansion: + 5 >= 5 + +------------------------------------------------------------------------------- +vectors can be sized and resized + resizing smaller changes size but not capacity +------------------------------------------------------------------------------- +MiscTests.cpp: +............................................................................... + +MiscTests.cpp:: +PASSED: + REQUIRE( v.size() == 0 ) +with expansion: + 0 == 0 + +MiscTests.cpp:: +PASSED: + REQUIRE( v.capacity() >= 5 ) +with expansion: + 5 >= 5 + +------------------------------------------------------------------------------- +vectors can be sized and resized +------------------------------------------------------------------------------- +MiscTests.cpp: +............................................................................... + +MiscTests.cpp:: +PASSED: + REQUIRE( v.size() == 5 ) +with expansion: + 5 == 5 + +MiscTests.cpp:: +PASSED: + REQUIRE( v.capacity() >= 5 ) +with expansion: + 5 >= 5 + +------------------------------------------------------------------------------- +vectors can be sized and resized + resizing smaller changes size but not capacity +------------------------------------------------------------------------------- +MiscTests.cpp: +............................................................................... + +MiscTests.cpp:: +PASSED: + REQUIRE( v.size() == 0 ) +with expansion: + 0 == 0 + +MiscTests.cpp:: +PASSED: + REQUIRE( v.capacity() >= 5 ) +with expansion: + 5 >= 5 + +------------------------------------------------------------------------------- +vectors can be sized and resized + resizing smaller changes size but not capacity + We can use the 'swap trick' to reset the capacity +------------------------------------------------------------------------------- +MiscTests.cpp: +............................................................................... + +MiscTests.cpp:: +PASSED: + REQUIRE( v.capacity() == 0 ) +with expansion: + 0 == 0 + +------------------------------------------------------------------------------- +vectors can be sized and resized +------------------------------------------------------------------------------- +MiscTests.cpp: +............................................................................... + +MiscTests.cpp:: +PASSED: + REQUIRE( v.size() == 5 ) +with expansion: + 5 == 5 + +MiscTests.cpp:: +PASSED: + REQUIRE( v.capacity() >= 5 ) +with expansion: + 5 >= 5 + +------------------------------------------------------------------------------- +vectors can be sized and resized + reserving bigger changes capacity but not size +------------------------------------------------------------------------------- +MiscTests.cpp: +............................................................................... + +MiscTests.cpp:: +PASSED: + REQUIRE( v.size() == 5 ) +with expansion: + 5 == 5 + +MiscTests.cpp:: +PASSED: + REQUIRE( v.capacity() >= 10 ) +with expansion: + 10 >= 10 + +------------------------------------------------------------------------------- +vectors can be sized and resized +------------------------------------------------------------------------------- +MiscTests.cpp: +............................................................................... + +MiscTests.cpp:: +PASSED: + REQUIRE( v.size() == 5 ) +with expansion: + 5 == 5 + +MiscTests.cpp:: +PASSED: + REQUIRE( v.capacity() >= 5 ) +with expansion: + 5 >= 5 + +------------------------------------------------------------------------------- +vectors can be sized and resized + reserving smaller does not change size or capacity +------------------------------------------------------------------------------- +MiscTests.cpp: +............................................................................... + +MiscTests.cpp:: +PASSED: + REQUIRE( v.size() == 5 ) +with expansion: + 5 == 5 + +MiscTests.cpp:: +PASSED: + REQUIRE( v.capacity() >= 5 ) +with expansion: + 5 >= 5 + +------------------------------------------------------------------------------- +A couple of nested sections followed by a failure +------------------------------------------------------------------------------- +MiscTests.cpp: +............................................................................... + +MiscTests.cpp:: FAILED: +explicitly with message: + to infinity and beyond + +------------------------------------------------------------------------------- +A couple of nested sections followed by a failure +------------------------------------------------------------------------------- +MiscTests.cpp: +............................................................................... + +MiscTests.cpp:: FAILED: +explicitly with message: + to infinity and beyond + +------------------------------------------------------------------------------- +A couple of nested sections followed by a failure + Outer + Inner +------------------------------------------------------------------------------- +MiscTests.cpp: +............................................................................... + +MiscTests.cpp:: +PASSED: +with message: + that's not flying - that's failing in style + +------------------------------------------------------------------------------- +A couple of nested sections followed by a failure +------------------------------------------------------------------------------- +MiscTests.cpp: +............................................................................... + +MiscTests.cpp:: FAILED: +explicitly with message: + to infinity and beyond + +------------------------------------------------------------------------------- +Process can be configured on command line + default - no arguments +------------------------------------------------------------------------------- +TestMain.cpp: +............................................................................... + +TestMain.cpp:: +PASSED: + CHECK_NOTHROW( parseIntoConfig( argv, config ) ) + +TestMain.cpp:: +PASSED: + CHECK( config.shouldDebugBreak == false ) +with expansion: + false == false + +TestMain.cpp:: +PASSED: + CHECK( config.abortAfter == -1 ) +with expansion: + -1 == -1 + +TestMain.cpp:: +PASSED: + CHECK( config.noThrow == false ) +with expansion: + false == false + +TestMain.cpp:: +PASSED: + CHECK( config.reporterName.empty() ) +with expansion: + true + +------------------------------------------------------------------------------- +Process can be configured on command line + test lists + 1 test +------------------------------------------------------------------------------- +TestMain.cpp: +............................................................................... + +TestMain.cpp:: +PASSED: + CHECK_NOTHROW( parseIntoConfig( argv, config ) ) + +TestMain.cpp:: +PASSED: + REQUIRE( cfg.filters().size() == 1 ) +with expansion: + 1 == 1 + +TestMain.cpp:: +PASSED: + REQUIRE( cfg.filters()[0].shouldInclude( fakeTestCase( "notIncluded" ) ) == false ) +with expansion: + false == false + +TestMain.cpp:: +PASSED: + REQUIRE( cfg.filters()[0].shouldInclude( fakeTestCase( "test1" ) ) ) +with expansion: + true + +------------------------------------------------------------------------------- +Process can be configured on command line + test lists + Specify one test case exclusion using exclude: +------------------------------------------------------------------------------- +TestMain.cpp: +............................................................................... + +TestMain.cpp:: +PASSED: + CHECK_NOTHROW( parseIntoConfig( argv, config ) ) + +TestMain.cpp:: +PASSED: + REQUIRE( cfg.filters().size() == 1 ) +with expansion: + 1 == 1 + +TestMain.cpp:: +PASSED: + REQUIRE( cfg.filters()[0].shouldInclude( fakeTestCase( "test1" ) ) == false ) +with expansion: + false == false + +TestMain.cpp:: +PASSED: + REQUIRE( cfg.filters()[0].shouldInclude( fakeTestCase( "alwaysIncluded" ) ) ) +with expansion: + true + +------------------------------------------------------------------------------- +Process can be configured on command line + test lists + Specify one test case exclusion using ~ +------------------------------------------------------------------------------- +TestMain.cpp: +............................................................................... + +TestMain.cpp:: +PASSED: + CHECK_NOTHROW( parseIntoConfig( argv, config ) ) + +TestMain.cpp:: +PASSED: + REQUIRE( cfg.filters().size() == 1 ) +with expansion: + 1 == 1 + +TestMain.cpp:: +PASSED: + REQUIRE( cfg.filters()[0].shouldInclude( fakeTestCase( "test1" ) ) == false ) +with expansion: + false == false + +TestMain.cpp:: +PASSED: + REQUIRE( cfg.filters()[0].shouldInclude( fakeTestCase( "alwaysIncluded" ) ) ) +with expansion: + true + +------------------------------------------------------------------------------- +Process can be configured on command line + test lists + Specify two test cases using -t +------------------------------------------------------------------------------- +TestMain.cpp: +............................................................................... + +TestMain.cpp:: +PASSED: + CHECK_NOTHROW( parseIntoConfig( argv, config ) ) + +TestMain.cpp:: +PASSED: + REQUIRE( cfg.filters().size() == 1 ) +with expansion: + 1 == 1 + +TestMain.cpp:: +PASSED: + REQUIRE( cfg.filters()[0].shouldInclude( fakeTestCase( "notIncluded" ) ) == false ) +with expansion: + false == false + +TestMain.cpp:: +PASSED: + REQUIRE( cfg.filters()[0].shouldInclude( fakeTestCase( "test1" ) ) ) +with expansion: + true + +TestMain.cpp:: +PASSED: + REQUIRE( cfg.filters()[0].shouldInclude( fakeTestCase( "test2" ) ) ) +with expansion: + true + +------------------------------------------------------------------------------- +Process can be configured on command line + reporter + -r/console +------------------------------------------------------------------------------- +TestMain.cpp: +............................................................................... + +TestMain.cpp:: +PASSED: + CHECK_NOTHROW( parseIntoConfig( argv, config ) ) + +TestMain.cpp:: +PASSED: + REQUIRE( config.reporterName == "console" ) +with expansion: + "console" == "console" + +------------------------------------------------------------------------------- +Process can be configured on command line + reporter + -r/xml +------------------------------------------------------------------------------- +TestMain.cpp: +............................................................................... + +TestMain.cpp:: +PASSED: + CHECK_NOTHROW( parseIntoConfig( argv, config ) ) + +TestMain.cpp:: +PASSED: + REQUIRE( config.reporterName == "xml" ) +with expansion: + "xml" == "xml" + +------------------------------------------------------------------------------- +Process can be configured on command line + reporter + --reporter/junit +------------------------------------------------------------------------------- +TestMain.cpp: +............................................................................... + +TestMain.cpp:: +PASSED: + CHECK_NOTHROW( parseIntoConfig( argv, config ) ) + +TestMain.cpp:: +PASSED: + REQUIRE( config.reporterName == "junit" ) +with expansion: + "junit" == "junit" + +------------------------------------------------------------------------------- +Process can be configured on command line + debugger + -b +------------------------------------------------------------------------------- +TestMain.cpp: +............................................................................... + +TestMain.cpp:: +PASSED: + CHECK_NOTHROW( parseIntoConfig( argv, config ) ) + +TestMain.cpp:: +PASSED: + REQUIRE( config.shouldDebugBreak == true ) +with expansion: + true == true + +------------------------------------------------------------------------------- +Process can be configured on command line + debugger + --break +------------------------------------------------------------------------------- +TestMain.cpp: +............................................................................... + +TestMain.cpp:: +PASSED: + CHECK_NOTHROW( parseIntoConfig( argv, config ) ) + +TestMain.cpp:: +PASSED: + REQUIRE( config.shouldDebugBreak ) +with expansion: + true + +------------------------------------------------------------------------------- +Process can be configured on command line + abort + -a aborts after first failure +------------------------------------------------------------------------------- +TestMain.cpp: +............................................................................... + +TestMain.cpp:: +PASSED: + CHECK_NOTHROW( parseIntoConfig( argv, config ) ) + +TestMain.cpp:: +PASSED: + REQUIRE( config.abortAfter == 1 ) +with expansion: + 1 == 1 + +------------------------------------------------------------------------------- +Process can be configured on command line + abort + -x 2 aborts after two failures +------------------------------------------------------------------------------- +TestMain.cpp: +............................................................................... + +TestMain.cpp:: +PASSED: + CHECK_NOTHROW( parseIntoConfig( argv, config ) ) + +TestMain.cpp:: +PASSED: + REQUIRE( config.abortAfter == 2 ) +with expansion: + 2 == 2 + +------------------------------------------------------------------------------- +Process can be configured on command line + abort + -x must be greater than zero +------------------------------------------------------------------------------- +TestMain.cpp: +............................................................................... + +TestMain.cpp:: +PASSED: + REQUIRE_THAT( parseIntoConfigAndReturnError( argv, config ) Contains( "greater than zero" ) ) +with expansion: + "Value after -x or --abortAfter must be greater than zero + - while parsing: (-x, --abortx )" contains: "greater than + zero" + +------------------------------------------------------------------------------- +Process can be configured on command line + abort + -x must be numeric +------------------------------------------------------------------------------- +TestMain.cpp: +............................................................................... + +TestMain.cpp:: +PASSED: + REQUIRE_THAT( parseIntoConfigAndReturnError( argv, config ) Contains( "-x" ) ) +with expansion: + "Unable to convert oops to destination type + - while parsing: (-x, --abortx )" contains: "-x" + +------------------------------------------------------------------------------- +Process can be configured on command line + nothrow + -e +------------------------------------------------------------------------------- +TestMain.cpp: +............................................................................... + +TestMain.cpp:: +PASSED: + CHECK_NOTHROW( parseIntoConfig( argv, config ) ) + +TestMain.cpp:: +PASSED: + REQUIRE( config.noThrow == true ) +with expansion: + true == true + +------------------------------------------------------------------------------- +Process can be configured on command line + nothrow + --nothrow +------------------------------------------------------------------------------- +TestMain.cpp: +............................................................................... + +TestMain.cpp:: +PASSED: + CHECK_NOTHROW( parseIntoConfig( argv, config ) ) + +TestMain.cpp:: +PASSED: + REQUIRE( config.noThrow == true ) +with expansion: + true == true + +------------------------------------------------------------------------------- +Process can be configured on command line + output filename + -o filename +------------------------------------------------------------------------------- +TestMain.cpp: +............................................................................... + +TestMain.cpp:: +PASSED: + CHECK_NOTHROW( parseIntoConfig( argv, config ) ) + +TestMain.cpp:: +PASSED: + REQUIRE( config.outputFilename == "filename.ext" ) +with expansion: + "filename.ext" == "filename.ext" + +------------------------------------------------------------------------------- +Process can be configured on command line + output filename + --out +------------------------------------------------------------------------------- +TestMain.cpp: +............................................................................... + +TestMain.cpp:: +PASSED: + CHECK_NOTHROW( parseIntoConfig( argv, config ) ) + +TestMain.cpp:: +PASSED: + REQUIRE( config.outputFilename == "filename.ext" ) +with expansion: + "filename.ext" == "filename.ext" + +------------------------------------------------------------------------------- +Process can be configured on command line + combinations + Single character flags can be combined +------------------------------------------------------------------------------- +TestMain.cpp: +............................................................................... + +TestMain.cpp:: +PASSED: + CHECK_NOTHROW( parseIntoConfig( argv, config ) ) + +TestMain.cpp:: +PASSED: + CHECK( config.abortAfter == 1 ) +with expansion: + 1 == 1 + +TestMain.cpp:: +PASSED: + CHECK( config.shouldDebugBreak ) +with expansion: + true + +TestMain.cpp:: +PASSED: + CHECK( config.noThrow == true ) +with expansion: + true == true + +------------------------------------------------------------------------------- +selftest/test filter +------------------------------------------------------------------------------- +TestMain.cpp: +............................................................................... + +TestMain.cpp:: +PASSED: + CHECK( matchAny.shouldInclude( fakeTestCase( "any" ) ) ) +with expansion: + true + +TestMain.cpp:: +PASSED: + CHECK( matchNone.shouldInclude( fakeTestCase( "any" ) ) == false ) +with expansion: + false == false + +TestMain.cpp:: +PASSED: + CHECK( matchHidden.shouldInclude( fakeTestCase( "any" ) ) == false ) +with expansion: + false == false + +TestMain.cpp:: +PASSED: + CHECK( matchNonHidden.shouldInclude( fakeTestCase( "any" ) ) ) +with expansion: + true + +TestMain.cpp:: +PASSED: + CHECK( matchHidden.shouldInclude( fakeTestCase( "./any" ) ) ) +with expansion: + true + +TestMain.cpp:: +PASSED: + CHECK( matchNonHidden.shouldInclude( fakeTestCase( "./any" ) ) == false ) +with expansion: + false == false + +------------------------------------------------------------------------------- +selftest/test filters +------------------------------------------------------------------------------- +TestMain.cpp: +............................................................................... + +TestMain.cpp:: +PASSED: + CHECK( matchHidden.shouldInclude( fakeTestCase( "./something" ) ) ) +with expansion: + true + +TestMain.cpp:: +PASSED: + CHECK( filters.shouldInclude( fakeTestCase( "any" ) ) == false ) +with expansion: + false == false + +TestMain.cpp:: +PASSED: + CHECK( filters.shouldInclude( fakeTestCase( "./something" ) ) ) +with expansion: + true + +TestMain.cpp:: +PASSED: + CHECK( filters.shouldInclude( fakeTestCase( "./anything" ) ) == false ) +with expansion: + false == false + +------------------------------------------------------------------------------- +selftest/filter/prefix wildcard +------------------------------------------------------------------------------- +TestMain.cpp: +............................................................................... + +TestMain.cpp:: +PASSED: + CHECK( matchBadgers.shouldInclude( fakeTestCase( "big badger" ) ) ) +with expansion: + true + +TestMain.cpp:: +PASSED: + CHECK( matchBadgers.shouldInclude( fakeTestCase( "little badgers" ) ) == false ) +with expansion: + false == false + +------------------------------------------------------------------------------- +selftest/filter/wildcard at both ends +------------------------------------------------------------------------------- +TestMain.cpp: +............................................................................... + +TestMain.cpp:: +PASSED: + CHECK( matchBadgers.shouldInclude( fakeTestCase( "big badger" ) ) ) +with expansion: + true + +TestMain.cpp:: +PASSED: + CHECK( matchBadgers.shouldInclude( fakeTestCase( "little badgers" ) ) ) +with expansion: + true + +TestMain.cpp:: +PASSED: + CHECK( matchBadgers.shouldInclude( fakeTestCase( "badgers are big" ) ) ) +with expansion: + true + +TestMain.cpp:: +PASSED: + CHECK( matchBadgers.shouldInclude( fakeTestCase( "hedgehogs" ) ) == false ) +with expansion: + false == false + +------------------------------------------------------------------------------- +selftest/tags + single [one] tag +------------------------------------------------------------------------------- +TestMain.cpp: +............................................................................... + +TestMain.cpp:: +PASSED: + CHECK( oneTag.getTestCaseInfo().description == "" ) +with expansion: + "" == "" + +TestMain.cpp:: +PASSED: + CHECK( oneTag.hasTag( "one" ) ) +with expansion: + true + +TestMain.cpp:: +PASSED: + CHECK( oneTag.getTags().size() == 1 ) +with expansion: + 1 == 1 + +TestMain.cpp:: +PASSED: + CHECK( oneTag.matchesTags( p1 ) == true ) +with expansion: + true == true + +TestMain.cpp:: +PASSED: + CHECK( oneTag.matchesTags( p2 ) == true ) +with expansion: + true == true + +TestMain.cpp:: +PASSED: + CHECK( oneTag.matchesTags( p3 ) == false ) +with expansion: + false == false + +TestMain.cpp:: +PASSED: + CHECK( oneTag.matchesTags( p4 ) == false ) +with expansion: + false == false + +TestMain.cpp:: +PASSED: + CHECK( oneTag.matchesTags( p5 ) == false ) +with expansion: + false == false + +------------------------------------------------------------------------------- +selftest/tags + single [two] tag +------------------------------------------------------------------------------- +TestMain.cpp: +............................................................................... + +TestMain.cpp:: +PASSED: + CHECK( oneTag.getTestCaseInfo().description == "" ) +with expansion: + "" == "" + +TestMain.cpp:: +PASSED: + CHECK( oneTag.hasTag( "two" ) ) +with expansion: + true + +TestMain.cpp:: +PASSED: + CHECK( oneTag.getTags().size() == 1 ) +with expansion: + 1 == 1 + +TestMain.cpp:: +PASSED: + CHECK( oneTag.matchesTags( p1 ) == false ) +with expansion: + false == false + +TestMain.cpp:: +PASSED: + CHECK( oneTag.matchesTags( p2 ) == true ) +with expansion: + true == true + +TestMain.cpp:: +PASSED: + CHECK( oneTag.matchesTags( p3 ) == false ) +with expansion: + false == false + +TestMain.cpp:: +PASSED: + CHECK( oneTag.matchesTags( p4 ) == false ) +with expansion: + false == false + +TestMain.cpp:: +PASSED: + CHECK( oneTag.matchesTags( p5 ) == false ) +with expansion: + false == false + +------------------------------------------------------------------------------- +selftest/tags + two tags +------------------------------------------------------------------------------- +TestMain.cpp: +............................................................................... + +TestMain.cpp:: +PASSED: + CHECK( twoTags.getTestCaseInfo().description == "" ) +with expansion: + "" == "" + +TestMain.cpp:: +PASSED: + CHECK( twoTags.hasTag( "one" ) ) +with expansion: + true + +TestMain.cpp:: +PASSED: + CHECK( twoTags.hasTag( "two" ) ) +with expansion: + true + +TestMain.cpp:: +PASSED: + CHECK( twoTags.hasTag( "Two" ) ) +with expansion: + true + +TestMain.cpp:: +PASSED: + CHECK( twoTags.hasTag( "three" ) == false ) +with expansion: + false == false + +TestMain.cpp:: +PASSED: + CHECK( twoTags.getTags().size() == 2 ) +with expansion: + 2 == 2 + +TestMain.cpp:: +PASSED: + CHECK( twoTags.matchesTags( p1 ) == true ) +with expansion: + true == true + +TestMain.cpp:: +PASSED: + CHECK( twoTags.matchesTags( p2 ) == true ) +with expansion: + true == true + +TestMain.cpp:: +PASSED: + CHECK( twoTags.matchesTags( p3 ) == true ) +with expansion: + true == true + +TestMain.cpp:: +PASSED: + CHECK( twoTags.matchesTags( p4 ) == true ) +with expansion: + true == true + +TestMain.cpp:: +PASSED: + CHECK( twoTags.matchesTags( p5 ) == true ) +with expansion: + true == true + +------------------------------------------------------------------------------- +selftest/tags + complex +------------------------------------------------------------------------------- +TestMain.cpp: +............................................................................... + +TestMain.cpp:: +PASSED: + CHECK( fakeTestCase( "test", "[one][.]" ).matchesTags( p1 ) ) +with expansion: + true + +TestMain.cpp:: +PASSED: + CHECK_FALSE( fakeTestCase( "test", "[one][.]" ).matchesTags( p5 ) ) +with expansion: + !false + +TestMain.cpp:: +PASSED: + CHECK( fakeTestCase( "test", "[three]" ).matchesTags( p4 ) ) +with expansion: + true + +TestMain.cpp:: +PASSED: + CHECK( fakeTestCase( "test", "[three]" ).matchesTags( p5 ) ) +with expansion: + true + +TestMain.cpp:: +PASSED: + CHECK( fakeTestCase( "test", "[three]" ).matchesTags( "[three]~[one]" ) ) +with expansion: + true + +TestMain.cpp:: +PASSED: + CHECK( fakeTestCase( "test", "[unit][not_apple]" ).matchesTags( "[unit]" ) ) +with expansion: + true + +TestMain.cpp:: +PASSED: + CHECK_FALSE( fakeTestCase( "test", "[unit][not_apple]" ).matchesTags( "[unit]~[not_apple]" ) ) +with expansion: + !false + +------------------------------------------------------------------------------- +selftest/tags + one tag with characters either side +------------------------------------------------------------------------------- +TestMain.cpp: +............................................................................... + +TestMain.cpp:: +PASSED: + CHECK( oneTagWithExtras.getTestCaseInfo().description == "1234" ) +with expansion: + "1234" == "1234" + +TestMain.cpp:: +PASSED: + CHECK( oneTagWithExtras.hasTag( "one" ) ) +with expansion: + true + +TestMain.cpp:: +PASSED: + CHECK( oneTagWithExtras.hasTag( "two" ) == false ) +with expansion: + false == false + +TestMain.cpp:: +PASSED: + CHECK( oneTagWithExtras.getTags().size() == 1 ) +with expansion: + 1 == 1 + +------------------------------------------------------------------------------- +selftest/tags + start of a tag, but not closed +------------------------------------------------------------------------------- +TestMain.cpp: +............................................................................... + +TestMain.cpp:: +PASSED: + CHECK( oneTagOpen.getTestCaseInfo().description == "[one" ) +with expansion: + "[one" == "[one" + +TestMain.cpp:: +PASSED: + CHECK( oneTagOpen.hasTag( "one" ) == false ) +with expansion: + false == false + +TestMain.cpp:: +PASSED: + CHECK( oneTagOpen.getTags().size() == 0 ) +with expansion: + 0 == 0 + +------------------------------------------------------------------------------- +selftest/tags + hidden +------------------------------------------------------------------------------- +TestMain.cpp: +............................................................................... + +TestMain.cpp:: +PASSED: + CHECK( oneTag.getTestCaseInfo().description == "" ) +with expansion: + "" == "" + +TestMain.cpp:: +PASSED: + CHECK( oneTag.hasTag( "." ) ) +with expansion: + true + +TestMain.cpp:: +PASSED: + CHECK( oneTag.isHidden() ) +with expansion: + true + +TestMain.cpp:: +PASSED: + CHECK( oneTag.matchesTags( "~[.]" ) == false ) +with expansion: + false == false + +------------------------------------------------------------------------------- +Long strings can be wrapped + plain string + No wrapping +------------------------------------------------------------------------------- +TestMain.cpp: +............................................................................... + +TestMain.cpp:: +PASSED: + CHECK( Text( testString, TextAttributes().setWidth( 80 ) ).toString() == testString ) +with expansion: + "one two three four" + == + "one two three four" + +TestMain.cpp:: +PASSED: + CHECK( Text( testString, TextAttributes().setWidth( 18 ) ).toString() == testString ) +with expansion: + "one two three four" + == + "one two three four" + +------------------------------------------------------------------------------- +Long strings can be wrapped + plain string + Wrapped once +------------------------------------------------------------------------------- +TestMain.cpp: +............................................................................... + +TestMain.cpp:: +PASSED: + CHECK( Text( testString, TextAttributes().setWidth( 17 ) ).toString() == "one two three\nfour" ) +with expansion: + "one two three + four" + == + "one two three + four" + +TestMain.cpp:: +PASSED: + CHECK( Text( testString, TextAttributes().setWidth( 16 ) ).toString() == "one two three\nfour" ) +with expansion: + "one two three + four" + == + "one two three + four" + +TestMain.cpp:: +PASSED: + CHECK( Text( testString, TextAttributes().setWidth( 14 ) ).toString() == "one two three\nfour" ) +with expansion: + "one two three + four" + == + "one two three + four" + +TestMain.cpp:: +PASSED: + CHECK( Text( testString, TextAttributes().setWidth( 13 ) ).toString() == "one two three\nfour" ) +with expansion: + "one two three + four" + == + "one two three + four" + +TestMain.cpp:: +PASSED: + CHECK( Text( testString, TextAttributes().setWidth( 12 ) ).toString() == "one two\nthree four" ) +with expansion: + "one two + three four" + == + "one two + three four" + +------------------------------------------------------------------------------- +Long strings can be wrapped + plain string + Wrapped twice +------------------------------------------------------------------------------- +TestMain.cpp: +............................................................................... + +TestMain.cpp:: +PASSED: + CHECK( Text( testString, TextAttributes().setWidth( 9 ) ).toString() == "one two\nthree\nfour" ) +with expansion: + "one two + three + four" + == + "one two + three + four" + +TestMain.cpp:: +PASSED: + CHECK( Text( testString, TextAttributes().setWidth( 8 ) ).toString() == "one two\nthree\nfour" ) +with expansion: + "one two + three + four" + == + "one two + three + four" + +TestMain.cpp:: +PASSED: + CHECK( Text( testString, TextAttributes().setWidth( 7 ) ).toString() == "one two\nthree\nfour" ) +with expansion: + "one two + three + four" + == + "one two + three + four" + +------------------------------------------------------------------------------- +Long strings can be wrapped + plain string + Wrapped three times +------------------------------------------------------------------------------- +TestMain.cpp: +............................................................................... + +TestMain.cpp:: +PASSED: + CHECK( Text( testString, TextAttributes().setWidth( 6 ) ).toString() == "one\ntwo\nthree\nfour" ) +with expansion: + "one + two + three + four" + == + "one + two + three + four" + +TestMain.cpp:: +PASSED: + CHECK( Text( testString, TextAttributes().setWidth( 5 ) ).toString() == "one\ntwo\nthree\nfour" ) +with expansion: + "one + two + three + four" + == + "one + two + three + four" + +------------------------------------------------------------------------------- +Long strings can be wrapped + plain string + Short wrap +------------------------------------------------------------------------------- +TestMain.cpp: +............................................................................... + +TestMain.cpp:: +PASSED: + CHECK( Text( "abcdef", TextAttributes().setWidth( 4 ) ).toString() == "abc-\ndef" ) +with expansion: + "abc- + def" + == + "abc- + def" + +TestMain.cpp:: +PASSED: + CHECK( Text( "abcdefg", TextAttributes().setWidth( 4 ) ).toString() == "abc-\ndefg" ) +with expansion: + "abc- + defg" + == + "abc- + defg" + +TestMain.cpp:: +PASSED: + CHECK( Text( "abcdefgh", TextAttributes().setWidth( 4 ) ).toString() == "abc-\ndef-\ngh" ) +with expansion: + "abc- + def- + gh" + == + "abc- + def- + gh" + +TestMain.cpp:: +PASSED: + CHECK( Text( testString, TextAttributes().setWidth( 4 ) ).toString() == "one\ntwo\nthr-\nee\nfour" ) +with expansion: + "one + two + thr- + ee + four" + == + "one + two + thr- + ee + four" + +TestMain.cpp:: +PASSED: + CHECK( Text( testString, TextAttributes().setWidth( 3 ) ).toString() == "one\ntwo\nth-\nree\nfo-\nur" ) +with expansion: + "one + two + th- + ree + fo- + ur" + == + "one + two + th- + ree + fo- + ur" + +------------------------------------------------------------------------------- +Long strings can be wrapped + plain string + As container +------------------------------------------------------------------------------- +TestMain.cpp: +............................................................................... + +TestMain.cpp:: +PASSED: + REQUIRE( text.size() == 4 ) +with expansion: + 4 == 4 + +TestMain.cpp:: +PASSED: + CHECK( text[0] == "one" ) +with expansion: + "one" == "one" + +TestMain.cpp:: +PASSED: + CHECK( text[1] == "two" ) +with expansion: + "two" == "two" + +TestMain.cpp:: +PASSED: + CHECK( text[2] == "three" ) +with expansion: + "three" == "three" + +TestMain.cpp:: +PASSED: + CHECK( text[3] == "four" ) +with expansion: + "four" == "four" + +------------------------------------------------------------------------------- +Long strings can be wrapped + plain string + Indent first line differently +------------------------------------------------------------------------------- +TestMain.cpp: +............................................................................... + +TestMain.cpp:: +PASSED: + CHECK( text.toString() == " one two\n three\n four" ) +with expansion: + " one two + three + four" + == + " one two + three + four" + +------------------------------------------------------------------------------- +Long strings can be wrapped + With newlines + No wrapping +------------------------------------------------------------------------------- +TestMain.cpp: +............................................................................... + +TestMain.cpp:: +PASSED: + CHECK( Text( testString, TextAttributes().setWidth( 80 ) ).toString() == testString ) +with expansion: + "one two + three four" + == + "one two + three four" + +TestMain.cpp:: +PASSED: + CHECK( Text( testString, TextAttributes().setWidth( 18 ) ).toString() == testString ) +with expansion: + "one two + three four" + == + "one two + three four" + +TestMain.cpp:: +PASSED: + CHECK( Text( testString, TextAttributes().setWidth( 10 ) ).toString() == testString ) +with expansion: + "one two + three four" + == + "one two + three four" + +------------------------------------------------------------------------------- +Long strings can be wrapped + With newlines + Trailing newline +------------------------------------------------------------------------------- +TestMain.cpp: +............................................................................... + +TestMain.cpp:: +PASSED: + CHECK( Text( "abcdef\n", TextAttributes().setWidth( 10 ) ).toString() == "abcdef\n" ) +with expansion: + "abcdef + " + == + "abcdef + " + +TestMain.cpp:: +PASSED: + CHECK( Text( "abcdef", TextAttributes().setWidth( 6 ) ).toString() == "abcdef" ) +with expansion: + "abcdef" == "abcdef" + +TestMain.cpp:: +PASSED: + CHECK( Text( "abcdef\n", TextAttributes().setWidth( 6 ) ).toString() == "abcdef\n" ) +with expansion: + "abcdef + " + == + "abcdef + " + +------------------------------------------------------------------------------- +Long strings can be wrapped + With newlines + Wrapped once +------------------------------------------------------------------------------- +TestMain.cpp: +............................................................................... + +TestMain.cpp:: +PASSED: + CHECK( Text( testString, TextAttributes().setWidth( 9 ) ).toString() == "one two\nthree\nfour" ) +with expansion: + "one two + three + four" + == + "one two + three + four" + +TestMain.cpp:: +PASSED: + CHECK( Text( testString, TextAttributes().setWidth( 8 ) ).toString() == "one two\nthree\nfour" ) +with expansion: + "one two + three + four" + == + "one two + three + four" + +TestMain.cpp:: +PASSED: + CHECK( Text( testString, TextAttributes().setWidth( 7 ) ).toString() == "one two\nthree\nfour" ) +with expansion: + "one two + three + four" + == + "one two + three + four" + +------------------------------------------------------------------------------- +Long strings can be wrapped + With newlines + Wrapped twice +------------------------------------------------------------------------------- +TestMain.cpp: +............................................................................... + +TestMain.cpp:: +PASSED: + CHECK( Text( testString, TextAttributes().setWidth( 6 ) ).toString() == "one\ntwo\nthree\nfour" ) +with expansion: + "one + two + three + four" + == + "one + two + three + four" + +------------------------------------------------------------------------------- +Long strings can be wrapped + With tabs +------------------------------------------------------------------------------- +TestMain.cpp: +............................................................................... + +TestMain.cpp:: +PASSED: + CHECK( Text( testString, TextAttributes().setWidth( 15 ) ).toString() == "one two three\n four\n five\n six" ) +with expansion: + "one two three + four + five + six" + == + "one two three + four + five + six" + +hello +hello +------------------------------------------------------------------------------- +Strings can be rendered with colour +------------------------------------------------------------------------------- +TestMain.cpp: +............................................................................... + + +No assertions in test case 'Strings can be rendered with colour' + +------------------------------------------------------------------------------- +Text can be formatted using the Text class +------------------------------------------------------------------------------- +TestMain.cpp: +............................................................................... + +TestMain.cpp:: +PASSED: + CHECK( Text( "hi there" ).toString() == "hi there" ) +with expansion: + "hi there" == "hi there" + +TestMain.cpp:: +PASSED: + CHECK( Text( "hi there", narrow ).toString() == "hi\nthere" ) +with expansion: + "hi + there" + == + "hi + there" + +------------------------------------------------------------------------------- +Long text is truncted +------------------------------------------------------------------------------- +TestMain.cpp: +............................................................................... + +TestMain.cpp:: +PASSED: + CHECK_THAT( t.toString() EndsWith( "... message truncated due to excessive size" ) ) +with expansion: + "***************************************************************************- + ***- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ + ****************************************************************************- + **- + ****************************************************************************- + **- + ************************ +... message truncated due to excessive size + +------------------------------------------------------------------------------- +Parsing a std::pair +------------------------------------------------------------------------------- +TrickyTests.cpp: +............................................................................... + +TrickyTests.cpp:: +PASSED: + REQUIRE( (std::pair( 1, 2 )) == aNicePair ) +with expansion: + std::pair( 1, 2 ) == std::pair( 1, 2 ) + +------------------------------------------------------------------------------- +Where the is more to the expression after the RHS[failing] +------------------------------------------------------------------------------- +TrickyTests.cpp: +............................................................................... + +TrickyTests.cpp:: +warning: + Uncomment the code in this test to check that it gives a sensible compiler + error + + +No assertions in test case 'Where the is more to the expression after the RHS[failing]' + +------------------------------------------------------------------------------- +Where the LHS is not a simple value[failing] +------------------------------------------------------------------------------- +TrickyTests.cpp: +............................................................................... + +TrickyTests.cpp:: +warning: + Uncomment the code in this test to check that it gives a sensible compiler + error + + +No assertions in test case 'Where the LHS is not a simple value[failing]' + +------------------------------------------------------------------------------- +A failing expression with a non streamable type is still captured[failing] +------------------------------------------------------------------------------- +TrickyTests.cpp: +............................................................................... + +TrickyTests.cpp:: FAILED: + CHECK( &o1 == &o2 ) +with expansion: + 0x == 0x + +TrickyTests.cpp:: FAILED: + CHECK( o1 == o2 ) +with expansion: + {?} == {?} + +------------------------------------------------------------------------------- +string literals of different sizes can be compared[failing] +------------------------------------------------------------------------------- +TrickyTests.cpp: +............................................................................... + +TrickyTests.cpp:: FAILED: + REQUIRE( std::string( "first" ) == "second" ) +with expansion: + "first" == "second" + +------------------------------------------------------------------------------- +An expression with side-effects should only be evaluated once +------------------------------------------------------------------------------- +TrickyTests.cpp: +............................................................................... + +TrickyTests.cpp:: +PASSED: + REQUIRE( i++ == 7 ) +with expansion: + 7 == 7 + +TrickyTests.cpp:: +PASSED: + REQUIRE( i++ == 8 ) +with expansion: + 8 == 8 + +------------------------------------------------------------------------------- +Operators at different namespace levels not hijacked by Koenig lookup +------------------------------------------------------------------------------- +TrickyTests.cpp: +............................................................................... + +TrickyTests.cpp:: +PASSED: + REQUIRE( 0x == o ) +with expansion: + 0x == {?} + +------------------------------------------------------------------------------- +Demonstrate that a non-const == is not used +------------------------------------------------------------------------------- +TrickyTests.cpp: +............................................................................... + +TrickyTests.cpp:: +PASSED: + REQUIRE( t == 1u ) +with expansion: + {?} == 1 + +------------------------------------------------------------------------------- +Test enum bit values +------------------------------------------------------------------------------- +TrickyTests.cpp: +............................................................................... + +TrickyTests.cpp:: +PASSED: + REQUIRE( 0x == bit30and31 ) +with expansion: + 0x == 3221225472 + +------------------------------------------------------------------------------- +boolean member +------------------------------------------------------------------------------- +TrickyTests.cpp: +............................................................................... + +TrickyTests.cpp:: +PASSED: + REQUIRE( obj.prop != __null ) +with expansion: + 0x != 0 + +------------------------------------------------------------------------------- +(unimplemented) static bools can be evaluated + compare to true +------------------------------------------------------------------------------- +TrickyTests.cpp: +............................................................................... + +TrickyTests.cpp:: +PASSED: + REQUIRE( is_true::value == true ) +with expansion: + true == true + +TrickyTests.cpp:: +PASSED: + REQUIRE( true == is_true::value ) +with expansion: + true == true + +------------------------------------------------------------------------------- +(unimplemented) static bools can be evaluated + compare to false +------------------------------------------------------------------------------- +TrickyTests.cpp: +............................................................................... + +TrickyTests.cpp:: +PASSED: + REQUIRE( is_true::value == false ) +with expansion: + false == false + +TrickyTests.cpp:: +PASSED: + REQUIRE( false == is_true::value ) +with expansion: + false == false + +------------------------------------------------------------------------------- +(unimplemented) static bools can be evaluated + negation +------------------------------------------------------------------------------- +TrickyTests.cpp: +............................................................................... + +TrickyTests.cpp:: +PASSED: + REQUIRE( !is_true::value ) +with expansion: + true + +------------------------------------------------------------------------------- +(unimplemented) static bools can be evaluated + double negation +------------------------------------------------------------------------------- +TrickyTests.cpp: +............................................................................... + +TrickyTests.cpp:: +PASSED: + REQUIRE( !!is_true::value ) +with expansion: + true + +------------------------------------------------------------------------------- +(unimplemented) static bools can be evaluated + direct +------------------------------------------------------------------------------- +TrickyTests.cpp: +............................................................................... + +TrickyTests.cpp:: +PASSED: + REQUIRE( is_true::value ) +with expansion: + true + +TrickyTests.cpp:: +PASSED: + REQUIRE_FALSE( is_true::value ) +with expansion: + !false + +------------------------------------------------------------------------------- +Objects that evaluated in boolean contexts can be checked +------------------------------------------------------------------------------- +TrickyTests.cpp: +............................................................................... + +TrickyTests.cpp:: +PASSED: + CHECK( True ) +with expansion: + true + +TrickyTests.cpp:: +PASSED: + CHECK( !False ) +with expansion: + true + +TrickyTests.cpp:: +PASSED: + CHECK_FALSE( False ) +with expansion: + !false + +------------------------------------------------------------------------------- +Assertions then sections +------------------------------------------------------------------------------- +TrickyTests.cpp: +............................................................................... + +TrickyTests.cpp:: +PASSED: + REQUIRE( Catch::isTrue( true ) ) +with expansion: + true + +------------------------------------------------------------------------------- +Assertions then sections +------------------------------------------------------------------------------- +TrickyTests.cpp: +............................................................................... + +TrickyTests.cpp:: +PASSED: + REQUIRE( Catch::isTrue( true ) ) +with expansion: + true + +------------------------------------------------------------------------------- +Assertions then sections + A section +------------------------------------------------------------------------------- +TrickyTests.cpp: +............................................................................... + +TrickyTests.cpp:: +PASSED: + REQUIRE( Catch::isTrue( true ) ) +with expansion: + true + +------------------------------------------------------------------------------- +Assertions then sections +------------------------------------------------------------------------------- +TrickyTests.cpp: +............................................................................... + +TrickyTests.cpp:: +PASSED: + REQUIRE( Catch::isTrue( true ) ) +with expansion: + true + +------------------------------------------------------------------------------- +Assertions then sections + A section +------------------------------------------------------------------------------- +TrickyTests.cpp: +............................................................................... + +TrickyTests.cpp:: +PASSED: + REQUIRE( Catch::isTrue( true ) ) +with expansion: + true + +------------------------------------------------------------------------------- +Assertions then sections + A section + Another section +------------------------------------------------------------------------------- +TrickyTests.cpp: +............................................................................... + +TrickyTests.cpp:: +PASSED: + REQUIRE( Catch::isTrue( true ) ) +with expansion: + true + +------------------------------------------------------------------------------- +Assertions then sections +------------------------------------------------------------------------------- +TrickyTests.cpp: +............................................................................... + +TrickyTests.cpp:: +PASSED: + REQUIRE( Catch::isTrue( true ) ) +with expansion: + true + +------------------------------------------------------------------------------- +Assertions then sections + A section +------------------------------------------------------------------------------- +TrickyTests.cpp: +............................................................................... + +TrickyTests.cpp:: +PASSED: + REQUIRE( Catch::isTrue( true ) ) +with expansion: + true + +------------------------------------------------------------------------------- +Assertions then sections + A section + Another other section +------------------------------------------------------------------------------- +TrickyTests.cpp: +............................................................................... + +TrickyTests.cpp:: +PASSED: + REQUIRE( Catch::isTrue( true ) ) +with expansion: + true + +------------------------------------------------------------------------------- +non streamable - with conv. op +------------------------------------------------------------------------------- +TrickyTests.cpp: +............................................................................... + +TrickyTests.cpp:: +PASSED: + REQUIRE( s == "7" ) +with expansion: + "7" == "7" + +------------------------------------------------------------------------------- +Comparing function pointers +------------------------------------------------------------------------------- +TrickyTests.cpp: +............................................................................... + +TrickyTests.cpp:: +PASSED: + REQUIRE( a ) +with expansion: + true + +TrickyTests.cpp:: +PASSED: + REQUIRE( a == &foo ) +with expansion: + 0x == 0x + +------------------------------------------------------------------------------- +Comparing member function pointers +------------------------------------------------------------------------------- +TrickyTests.cpp: +............................................................................... + +TrickyTests.cpp:: +PASSED: + CHECK( m == &S::f ) +with expansion: + 0x + == + 0x + +------------------------------------------------------------------------------- +pointer to class +------------------------------------------------------------------------------- +TrickyTests.cpp: +............................................................................... + +TrickyTests.cpp:: +PASSED: + REQUIRE( p == 0 ) +with expansion: + __null == 0 + +------------------------------------------------------------------------------- +X/level/0/a +------------------------------------------------------------------------------- +TrickyTests.cpp: +............................................................................... + +TrickyTests.cpp:: +PASSED: + +------------------------------------------------------------------------------- +X/level/0/b +------------------------------------------------------------------------------- +TrickyTests.cpp: +............................................................................... + +TrickyTests.cpp:: +PASSED: + +------------------------------------------------------------------------------- +X/level/1/a +------------------------------------------------------------------------------- +TrickyTests.cpp: +............................................................................... + +TrickyTests.cpp:: +PASSED: + +------------------------------------------------------------------------------- +X/level/1/b +------------------------------------------------------------------------------- +TrickyTests.cpp: +............................................................................... + +TrickyTests.cpp:: +PASSED: + +------------------------------------------------------------------------------- +Anonymous test case 1 +------------------------------------------------------------------------------- +VariadicMacrosTests.cpp: +............................................................................... + +VariadicMacrosTests.cpp:: +PASSED: +with message: + anonymous test case + +------------------------------------------------------------------------------- +Test case with one argument +------------------------------------------------------------------------------- +VariadicMacrosTests.cpp: +............................................................................... + +VariadicMacrosTests.cpp:: +PASSED: +with message: + no assertions + +------------------------------------------------------------------------------- +Variadic macros + Section with one argument +------------------------------------------------------------------------------- +VariadicMacrosTests.cpp: +............................................................................... + +VariadicMacrosTests.cpp:: +PASSED: +with message: + no assertions + +------------------------------------------------------------------------------- +Scenario: Do that thing with the thing + Given: This stuff exists + When: I do this + Then: it should do this +------------------------------------------------------------------------------- +BDDTests.cpp: +............................................................................... + +BDDTests.cpp:: +PASSED: + REQUIRE( itDoesThis() ) +with expansion: + true + +------------------------------------------------------------------------------- +Scenario: Do that thing with the thing + Given: This stuff exists + When: I do this + Then: it should do this +------------------------------------------------------------------------------- +BDDTests.cpp: +............................................................................... + +BDDTests.cpp:: +PASSED: + REQUIRE( itDoesThis() ) +with expansion: + true + +------------------------------------------------------------------------------- +Scenario: Do that thing with the thing + Given: This stuff exists + When: I do this + Then: it should do this + And: do that +------------------------------------------------------------------------------- +BDDTests.cpp: +............................................................................... + +BDDTests.cpp:: +PASSED: + REQUIRE( itDoesThat() ) +with expansion: + true + +------------------------------------------------------------------------------- +Scenario: Vector resizing affects size and capacity + Given: an empty vector +------------------------------------------------------------------------------- +BDDTests.cpp: +............................................................................... + +BDDTests.cpp:: +PASSED: + REQUIRE( v.size() == 0 ) +with expansion: + 0 == 0 + +------------------------------------------------------------------------------- +Scenario: Vector resizing affects size and capacity + Given: an empty vector +------------------------------------------------------------------------------- +BDDTests.cpp: +............................................................................... + +BDDTests.cpp:: +PASSED: + REQUIRE( v.size() == 0 ) +with expansion: + 0 == 0 + +------------------------------------------------------------------------------- +Scenario: Vector resizing affects size and capacity + Given: an empty vector +------------------------------------------------------------------------------- +BDDTests.cpp: +............................................................................... + +BDDTests.cpp:: +PASSED: + REQUIRE( v.size() == 0 ) +with expansion: + 0 == 0 + +------------------------------------------------------------------------------- +Scenario: Vector resizing affects size and capacity + Given: an empty vector + When: it is made larger + Then: the size and capacity go up +------------------------------------------------------------------------------- +BDDTests.cpp: +............................................................................... + +BDDTests.cpp:: +PASSED: + REQUIRE( v.size() == 10 ) +with expansion: + 10 == 10 + +BDDTests.cpp:: +PASSED: + REQUIRE( v.capacity() >= 10 ) +with expansion: + 10 >= 10 + +------------------------------------------------------------------------------- +Scenario: Vector resizing affects size and capacity + Given: an empty vector +------------------------------------------------------------------------------- +BDDTests.cpp: +............................................................................... + +BDDTests.cpp:: +PASSED: + REQUIRE( v.size() == 0 ) +with expansion: + 0 == 0 + +------------------------------------------------------------------------------- +Scenario: Vector resizing affects size and capacity + Given: an empty vector + When: it is made larger + Then: the size and capacity go up +------------------------------------------------------------------------------- +BDDTests.cpp: +............................................................................... + +BDDTests.cpp:: +PASSED: + REQUIRE( v.size() == 10 ) +with expansion: + 10 == 10 + +BDDTests.cpp:: +PASSED: + REQUIRE( v.capacity() >= 10 ) +with expansion: + 10 >= 10 + +------------------------------------------------------------------------------- +Scenario: Vector resizing affects size and capacity + Given: an empty vector +------------------------------------------------------------------------------- +BDDTests.cpp: +............................................................................... + +BDDTests.cpp:: +PASSED: + REQUIRE( v.size() == 0 ) +with expansion: + 0 == 0 + +------------------------------------------------------------------------------- +Scenario: Vector resizing affects size and capacity + Given: an empty vector + When: it is made larger + Then: the size and capacity go up +------------------------------------------------------------------------------- +BDDTests.cpp: +............................................................................... + +BDDTests.cpp:: +PASSED: + REQUIRE( v.size() == 10 ) +with expansion: + 10 == 10 + +BDDTests.cpp:: +PASSED: + REQUIRE( v.capacity() >= 10 ) +with expansion: + 10 >= 10 + +------------------------------------------------------------------------------- +Scenario: Vector resizing affects size and capacity + Given: an empty vector + When: it is made larger + Then: the size and capacity go up + And when: it is made smaller again + Then: the size goes down but the capacity stays the same +------------------------------------------------------------------------------- +BDDTests.cpp: +............................................................................... + +BDDTests.cpp:: +PASSED: + REQUIRE( v.size() == 5 ) +with expansion: + 5 == 5 + +BDDTests.cpp:: +PASSED: + REQUIRE( v.capacity() >= 10 ) +with expansion: + 10 >= 10 + +------------------------------------------------------------------------------- +Scenario: Vector resizing affects size and capacity + Given: an empty vector +------------------------------------------------------------------------------- +BDDTests.cpp: +............................................................................... + +BDDTests.cpp:: +PASSED: + REQUIRE( v.size() == 0 ) +with expansion: + 0 == 0 + +------------------------------------------------------------------------------- +Scenario: Vector resizing affects size and capacity + Given: an empty vector +------------------------------------------------------------------------------- +BDDTests.cpp: +............................................................................... + +BDDTests.cpp:: +PASSED: + REQUIRE( v.size() == 0 ) +with expansion: + 0 == 0 + +------------------------------------------------------------------------------- +Scenario: Vector resizing affects size and capacity + Given: an empty vector + When: we reserve more space + Then: The capacity is increased but the size remains the same +------------------------------------------------------------------------------- +BDDTests.cpp: +............................................................................... + +BDDTests.cpp:: +PASSED: + REQUIRE( v.capacity() >= 10 ) +with expansion: + 10 >= 10 + +BDDTests.cpp:: +PASSED: + REQUIRE( v.size() == 0 ) +with expansion: + 0 == 0 + +------------------------------------------------------------------------------- +Scenario: This is a really long scenario name to see how the list command deals + with wrapping + Given: A section name that is so long that it cannot fit in a single + console width + When: The test headers are printed as part of the normal running of the + scenario + Then: The, deliberately very long and overly verbose (you see what I did + there?) section names must wrap, along with an indent +------------------------------------------------------------------------------- +BDDTests.cpp: +............................................................................... + +BDDTests.cpp:: +PASSED: +with message: + boo! + +------------------------------------------------------------------------------- +cmdline + process name +------------------------------------------------------------------------------- +CmdLineTests.cpp: +............................................................................... + +CmdLineTests.cpp:: +PASSED: + CHECK( config.processName == "test" ) +with expansion: + "test" == "test" + +------------------------------------------------------------------------------- +cmdline + arg separated by spaces +------------------------------------------------------------------------------- +CmdLineTests.cpp: +............................................................................... + +CmdLineTests.cpp:: +PASSED: + CHECK( config.fileName == "filename.ext" ) +with expansion: + "filename.ext" == "filename.ext" + +------------------------------------------------------------------------------- +cmdline + arg separated by colon +------------------------------------------------------------------------------- +CmdLineTests.cpp: +............................................................................... + +CmdLineTests.cpp:: +PASSED: + CHECK( config.fileName == "filename.ext" ) +with expansion: + "filename.ext" == "filename.ext" + +------------------------------------------------------------------------------- +cmdline + arg separated by = +------------------------------------------------------------------------------- +CmdLineTests.cpp: +............................................................................... + +CmdLineTests.cpp:: +PASSED: + CHECK( config.fileName == "filename.ext" ) +with expansion: + "filename.ext" == "filename.ext" + +------------------------------------------------------------------------------- +cmdline + long opt +------------------------------------------------------------------------------- +CmdLineTests.cpp: +............................................................................... + +CmdLineTests.cpp:: +PASSED: + CHECK( config.fileName == "%stdout" ) +with expansion: + "%stdout" == "%stdout" + +------------------------------------------------------------------------------- +cmdline + a number +------------------------------------------------------------------------------- +CmdLineTests.cpp: +............................................................................... + +CmdLineTests.cpp:: +PASSED: + CHECK( config.number == 42 ) +with expansion: + 42 == 42 + +------------------------------------------------------------------------------- +cmdline + not a number +------------------------------------------------------------------------------- +CmdLineTests.cpp: +............................................................................... + +CmdLineTests.cpp:: +PASSED: + CHECK_THROWS( parseInto( cli, argv, config ) ) + +CmdLineTests.cpp:: +PASSED: + CHECK( config.number == 0 ) +with expansion: + 0 == 0 + +------------------------------------------------------------------------------- +cmdline + two parsers +------------------------------------------------------------------------------- +CmdLineTests.cpp: +............................................................................... + +CmdLineTests.cpp:: +PASSED: + CHECK( config1.number == 42 ) +with expansion: + 42 == 42 + +CmdLineTests.cpp:: +PASSED: + REQUIRE_FALSE( unusedTokens.empty() ) +with expansion: + !false + +CmdLineTests.cpp:: +PASSED: + CHECK( config2.description == "some text" ) +with expansion: + "some text" == "some text" + +------------------------------------------------------------------------------- +cmdline + methods + in range +------------------------------------------------------------------------------- +CmdLineTests.cpp: +............................................................................... + +CmdLineTests.cpp:: +PASSED: + REQUIRE( config.index == 3 ) +with expansion: + 3 == 3 + +------------------------------------------------------------------------------- +cmdline + methods + out of range +------------------------------------------------------------------------------- +CmdLineTests.cpp: +............................................................................... + +CmdLineTests.cpp:: +PASSED: + REQUIRE_THROWS( parseInto( cli, argv, config ) ) + +------------------------------------------------------------------------------- +cmdline + flags + set +------------------------------------------------------------------------------- +CmdLineTests.cpp: +............................................................................... + +CmdLineTests.cpp:: +PASSED: + REQUIRE( config.flag ) +with expansion: + true + +------------------------------------------------------------------------------- +cmdline + flags + not set +------------------------------------------------------------------------------- +CmdLineTests.cpp: +............................................................................... + +CmdLineTests.cpp:: +PASSED: + REQUIRE( config.flag == false ) +with expansion: + false == false + +------------------------------------------------------------------------------- +cmdline + positional +------------------------------------------------------------------------------- +CmdLineTests.cpp: +............................................................................... + +CmdLineTests.cpp:: +PASSED: + REQUIRE( config.firstPos == "1st" ) +with expansion: + "1st" == "1st" + +CmdLineTests.cpp:: +PASSED: + REQUIRE( config.secondPos == "2nd" ) +with expansion: + "2nd" == "2nd" + +CmdLineTests.cpp:: +PASSED: + REQUIRE( config.unpositional == "3rd" ) +with expansion: + "3rd" == "3rd" + +------------------------------------------------------------------------------- +section tracking +------------------------------------------------------------------------------- +SectionTrackerTests.cpp: +............................................................................... + +SectionTrackerTests.cpp:: +PASSED: + CHECK_FALSE( testCaseTracker.isCompleted() ) +with expansion: + !false + +------------------------------------------------------------------------------- +section tracking +------------------------------------------------------------------------------- +SectionTrackerTests.cpp: +............................................................................... + +SectionTrackerTests.cpp:: +PASSED: + CHECK_FALSE( testCaseTracker.isCompleted() ) +with expansion: + !false + +------------------------------------------------------------------------------- +section tracking + test case with no sections +------------------------------------------------------------------------------- +SectionTrackerTests.cpp: +............................................................................... + +SectionTrackerTests.cpp:: +PASSED: + CHECK_FALSE( testCaseTracker.isCompleted() ) +with expansion: + !false + +SectionTrackerTests.cpp:: +PASSED: + CHECK( testCaseTracker.isCompleted() ) +with expansion: + true + +------------------------------------------------------------------------------- +section tracking +------------------------------------------------------------------------------- +SectionTrackerTests.cpp: +............................................................................... + +SectionTrackerTests.cpp:: +PASSED: + CHECK_FALSE( testCaseTracker.isCompleted() ) +with expansion: + !false + +------------------------------------------------------------------------------- +section tracking + test case with one section +------------------------------------------------------------------------------- +SectionTrackerTests.cpp: +............................................................................... + +SectionTrackerTests.cpp:: +PASSED: + CHECK_FALSE( testCaseTracker.enterSection( section1Name ) ) +with expansion: + !false + +SectionTrackerTests.cpp:: +PASSED: + CHECK_FALSE( testCaseTracker.isCompleted() ) +with expansion: + !false + +SectionTrackerTests.cpp:: +PASSED: + CHECK_FALSE( testCaseTracker.isCompleted() ) +with expansion: + !false + +SectionTrackerTests.cpp:: +PASSED: + CHECK( testCaseTracker.enterSection( section1Name ) ) +with expansion: + true + +SectionTrackerTests.cpp:: +PASSED: + CHECK( testCaseTracker.isCompleted() ) +with expansion: + true + +------------------------------------------------------------------------------- +section tracking +------------------------------------------------------------------------------- +SectionTrackerTests.cpp: +............................................................................... + +SectionTrackerTests.cpp:: +PASSED: + CHECK_FALSE( testCaseTracker.isCompleted() ) +with expansion: + !false + +------------------------------------------------------------------------------- +section tracking + test case with two consecutive sections +------------------------------------------------------------------------------- +SectionTrackerTests.cpp: +............................................................................... + +SectionTrackerTests.cpp:: +PASSED: + CHECK_FALSE( testCaseTracker.enterSection( section1Name ) ) +with expansion: + !false + +SectionTrackerTests.cpp:: +PASSED: + CHECK_FALSE( testCaseTracker.enterSection( section2Name ) ) +with expansion: + !false + +SectionTrackerTests.cpp:: +PASSED: + CHECK_FALSE( testCaseTracker.isCompleted() ) +with expansion: + !false + +SectionTrackerTests.cpp:: +PASSED: + CHECK( testCaseTracker.enterSection( section1Name ) ) +with expansion: + true + +SectionTrackerTests.cpp:: +PASSED: + CHECK_FALSE( testCaseTracker.enterSection( section2Name ) ) +with expansion: + !false + +SectionTrackerTests.cpp:: +PASSED: + CHECK_FALSE( testCaseTracker.isCompleted() ) +with expansion: + !false + +SectionTrackerTests.cpp:: +PASSED: + CHECK_FALSE( testCaseTracker.enterSection( section1Name ) ) +with expansion: + !false + +SectionTrackerTests.cpp:: +PASSED: + CHECK( testCaseTracker.enterSection( section2Name ) ) +with expansion: + true + +SectionTrackerTests.cpp:: +PASSED: + CHECK( testCaseTracker.isCompleted() ) +with expansion: + true + +------------------------------------------------------------------------------- +section tracking +------------------------------------------------------------------------------- +SectionTrackerTests.cpp: +............................................................................... + +SectionTrackerTests.cpp:: +PASSED: + CHECK_FALSE( testCaseTracker.isCompleted() ) +with expansion: + !false + +------------------------------------------------------------------------------- +section tracking + test case with one section within another +------------------------------------------------------------------------------- +SectionTrackerTests.cpp: +............................................................................... + +SectionTrackerTests.cpp:: +PASSED: + CHECK_FALSE( testCaseTracker.enterSection( section1Name ) ) +with expansion: + !false + +SectionTrackerTests.cpp:: +PASSED: + CHECK_FALSE( testCaseTracker.isCompleted() ) +with expansion: + !false + +SectionTrackerTests.cpp:: +PASSED: + CHECK( testCaseTracker.enterSection( section1Name ) ) +with expansion: + true + +SectionTrackerTests.cpp:: +PASSED: + CHECK_FALSE( testCaseTracker.enterSection( section2Name ) ) +with expansion: + !false + +SectionTrackerTests.cpp:: +PASSED: + CHECK_FALSE( testCaseTracker.isCompleted() ) +with expansion: + !false + +SectionTrackerTests.cpp:: +PASSED: + CHECK( testCaseTracker.enterSection( section1Name ) ) +with expansion: + true + +SectionTrackerTests.cpp:: +PASSED: + CHECK( testCaseTracker.enterSection( section2Name ) ) +with expansion: + true + +SectionTrackerTests.cpp:: +PASSED: + CHECK( testCaseTracker.isCompleted() ) +with expansion: + true + +=============================================================================== +123 test cases - 51 failed (695 assertions - 110 failed) + diff --git a/single_include_projects/SelfTest/Baselines/console.swa4.approved.txt b/single_include_projects/SelfTest/Baselines/console.swa4.approved.txt new file mode 100644 index 00000000..e701d91a --- /dev/null +++ b/single_include_projects/SelfTest/Baselines/console.swa4.approved.txt @@ -0,0 +1,322 @@ + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +CatchSelfTest is a host application. +Run with -? for options + +------------------------------------------------------------------------------- +Some simple comparisons between doubles +------------------------------------------------------------------------------- +ApproxTests.cpp: +............................................................................... + +ApproxTests.cpp:: +PASSED: + REQUIRE( d == Approx( 1.23 ) ) +with expansion: + 1.23 == Approx( 1.23 ) + +ApproxTests.cpp:: +PASSED: + REQUIRE( d != Approx( 1.22 ) ) +with expansion: + 1.23 != Approx( 1.22 ) + +ApproxTests.cpp:: +PASSED: + REQUIRE( d != Approx( 1.24 ) ) +with expansion: + 1.23 != Approx( 1.24 ) + +ApproxTests.cpp:: +PASSED: + REQUIRE( Approx( d ) == 1.23 ) +with expansion: + Approx( 1.23 ) == 1.23 + +ApproxTests.cpp:: +PASSED: + REQUIRE( Approx( d ) != 1.22 ) +with expansion: + Approx( 1.23 ) != 1.22 + +ApproxTests.cpp:: +PASSED: + REQUIRE( Approx( d ) != 1.24 ) +with expansion: + Approx( 1.23 ) != 1.24 + +------------------------------------------------------------------------------- +Approximate comparisons with different epsilons +------------------------------------------------------------------------------- +ApproxTests.cpp: +............................................................................... + +ApproxTests.cpp:: +PASSED: + REQUIRE( d != Approx( 1.231 ) ) +with expansion: + 1.23 != Approx( 1.231 ) + +ApproxTests.cpp:: +PASSED: + REQUIRE( d == Approx( 1.231 ).epsilon( 0.1 ) ) +with expansion: + 1.23 == Approx( 1.231 ) + +------------------------------------------------------------------------------- +Approximate comparisons with floats +------------------------------------------------------------------------------- +ApproxTests.cpp: +............................................................................... + +ApproxTests.cpp:: +PASSED: + REQUIRE( 1.23f == Approx( 1.23f ) ) +with expansion: + 1.23 == Approx( 1.2300000191 ) + +ApproxTests.cpp:: +PASSED: + REQUIRE( 0.0f == Approx( 0.0f ) ) +with expansion: + 0 == Approx( 0.0 ) + +------------------------------------------------------------------------------- +Approximate comparisons with ints +------------------------------------------------------------------------------- +ApproxTests.cpp: +............................................................................... + +ApproxTests.cpp:: +PASSED: + REQUIRE( 1 == Approx( 1 ) ) +with expansion: + 1 == Approx( 1.0 ) + +ApproxTests.cpp:: +PASSED: + REQUIRE( 0 == Approx( 0 ) ) +with expansion: + 0 == Approx( 0.0 ) + +------------------------------------------------------------------------------- +Approximate comparisons with mixed numeric types +------------------------------------------------------------------------------- +ApproxTests.cpp: +............................................................................... + +ApproxTests.cpp:: +PASSED: + REQUIRE( 1.0f == Approx( 1 ) ) +with expansion: + 1 == Approx( 1.0 ) + +ApproxTests.cpp:: +PASSED: + REQUIRE( 0 == Approx( dZero) ) +with expansion: + 0 == Approx( 0.0 ) + +ApproxTests.cpp:: +PASSED: + REQUIRE( 0 == Approx( dSmall ).epsilon( 0.001 ) ) +with expansion: + 0 == Approx( 0.00001 ) + +ApproxTests.cpp:: +PASSED: + REQUIRE( 1.234f == Approx( dMedium ) ) +with expansion: + 1.234 == Approx( 1.234 ) + +ApproxTests.cpp:: +PASSED: + REQUIRE( dMedium == Approx( 1.234f ) ) +with expansion: + 1.234 == Approx( 1.2339999676 ) + +------------------------------------------------------------------------------- +Use a custom approx +------------------------------------------------------------------------------- +ApproxTests.cpp: +............................................................................... + +ApproxTests.cpp:: +PASSED: + REQUIRE( d == approx( 1.23 ) ) +with expansion: + 1.23 == Approx( 1.23 ) + +ApproxTests.cpp:: +PASSED: + REQUIRE( d == approx( 1.22 ) ) +with expansion: + 1.23 == Approx( 1.22 ) + +ApproxTests.cpp:: +PASSED: + REQUIRE( d == approx( 1.24 ) ) +with expansion: + 1.23 == Approx( 1.24 ) + +ApproxTests.cpp:: +PASSED: + REQUIRE( d != approx( 1.25 ) ) +with expansion: + 1.23 != Approx( 1.25 ) + +ApproxTests.cpp:: +PASSED: + REQUIRE( approx( d ) == 1.23 ) +with expansion: + Approx( 1.23 ) == 1.23 + +ApproxTests.cpp:: +PASSED: + REQUIRE( approx( d ) == 1.22 ) +with expansion: + Approx( 1.23 ) == 1.22 + +ApproxTests.cpp:: +PASSED: + REQUIRE( approx( d ) == 1.24 ) +with expansion: + Approx( 1.23 ) == 1.24 + +ApproxTests.cpp:: +PASSED: + REQUIRE( approx( d ) != 1.25 ) +with expansion: + Approx( 1.23 ) != 1.25 + +------------------------------------------------------------------------------- +Approximate PI +------------------------------------------------------------------------------- +ApproxTests.cpp: +............................................................................... + +ApproxTests.cpp:: +PASSED: + REQUIRE( divide( 22, 7 ) == Approx( 3.141 ).epsilon( 0.001 ) ) +with expansion: + 3.1428571429 == Approx( 3.141 ) + +ApproxTests.cpp:: +PASSED: + REQUIRE( divide( 22, 7 ) != Approx( 3.141 ).epsilon( 0.0001 ) ) +with expansion: + 3.1428571429 != Approx( 3.141 ) + +------------------------------------------------------------------------------- +A METHOD_AS_TEST_CASE based test run that succeeds +------------------------------------------------------------------------------- +ClassTests.cpp: +............................................................................... + +ClassTests.cpp:: +PASSED: + REQUIRE( s == "hello" ) +with expansion: + "hello" == "hello" + +------------------------------------------------------------------------------- +A METHOD_AS_TEST_CASE based test run that fails +------------------------------------------------------------------------------- +ClassTests.cpp: +............................................................................... + +ClassTests.cpp:: FAILED: + REQUIRE( s == "world" ) +with expansion: + "hello" == "world" + +------------------------------------------------------------------------------- +A TEST_CASE_METHOD based test run that succeeds +------------------------------------------------------------------------------- +ClassTests.cpp: +............................................................................... + +ClassTests.cpp:: +PASSED: + REQUIRE( m_a == 1 ) +with expansion: + 1 == 1 + +------------------------------------------------------------------------------- +A TEST_CASE_METHOD based test run that fails +------------------------------------------------------------------------------- +ClassTests.cpp: +............................................................................... + +ClassTests.cpp:: FAILED: + REQUIRE( m_a == 2 ) +with expansion: + 1 == 2 + +------------------------------------------------------------------------------- +Equality checks that should succeed +------------------------------------------------------------------------------- +ConditionTests.cpp: +............................................................................... + +ConditionTests.cpp:: +PASSED: + REQUIRE( data.int_seven == 7 ) +with expansion: + 7 == 7 + +ConditionTests.cpp:: +PASSED: + REQUIRE( data.float_nine_point_one == Approx( 9.1f ) ) +with expansion: + 9.1 == Approx( 9.1000003815 ) + +ConditionTests.cpp:: +PASSED: + REQUIRE( data.double_pi == Approx( 3.1415926535 ) ) +with expansion: + 3.1415926535 == Approx( 3.1415926535 ) + +ConditionTests.cpp:: +PASSED: + REQUIRE( data.str_hello == "hello" ) +with expansion: + "hello" == "hello" + +ConditionTests.cpp:: +PASSED: + REQUIRE( "hello" == data.str_hello ) +with expansion: + "hello" == "hello" + +ConditionTests.cpp:: +PASSED: + REQUIRE( data.str_hello.size() == 5 ) +with expansion: + 5 == 5 + +ConditionTests.cpp:: +PASSED: + REQUIRE( x == Approx( 1.3 ) ) +with expansion: + 1.3 == Approx( 1.3 ) + +------------------------------------------------------------------------------- +Equality checks that should fail] +------------------------------------------------------------------------------- +ConditionTests.cpp: +............................................................................... + +ConditionTests.cpp:: FAILED: + CHECK( data.int_seven == 6 ) +with expansion: + 7 == 6 + +ConditionTests.cpp:: FAILED: + CHECK( data.int_seven == 8 ) +with expansion: + 7 == 8 + +=============================================================================== +13 test cases - 3 failed (40 assertions - 4 failed) + diff --git a/single_include_projects/SelfTest/Baselines/junit.sw.approved.txt b/single_include_projects/SelfTest/Baselines/junit.sw.approved.txt new file mode 100644 index 00000000..58a1d151 --- /dev/null +++ b/single_include_projects/SelfTest/Baselines/junit.sw.approved.txt @@ -0,0 +1,562 @@ + + + + + + + + + + + + +ClassTests.cpp: + + + + + +ClassTests.cpp: + + + + + +ConditionTests.cpp: + + +ConditionTests.cpp: + + +ConditionTests.cpp: + + +ConditionTests.cpp: + + +ConditionTests.cpp: + + +ConditionTests.cpp: + + +ConditionTests.cpp: + + +ConditionTests.cpp: + + +ConditionTests.cpp: + + +ConditionTests.cpp: + + +ConditionTests.cpp: + + +ConditionTests.cpp: + + +ConditionTests.cpp: + + + + + +ConditionTests.cpp: + + +ConditionTests.cpp: + + +ConditionTests.cpp: + + +ConditionTests.cpp: + + +ConditionTests.cpp: + + + + + +ConditionTests.cpp: + + +ConditionTests.cpp: + + +ConditionTests.cpp: + + +ConditionTests.cpp: + + +ConditionTests.cpp: + + +ConditionTests.cpp: + + +ConditionTests.cpp: + + +ConditionTests.cpp: + + +ConditionTests.cpp: + + +ConditionTests.cpp: + + +ConditionTests.cpp: + + +ConditionTests.cpp: + + +ConditionTests.cpp: + + +ConditionTests.cpp: + + +ConditionTests.cpp: + + +ConditionTests.cpp: + + +ConditionTests.cpp: + + +ConditionTests.cpp: + + +ConditionTests.cpp: + + + + + + + + + + + +ConditionTests.cpp: + + +ConditionTests.cpp: + + +ConditionTests.cpp: + + +ConditionTests.cpp: + + +ConditionTests.cpp: + + +ConditionTests.cpp: + + +ConditionTests.cpp: + + +ConditionTests.cpp: + + + + + +expected exception +ExceptionTests.cpp: + + +ExceptionTests.cpp: + + +expected exception +ExceptionTests.cpp: + + + + +unexpected exception +ExceptionTests.cpp: + + + + +unexpected exception +ExceptionTests.cpp: + + + + +unexpected exception +ExceptionTests.cpp: + + + + +expected exception +ExceptionTests.cpp: + + + + +custom exception +ExceptionTests.cpp: + + + + +custom exception - not std +ExceptionTests.cpp: + + + + +custom exception - not std +ExceptionTests.cpp: + + + + +3.14 +ExceptionTests.cpp: + + + + + + + + + +this message should be logged +so should this +MessageTests.cpp: + + + + +this message should be logged +MessageTests.cpp: + + +and this, but later +MessageTests.cpp: + + + + +This is a failure +MessageTests.cpp: + + + + +MessageTests.cpp: + + + + + +Message from section one +MessageTests.cpp: + + + + +Message from section two +MessageTests.cpp: + + + + +Message from section one +Message from section two + + + + +current counter 10 +i := 10 +MessageTests.cpp: + + + + + +Previous info should not be seen +MessageTests.cpp: + + + + +hi +i := 7 +MessageTests.cpp: + + + + + + + + +MiscTests.cpp: + + + + + + +MiscTests.cpp: + + + + +Testing if fib[0] (1) is even +MiscTests.cpp: + + +Testing if fib[1] (1) is even +MiscTests.cpp: + + +Testing if fib[3] (3) is even +MiscTests.cpp: + + +Testing if fib[4] (5) is even +MiscTests.cpp: + + +Testing if fib[6] (13) is even +MiscTests.cpp: + + +Testing if fib[7] (21) is even +MiscTests.cpp: + + + + +A string sent directly to stdout + + +A string sent directly to stderr + + + + + + +MiscTests.cpp: + + +MiscTests.cpp: + + + + + +MiscTests.cpp: + + +MiscTests.cpp: + + + + +3 +MiscTests.cpp: + + + + + + +MiscTests.cpp: + + + + +MiscTests.cpp: + + + + +MiscTests.cpp: + + + + +MiscTests.cpp: + + + + + + + + + + + + + + + + +to infinity and beyond +MiscTests.cpp: + + +to infinity and beyond +MiscTests.cpp: + + +to infinity and beyond +MiscTests.cpp: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +hello +hello + + + + + + + + + +TrickyTests.cpp: + + +TrickyTests.cpp: + + + + +TrickyTests.cpp: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Message from section one +Message from section two +A string sent directly to stdout +hello +hello + + +A string sent directly to stderr + + + diff --git a/single_include_projects/SelfTest/Baselines/xml.sw.approved.txt b/single_include_projects/SelfTest/Baselines/xml.sw.approved.txt new file mode 100644 index 00000000..efbb16d3 --- /dev/null +++ b/single_include_projects/SelfTest/Baselines/xml.sw.approved.txt @@ -0,0 +1,7424 @@ + + + + + + d == Approx( 1.23 ) + + + 1.23 == Approx( 1.23 ) + + + + + d != Approx( 1.22 ) + + + 1.23 != Approx( 1.22 ) + + + + + d != Approx( 1.24 ) + + + 1.23 != Approx( 1.24 ) + + + + + Approx( d ) == 1.23 + + + Approx( 1.23 ) == 1.23 + + + + + Approx( d ) != 1.22 + + + Approx( 1.23 ) != 1.22 + + + + + Approx( d ) != 1.24 + + + Approx( 1.23 ) != 1.24 + + + + + + + + d != Approx( 1.231 ) + + + 1.23 != Approx( 1.231 ) + + + + + d == Approx( 1.231 ).epsilon( 0.1 ) + + + 1.23 == Approx( 1.231 ) + + + + + + + + 1.23f == Approx( 1.23f ) + + + 1.23 == Approx( 1.2300000191 ) + + + + + 0.0f == Approx( 0.0f ) + + + 0 == Approx( 0.0 ) + + + + + + + + 1 == Approx( 1 ) + + + 1 == Approx( 1.0 ) + + + + + 0 == Approx( 0 ) + + + 0 == Approx( 0.0 ) + + + + + + + + 1.0f == Approx( 1 ) + + + 1 == Approx( 1.0 ) + + + + + 0 == Approx( dZero) + + + 0 == Approx( 0.0 ) + + + + + 0 == Approx( dSmall ).epsilon( 0.001 ) + + + 0 == Approx( 0.00001 ) + + + + + 1.234f == Approx( dMedium ) + + + 1.234 == Approx( 1.234 ) + + + + + dMedium == Approx( 1.234f ) + + + 1.234 == Approx( 1.2339999676 ) + + + + + + + + d == approx( 1.23 ) + + + 1.23 == Approx( 1.23 ) + + + + + d == approx( 1.22 ) + + + 1.23 == Approx( 1.22 ) + + + + + d == approx( 1.24 ) + + + 1.23 == Approx( 1.24 ) + + + + + d != approx( 1.25 ) + + + 1.23 != Approx( 1.25 ) + + + + + approx( d ) == 1.23 + + + Approx( 1.23 ) == 1.23 + + + + + approx( d ) == 1.22 + + + Approx( 1.23 ) == 1.22 + + + + + approx( d ) == 1.24 + + + Approx( 1.23 ) == 1.24 + + + + + approx( d ) != 1.25 + + + Approx( 1.23 ) != 1.25 + + + + + + + + divide( 22, 7 ) == Approx( 3.141 ).epsilon( 0.001 ) + + + 3.1428571429 == Approx( 3.141 ) + + + + + divide( 22, 7 ) != Approx( 3.141 ).epsilon( 0.0001 ) + + + 3.1428571429 != Approx( 3.141 ) + + + + + + + + s == "hello" + + + "hello" == "hello" + + + + + + + + s == "world" + + + "hello" == "world" + + + + + + + + m_a == 1 + + + 1 == 1 + + + + + + + + m_a == 2 + + + 1 == 2 + + + + + + + + data.int_seven == 7 + + + 7 == 7 + + + + + data.float_nine_point_one == Approx( 9.1f ) + + + 9.1 == Approx( 9.1000003815 ) + + + + + data.double_pi == Approx( 3.1415926535 ) + + + 3.1415926535 == Approx( 3.1415926535 ) + + + + + data.str_hello == "hello" + + + "hello" == "hello" + + + + + "hello" == data.str_hello + + + "hello" == "hello" + + + + + data.str_hello.size() == 5 + + + 5 == 5 + + + + + x == Approx( 1.3 ) + + + 1.3 == Approx( 1.3 ) + + + + + + + + data.int_seven == 6 + + + 7 == 6 + + + + + data.int_seven == 8 + + + 7 == 8 + + + + + data.int_seven == 0 + + + 7 == 0 + + + + + data.float_nine_point_one == Approx( 9.11f ) + + + 9.1 == Approx( 9.1099996567 ) + + + + + data.float_nine_point_one == Approx( 9.0f ) + + + 9.1 == Approx( 9.0 ) + + + + + data.float_nine_point_one == Approx( 1 ) + + + 9.1 == Approx( 1.0 ) + + + + + data.float_nine_point_one == Approx( 0 ) + + + 9.1 == Approx( 0.0 ) + + + + + data.double_pi == Approx( 3.1415 ) + + + 3.1415926535 == Approx( 3.1415 ) + + + + + data.str_hello == "goodbye" + + + "hello" == "goodbye" + + + + + data.str_hello == "hell" + + + "hello" == "hell" + + + + + data.str_hello == "hello1" + + + "hello" == "hello1" + + + + + data.str_hello.size() == 6 + + + 5 == 6 + + + + + x == Approx( 1.301 ) + + + 1.3 == Approx( 1.301 ) + + + + + + + + data.int_seven != 6 + + + 7 != 6 + + + + + data.int_seven != 8 + + + 7 != 8 + + + + + data.float_nine_point_one != Approx( 9.11f ) + + + 9.1 != Approx( 9.1099996567 ) + + + + + data.float_nine_point_one != Approx( 9.0f ) + + + 9.1 != Approx( 9.0 ) + + + + + data.float_nine_point_one != Approx( 1 ) + + + 9.1 != Approx( 1.0 ) + + + + + data.float_nine_point_one != Approx( 0 ) + + + 9.1 != Approx( 0.0 ) + + + + + data.double_pi != Approx( 3.1415 ) + + + 3.1415926535 != Approx( 3.1415 ) + + + + + data.str_hello != "goodbye" + + + "hello" != "goodbye" + + + + + data.str_hello != "hell" + + + "hello" != "hell" + + + + + data.str_hello != "hello1" + + + "hello" != "hello1" + + + + + data.str_hello.size() != 6 + + + 5 != 6 + + + + + + + + data.int_seven != 7 + + + 7 != 7 + + + + + data.float_nine_point_one != Approx( 9.1f ) + + + 9.1 != Approx( 9.1000003815 ) + + + + + data.double_pi != Approx( 3.1415926535 ) + + + 3.1415926535 != Approx( 3.1415926535 ) + + + + + data.str_hello != "hello" + + + "hello" != "hello" + + + + + data.str_hello.size() != 5 + + + 5 != 5 + + + + + + + + data.int_seven < 8 + + + 7 < 8 + + + + + data.int_seven > 6 + + + 7 > 6 + + + + + data.int_seven > 0 + + + 7 > 0 + + + + + data.int_seven > -1 + + + 7 > -1 + + + + + data.int_seven >= 7 + + + 7 >= 7 + + + + + data.int_seven >= 6 + + + 7 >= 6 + + + + + data.int_seven <= 7 + + + 7 <= 7 + + + + + data.int_seven <= 8 + + + 7 <= 8 + + + + + data.float_nine_point_one > 9 + + + 9.1 > 9 + + + + + data.float_nine_point_one < 10 + + + 9.1 < 10 + + + + + data.float_nine_point_one < 9.2 + + + 9.1 < 9.2 + + + + + data.str_hello <= "hello" + + + "hello" <= "hello" + + + + + data.str_hello >= "hello" + + + "hello" >= "hello" + + + + + data.str_hello < "hellp" + + + "hello" < "hellp" + + + + + data.str_hello < "zebra" + + + "hello" < "zebra" + + + + + data.str_hello > "hellm" + + + "hello" > "hellm" + + + + + data.str_hello > "a" + + + "hello" > "a" + + + + + + + + data.int_seven > 7 + + + 7 > 7 + + + + + data.int_seven < 7 + + + 7 < 7 + + + + + data.int_seven > 8 + + + 7 > 8 + + + + + data.int_seven < 6 + + + 7 < 6 + + + + + data.int_seven < 0 + + + 7 < 0 + + + + + data.int_seven < -1 + + + 7 < -1 + + + + + data.int_seven >= 8 + + + 7 >= 8 + + + + + data.int_seven <= 6 + + + 7 <= 6 + + + + + data.float_nine_point_one < 9 + + + 9.1 < 9 + + + + + data.float_nine_point_one > 10 + + + 9.1 > 10 + + + + + data.float_nine_point_one > 9.2 + + + 9.1 > 9.2 + + + + + data.str_hello > "hello" + + + "hello" > "hello" + + + + + data.str_hello < "hello" + + + "hello" < "hello" + + + + + data.str_hello > "hellp" + + + "hello" > "hellp" + + + + + data.str_hello > "z" + + + "hello" > "z" + + + + + data.str_hello < "hellm" + + + "hello" < "hellm" + + + + + data.str_hello < "a" + + + "hello" < "a" + + + + + data.str_hello >= "z" + + + "hello" >= "z" + + + + + data.str_hello <= "a" + + + "hello" <= "a" + + + + + + + + i == 1 + + + 1 == 1 + + + + + ui == 2 + + + 2 == 2 + + + + + l == 3 + + + 3 == 3 + + + + + ul == 4 + + + 4 == 4 + + + + + c == 5 + + + 5 == 5 + + + + + uc == 6 + + + 6 == 6 + + + + + 1 == i + + + 1 == 1 + + + + + 2 == ui + + + 2 == 2 + + + + + 3 == l + + + 3 == 3 + + + + + 4 == ul + + + 4 == 4 + + + + + 5 == c + + + 5 == 5 + + + + + 6 == uc + + + 6 == 6 + + + + + (std::numeric_limits<unsigned long>::max)() > ul + + + 0x > 4 + + + + + + + + long_var == unsigned_char_var + + + 1 == 1 + + + + + long_var == unsigned_short_var + + + 1 == 1 + + + + + long_var == unsigned_int_var + + + 1 == 1 + + + + + long_var == unsigned_long_var + + + 1 == 1 + + + + + + + + unsigned_char_var == 1 + + + 1 == 1 + + + + + unsigned_short_var == 1 + + + 1 == 1 + + + + + unsigned_int_var == 1 + + + 1 == 1 + + + + + unsigned_long_var == 1 + + + 1 == 1 + + + + + + + + ( -1 > 2u ) + + + true + + + + + -1 > 2u + + + -1 > 2 + + + + + ( 2u < -1 ) + + + true + + + + + 2u < -1 + + + 2 < -1 + + + + + ( minInt > 2u ) + + + true + + + + + minInt > 2u + + + -2147483648 > 2 + + + + + + + + 54 == 6*9 + + + 54 == 54 + + + + + + + + p == __null + + + __null == 0 + + + + + p == pNULL + + + __null == __null + + + + + p != __null + + + 0x != 0 + + + + + cp != __null + + + 0x != 0 + + + + + cpc != __null + + + 0x != 0 + + + + + returnsNull() == __null + + + {null string} == 0 + + + + + returnsConstNull() == __null + + + {null string} == 0 + + + + + __null != p + + + 0 != 0x + + + + + + + + false == false + + + false == false + + + + + true == true + + + true == true + + + + + !false + + + true + + + + + !false + + + !false + + + + + !falseValue + + + true + + + + + !falseValue + + + !false + + + + + !(1 == 2) + + + true + + + + + !1 == 2 + + + !(1 == 2) + + + + + + + + false != false + + + false != false + + + + + true != true + + + true != true + + + + + !true + + + false + + + + + !true + + + !true + + + + + !trueValue + + + false + + + + + !trueValue + + + !true + + + + + !(1 == 1) + + + false + + + + + !1 == 1 + + + !(1 == 1) + + + + + + + + thisThrows() + + + thisThrows() + + + + + thisDoesntThrow() + + + thisDoesntThrow() + + + + + thisThrows() + + + thisThrows() + + + + + + + + thisThrows() + + + thisThrows() + + + expected exception + + + + + thisDoesntThrow() + + + thisDoesntThrow() + + + + + thisThrows() + + + thisThrows() + + + expected exception + + + + + + + unexpected exception + + + + + + + 1 == 1 + + + 1 == 1 + + + + + {Unknown expression after the reported line} + + + {Unknown expression after the reported line} + + + unexpected exception + + + + + +
+ + unexpected exception + + +
+ +
+ + + + thisThrows() == 0 + + + thisThrows() == 0 + + + expected exception + + + + + + + + + + custom exception + + + + + + + throwCustom() + + + throwCustom() + + + custom exception - not std + + + + + + + + throwCustom() + + + throwCustom() + + + custom exception - not std + + + + + + + 3.14 + + + + + + + thisFunctionNotImplemented( 7 ) + + + thisFunctionNotImplemented( 7 ) + + + + + + + + multiply( i, 2 ) == i*2 + + + 2 == 2 + + + + + multiply( j, 2 ) == j*2 + + + 200 == 200 + + + + + multiply( i, 2 ) == i*2 + + + 4 == 4 + + + + + multiply( j, 2 ) == j*2 + + + 200 == 200 + + + + + multiply( i, 2 ) == i*2 + + + 6 == 6 + + + + + multiply( j, 2 ) == j*2 + + + 200 == 200 + + + + + multiply( i, 2 ) == i*2 + + + 8 == 8 + + + + + multiply( j, 2 ) == j*2 + + + 200 == 200 + + + + + multiply( i, 2 ) == i*2 + + + 10 == 10 + + + + + multiply( j, 2 ) == j*2 + + + 200 == 200 + + + + + multiply( i, 2 ) == i*2 + + + 30 == 30 + + + + + multiply( j, 2 ) == j*2 + + + 200 == 200 + + + + + multiply( i, 2 ) == i*2 + + + 40 == 40 + + + + + multiply( j, 2 ) == j*2 + + + 200 == 200 + + + + + multiply( i, 2 ) == i*2 + + + 42 == 42 + + + + + multiply( j, 2 ) == j*2 + + + 200 == 200 + + + + + multiply( i, 2 ) == i*2 + + + 72 == 72 + + + + + multiply( j, 2 ) == j*2 + + + 200 == 200 + + + + + multiply( i, 2 ) == i*2 + + + 2 == 2 + + + + + multiply( j, 2 ) == j*2 + + + 202 == 202 + + + + + multiply( i, 2 ) == i*2 + + + 4 == 4 + + + + + multiply( j, 2 ) == j*2 + + + 202 == 202 + + + + + multiply( i, 2 ) == i*2 + + + 6 == 6 + + + + + multiply( j, 2 ) == j*2 + + + 202 == 202 + + + + + multiply( i, 2 ) == i*2 + + + 8 == 8 + + + + + multiply( j, 2 ) == j*2 + + + 202 == 202 + + + + + multiply( i, 2 ) == i*2 + + + 10 == 10 + + + + + multiply( j, 2 ) == j*2 + + + 202 == 202 + + + + + multiply( i, 2 ) == i*2 + + + 30 == 30 + + + + + multiply( j, 2 ) == j*2 + + + 202 == 202 + + + + + multiply( i, 2 ) == i*2 + + + 40 == 40 + + + + + multiply( j, 2 ) == j*2 + + + 202 == 202 + + + + + multiply( i, 2 ) == i*2 + + + 42 == 42 + + + + + multiply( j, 2 ) == j*2 + + + 202 == 202 + + + + + multiply( i, 2 ) == i*2 + + + 72 == 72 + + + + + multiply( j, 2 ) == j*2 + + + 202 == 202 + + + + + multiply( i, 2 ) == i*2 + + + 2 == 2 + + + + + multiply( j, 2 ) == j*2 + + + 204 == 204 + + + + + multiply( i, 2 ) == i*2 + + + 4 == 4 + + + + + multiply( j, 2 ) == j*2 + + + 204 == 204 + + + + + multiply( i, 2 ) == i*2 + + + 6 == 6 + + + + + multiply( j, 2 ) == j*2 + + + 204 == 204 + + + + + multiply( i, 2 ) == i*2 + + + 8 == 8 + + + + + multiply( j, 2 ) == j*2 + + + 204 == 204 + + + + + multiply( i, 2 ) == i*2 + + + 10 == 10 + + + + + multiply( j, 2 ) == j*2 + + + 204 == 204 + + + + + multiply( i, 2 ) == i*2 + + + 30 == 30 + + + + + multiply( j, 2 ) == j*2 + + + 204 == 204 + + + + + multiply( i, 2 ) == i*2 + + + 40 == 40 + + + + + multiply( j, 2 ) == j*2 + + + 204 == 204 + + + + + multiply( i, 2 ) == i*2 + + + 42 == 42 + + + + + multiply( j, 2 ) == j*2 + + + 204 == 204 + + + + + multiply( i, 2 ) == i*2 + + + 72 == 72 + + + + + multiply( j, 2 ) == j*2 + + + 204 == 204 + + + + + multiply( i, 2 ) == i*2 + + + 2 == 2 + + + + + multiply( j, 2 ) == j*2 + + + 206 == 206 + + + + + multiply( i, 2 ) == i*2 + + + 4 == 4 + + + + + multiply( j, 2 ) == j*2 + + + 206 == 206 + + + + + multiply( i, 2 ) == i*2 + + + 6 == 6 + + + + + multiply( j, 2 ) == j*2 + + + 206 == 206 + + + + + multiply( i, 2 ) == i*2 + + + 8 == 8 + + + + + multiply( j, 2 ) == j*2 + + + 206 == 206 + + + + + multiply( i, 2 ) == i*2 + + + 10 == 10 + + + + + multiply( j, 2 ) == j*2 + + + 206 == 206 + + + + + multiply( i, 2 ) == i*2 + + + 30 == 30 + + + + + multiply( j, 2 ) == j*2 + + + 206 == 206 + + + + + multiply( i, 2 ) == i*2 + + + 40 == 40 + + + + + multiply( j, 2 ) == j*2 + + + 206 == 206 + + + + + multiply( i, 2 ) == i*2 + + + 42 == 42 + + + + + multiply( j, 2 ) == j*2 + + + 206 == 206 + + + + + multiply( i, 2 ) == i*2 + + + 72 == 72 + + + + + multiply( j, 2 ) == j*2 + + + 206 == 206 + + + + + multiply( i, 2 ) == i*2 + + + 2 == 2 + + + + + multiply( j, 2 ) == j*2 + + + 208 == 208 + + + + + multiply( i, 2 ) == i*2 + + + 4 == 4 + + + + + multiply( j, 2 ) == j*2 + + + 208 == 208 + + + + + multiply( i, 2 ) == i*2 + + + 6 == 6 + + + + + multiply( j, 2 ) == j*2 + + + 208 == 208 + + + + + multiply( i, 2 ) == i*2 + + + 8 == 8 + + + + + multiply( j, 2 ) == j*2 + + + 208 == 208 + + + + + multiply( i, 2 ) == i*2 + + + 10 == 10 + + + + + multiply( j, 2 ) == j*2 + + + 208 == 208 + + + + + multiply( i, 2 ) == i*2 + + + 30 == 30 + + + + + multiply( j, 2 ) == j*2 + + + 208 == 208 + + + + + multiply( i, 2 ) == i*2 + + + 40 == 40 + + + + + multiply( j, 2 ) == j*2 + + + 208 == 208 + + + + + multiply( i, 2 ) == i*2 + + + 42 == 42 + + + + + multiply( j, 2 ) == j*2 + + + 208 == 208 + + + + + multiply( i, 2 ) == i*2 + + + 72 == 72 + + + + + multiply( j, 2 ) == j*2 + + + 208 == 208 + + + + + multiply( i, 2 ) == i*2 + + + 2 == 2 + + + + + multiply( j, 2 ) == j*2 + + + 210 == 210 + + + + + multiply( i, 2 ) == i*2 + + + 4 == 4 + + + + + multiply( j, 2 ) == j*2 + + + 210 == 210 + + + + + multiply( i, 2 ) == i*2 + + + 6 == 6 + + + + + multiply( j, 2 ) == j*2 + + + 210 == 210 + + + + + multiply( i, 2 ) == i*2 + + + 8 == 8 + + + + + multiply( j, 2 ) == j*2 + + + 210 == 210 + + + + + multiply( i, 2 ) == i*2 + + + 10 == 10 + + + + + multiply( j, 2 ) == j*2 + + + 210 == 210 + + + + + multiply( i, 2 ) == i*2 + + + 30 == 30 + + + + + multiply( j, 2 ) == j*2 + + + 210 == 210 + + + + + multiply( i, 2 ) == i*2 + + + 40 == 40 + + + + + multiply( j, 2 ) == j*2 + + + 210 == 210 + + + + + multiply( i, 2 ) == i*2 + + + 42 == 42 + + + + + multiply( j, 2 ) == j*2 + + + 210 == 210 + + + + + multiply( i, 2 ) == i*2 + + + 72 == 72 + + + + + multiply( j, 2 ) == j*2 + + + 210 == 210 + + + + + multiply( i, 2 ) == i*2 + + + 2 == 2 + + + + + multiply( j, 2 ) == j*2 + + + 212 == 212 + + + + + multiply( i, 2 ) == i*2 + + + 4 == 4 + + + + + multiply( j, 2 ) == j*2 + + + 212 == 212 + + + + + multiply( i, 2 ) == i*2 + + + 6 == 6 + + + + + multiply( j, 2 ) == j*2 + + + 212 == 212 + + + + + multiply( i, 2 ) == i*2 + + + 8 == 8 + + + + + multiply( j, 2 ) == j*2 + + + 212 == 212 + + + + + multiply( i, 2 ) == i*2 + + + 10 == 10 + + + + + multiply( j, 2 ) == j*2 + + + 212 == 212 + + + + + multiply( i, 2 ) == i*2 + + + 30 == 30 + + + + + multiply( j, 2 ) == j*2 + + + 212 == 212 + + + + + multiply( i, 2 ) == i*2 + + + 40 == 40 + + + + + multiply( j, 2 ) == j*2 + + + 212 == 212 + + + + + multiply( i, 2 ) == i*2 + + + 42 == 42 + + + + + multiply( j, 2 ) == j*2 + + + 212 == 212 + + + + + multiply( i, 2 ) == i*2 + + + 72 == 72 + + + + + multiply( j, 2 ) == j*2 + + + 212 == 212 + + + + + multiply( i, 2 ) == i*2 + + + 2 == 2 + + + + + multiply( j, 2 ) == j*2 + + + 214 == 214 + + + + + multiply( i, 2 ) == i*2 + + + 4 == 4 + + + + + multiply( j, 2 ) == j*2 + + + 214 == 214 + + + + + multiply( i, 2 ) == i*2 + + + 6 == 6 + + + + + multiply( j, 2 ) == j*2 + + + 214 == 214 + + + + + multiply( i, 2 ) == i*2 + + + 8 == 8 + + + + + multiply( j, 2 ) == j*2 + + + 214 == 214 + + + + + multiply( i, 2 ) == i*2 + + + 10 == 10 + + + + + multiply( j, 2 ) == j*2 + + + 214 == 214 + + + + + multiply( i, 2 ) == i*2 + + + 30 == 30 + + + + + multiply( j, 2 ) == j*2 + + + 214 == 214 + + + + + multiply( i, 2 ) == i*2 + + + 40 == 40 + + + + + multiply( j, 2 ) == j*2 + + + 214 == 214 + + + + + multiply( i, 2 ) == i*2 + + + 42 == 42 + + + + + multiply( j, 2 ) == j*2 + + + 214 == 214 + + + + + multiply( i, 2 ) == i*2 + + + 72 == 72 + + + + + multiply( j, 2 ) == j*2 + + + 214 == 214 + + + + + + + + i->first == i->second-1 + + + 0 == 0 + + + + + i->first == i->second-1 + + + 2 == 2 + + + + + + + this is a message + + + this is a warning + + + + + + + + + this message should be logged + + + so should this + + + + a == 1 + + + 2 == 1 + + + + + + + + a == 2 + + + 2 == 2 + + + + this message should be logged + + + + a == 1 + + + 2 == 1 + + + + and this, but later + + + + a == 0 + + + 2 == 0 + + + + + a == 2 + + + 2 == 2 + + + + + + + This is a failure + + + + + + + + + + + +
+ + Message from section one + + +
+
+ + Message from section two + + +
+ +
+ +
+ +
+
+ +
+ +
+ + + + i < 10 + + + 0 < 10 + + + + + i < 10 + + + 1 < 10 + + + + + i < 10 + + + 2 < 10 + + + + + i < 10 + + + 3 < 10 + + + + + i < 10 + + + 4 < 10 + + + + + i < 10 + + + 5 < 10 + + + + + i < 10 + + + 6 < 10 + + + + + i < 10 + + + 7 < 10 + + + + + i < 10 + + + 8 < 10 + + + + + i < 10 + + + 9 < 10 + + + + current counter 10 + + + i := 10 + + + + i < 10 + + + 10 < 10 + + + + + + + + 1 == 2 + + + 1 == 2 + + + + + + + + + + Previous info should not be seen + + + + + + hi + + + i := 7 + + + + false + + + false + + + + + +
+ + + a != b + + + 1 != 2 + + + + + b != a + + + 2 != 1 + + + +
+
+ + + a != b + + + 1 != 2 + + + +
+ +
+ +
+ + + a != b + + + 1 != 2 + + + + + b != a + + + 2 != 1 + + + +
+
+ + + a != b + + + 1 != 2 + + + + + b != a + + + 2 != 1 + + +
+ + + a != b + + + 1 != 2 + + + +
+ +
+ +
+ +
+ +
+
+
+ + + a == b + + + 1 == 2 + + + +
+ +
+
+
+ + + a != b + + + 1 != 2 + + + +
+ +
+
+
+ + + a < b + + + 1 < 2 + + + +
+ +
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ +
+ +
+ +
+ + + b > a + + + 0 > 1 + + + +
+ +
+ + + Testing if fib[0] (1) is even + + + + ( fib[i] % 2 ) == 0 + + + 1 == 0 + + + + Testing if fib[1] (1) is even + + + + ( fib[i] % 2 ) == 0 + + + 1 == 0 + + + + + ( fib[i] % 2 ) == 0 + + + 0 == 0 + + + + Testing if fib[3] (3) is even + + + + ( fib[i] % 2 ) == 0 + + + 1 == 0 + + + + Testing if fib[4] (5) is even + + + + ( fib[i] % 2 ) == 0 + + + 1 == 0 + + + + + ( fib[i] % 2 ) == 0 + + + 0 == 0 + + + + Testing if fib[6] (13) is even + + + + ( fib[i] % 2 ) == 0 + + + 1 == 0 + + + + Testing if fib[7] (21) is even + + + + ( fib[i] % 2 ) == 0 + + + 1 == 0 + + + + + + + + + + + makeString( false ) != static_cast<char*>(__null) + + + "valid string" != {null string} + + + + + makeString( true ) == static_cast<char*>(__null) + + + {null string} == {null string} + + + + + + + + flag + + + true + + + + + testCheckedIf( true ) + + + true + + + + + + + + flag + + + false + + + + + testCheckedIf( false ) + + + false + + + + + + + + flag + + + true + + + + + testCheckedElse( true ) + + + true + + + + + + + + flag + + + false + + + + + testCheckedElse( false ) + + + false + + + + + +
+ +
+
+ +
+ +
+ + + 3 + + + + false + + + false + + + + + + + + x == 0 + + + 0 == 0 + + + + + + + + testStringForMatching() Contains( "string" ) + + + "this string contains 'abc' as a substring" contains: "string" + + + + + testStringForMatching() Contains( "abc" ) + + + "this string contains 'abc' as a substring" contains: "abc" + + + + + testStringForMatching() StartsWith( "this" ) + + + "this string contains 'abc' as a substring" starts with: "this" + + + + + testStringForMatching() EndsWith( "substring" ) + + + "this string contains 'abc' as a substring" ends with: "substring" + + + + + + + + testStringForMatching() Contains( "not there" ) + + + "this string contains 'abc' as a substring" contains: "not there" + + + + + + + + testStringForMatching() StartsWith( "string" ) + + + "this string contains 'abc' as a substring" starts with: "string" + + + + + + + + testStringForMatching() EndsWith( "this" ) + + + "this string contains 'abc' as a substring" ends with: "this" + + + + + + + + testStringForMatching() Equals( "something else" ) + + + "this string contains 'abc' as a substring" equals: "something else" + + + + + + + + "" Equals(__null) + + + "" equals: "" + + + + + + + + testStringForMatching() AllOf( Catch::Contains( "string" ), Catch::Contains( "abc" ) ) + + + "this string contains 'abc' as a substring" ( contains: "string" and contains: "abc" ) + + + + + + + + testStringForMatching() AnyOf( Catch::Contains( "string" ), Catch::Contains( "not there" ) ) + + + "this string contains 'abc' as a substring" ( contains: "string" or contains: "not there" ) + + + + + testStringForMatching() AnyOf( Catch::Contains( "not there" ), Catch::Contains( "string" ) ) + + + "this string contains 'abc' as a substring" ( contains: "not there" or contains: "string" ) + + + + + + + + testStringForMatching() Equals( "this string contains 'abc' as a substring" ) + + + "this string contains 'abc' as a substring" equals: "this string contains 'abc' as a substring" + + + + + + + + Factorial(0) == 1 + + + 1 == 1 + + + + + Factorial(1) == 1 + + + 1 == 1 + + + + + Factorial(2) == 2 + + + 2 == 2 + + + + + Factorial(3) == 6 + + + 6 == 6 + + + + + Factorial(10) == 3628800 + + + 0x == 3628800 + + + + + + + + + + This one ran + + + + + + + + + + + + + v.size() == 5 + + + 5 == 5 + + + + + v.capacity() >= 5 + + + 5 >= 5 + + + + + v.size() == 5 + + + 5 == 5 + + + + + v.capacity() >= 5 + + + 5 >= 5 + + +
+ + + v.size() == 10 + + + 10 == 10 + + + + + v.capacity() >= 10 + + + 10 >= 10 + + + +
+ + + v.size() == 5 + + + 5 == 5 + + + + + v.capacity() >= 5 + + + 5 >= 5 + + +
+ + + v.size() == 0 + + + 0 == 0 + + + + + v.capacity() >= 5 + + + 5 >= 5 + + + +
+ + + v.size() == 5 + + + 5 == 5 + + + + + v.capacity() >= 5 + + + 5 >= 5 + + +
+ + + v.size() == 0 + + + 0 == 0 + + + + + v.capacity() >= 5 + + + 5 >= 5 + + +
+ + + v.capacity() == 0 + + + 0 == 0 + + + +
+ +
+ + + v.size() == 5 + + + 5 == 5 + + + + + v.capacity() >= 5 + + + 5 >= 5 + + +
+ + + v.size() == 5 + + + 5 == 5 + + + + + v.capacity() >= 10 + + + 10 >= 10 + + + +
+ + + v.size() == 5 + + + 5 == 5 + + + + + v.capacity() >= 5 + + + 5 >= 5 + + +
+ + + v.size() == 5 + + + 5 == 5 + + + + + v.capacity() >= 5 + + + 5 >= 5 + + + +
+ +
+ + + to infinity and beyond + +
+ +
+ + to infinity and beyond + +
+
+ +
+ +
+ + to infinity and beyond + + +
+ +
+ + + parseIntoConfig( argv, config ) + + + parseIntoConfig( argv, config ) + + + + + config.shouldDebugBreak == false + + + false == false + + + + + config.abortAfter == -1 + + + -1 == -1 + + + + + config.noThrow == false + + + false == false + + + + + config.reporterName.empty() + + + true + + + +
+
+ +
+
+
+ + + parseIntoConfig( argv, config ) + + + parseIntoConfig( argv, config ) + + + + + cfg.filters().size() == 1 + + + 1 == 1 + + + + + cfg.filters()[0].shouldInclude( fakeTestCase( "notIncluded" ) ) == false + + + false == false + + + + + cfg.filters()[0].shouldInclude( fakeTestCase( "test1" ) ) + + + true + + + +
+ +
+
+
+ + + parseIntoConfig( argv, config ) + + + parseIntoConfig( argv, config ) + + + + + cfg.filters().size() == 1 + + + 1 == 1 + + + + + cfg.filters()[0].shouldInclude( fakeTestCase( "test1" ) ) == false + + + false == false + + + + + cfg.filters()[0].shouldInclude( fakeTestCase( "alwaysIncluded" ) ) + + + true + + + +
+ +
+
+
+ + + parseIntoConfig( argv, config ) + + + parseIntoConfig( argv, config ) + + + + + cfg.filters().size() == 1 + + + 1 == 1 + + + + + cfg.filters()[0].shouldInclude( fakeTestCase( "test1" ) ) == false + + + false == false + + + + + cfg.filters()[0].shouldInclude( fakeTestCase( "alwaysIncluded" ) ) + + + true + + + +
+ +
+
+
+ + + parseIntoConfig( argv, config ) + + + parseIntoConfig( argv, config ) + + + + + cfg.filters().size() == 1 + + + 1 == 1 + + + + + cfg.filters()[0].shouldInclude( fakeTestCase( "notIncluded" ) ) == false + + + false == false + + + + + cfg.filters()[0].shouldInclude( fakeTestCase( "test1" ) ) + + + true + + + + + cfg.filters()[0].shouldInclude( fakeTestCase( "test2" ) ) + + + true + + + +
+ +
+
+ +
+
+
+ + + parseIntoConfig( argv, config ) + + + parseIntoConfig( argv, config ) + + + + + config.reporterName == "console" + + + "console" == "console" + + + +
+ +
+
+
+ + + parseIntoConfig( argv, config ) + + + parseIntoConfig( argv, config ) + + + + + config.reporterName == "xml" + + + "xml" == "xml" + + + +
+ +
+
+
+ + + parseIntoConfig( argv, config ) + + + parseIntoConfig( argv, config ) + + + + + config.reporterName == "junit" + + + "junit" == "junit" + + + +
+ +
+
+ +
+
+
+ + + parseIntoConfig( argv, config ) + + + parseIntoConfig( argv, config ) + + + + + config.shouldDebugBreak == true + + + true == true + + + +
+ +
+
+
+ + + parseIntoConfig( argv, config ) + + + parseIntoConfig( argv, config ) + + + + + config.shouldDebugBreak + + + true + + + +
+ +
+
+ +
+
+
+ + + parseIntoConfig( argv, config ) + + + parseIntoConfig( argv, config ) + + + + + config.abortAfter == 1 + + + 1 == 1 + + + +
+ +
+
+
+ + + parseIntoConfig( argv, config ) + + + parseIntoConfig( argv, config ) + + + + + config.abortAfter == 2 + + + 2 == 2 + + + +
+ +
+
+
+ + + parseIntoConfigAndReturnError( argv, config ) Contains( "greater than zero" ) + + + "Value after -x or --abortAfter must be greater than zero +- while parsing: (-x, --abortx <number of failures>)" contains: "greater than zero" + + + +
+ +
+
+
+ + + parseIntoConfigAndReturnError( argv, config ) Contains( "-x" ) + + + "Unable to convert oops to destination type +- while parsing: (-x, --abortx <number of failures>)" contains: "-x" + + + +
+ +
+
+ +
+
+
+ + + parseIntoConfig( argv, config ) + + + parseIntoConfig( argv, config ) + + + + + config.noThrow == true + + + true == true + + + +
+ +
+
+
+ + + parseIntoConfig( argv, config ) + + + parseIntoConfig( argv, config ) + + + + + config.noThrow == true + + + true == true + + + +
+ +
+
+ +
+
+
+ + + parseIntoConfig( argv, config ) + + + parseIntoConfig( argv, config ) + + + + + config.outputFilename == "filename.ext" + + + "filename.ext" == "filename.ext" + + + +
+ +
+
+
+ + + parseIntoConfig( argv, config ) + + + parseIntoConfig( argv, config ) + + + + + config.outputFilename == "filename.ext" + + + "filename.ext" == "filename.ext" + + + +
+ +
+
+ +
+
+
+ + + parseIntoConfig( argv, config ) + + + parseIntoConfig( argv, config ) + + + + + config.abortAfter == 1 + + + 1 == 1 + + + + + config.shouldDebugBreak + + + true + + + + + config.noThrow == true + + + true == true + + + +
+ +
+ +
+ + + + matchAny.shouldInclude( fakeTestCase( "any" ) ) + + + true + + + + + matchNone.shouldInclude( fakeTestCase( "any" ) ) == false + + + false == false + + + + + matchHidden.shouldInclude( fakeTestCase( "any" ) ) == false + + + false == false + + + + + matchNonHidden.shouldInclude( fakeTestCase( "any" ) ) + + + true + + + + + matchHidden.shouldInclude( fakeTestCase( "./any" ) ) + + + true + + + + + matchNonHidden.shouldInclude( fakeTestCase( "./any" ) ) == false + + + false == false + + + + + + + + matchHidden.shouldInclude( fakeTestCase( "./something" ) ) + + + true + + + + + filters.shouldInclude( fakeTestCase( "any" ) ) == false + + + false == false + + + + + filters.shouldInclude( fakeTestCase( "./something" ) ) + + + true + + + + + filters.shouldInclude( fakeTestCase( "./anything" ) ) == false + + + false == false + + + + + + + + matchBadgers.shouldInclude( fakeTestCase( "big badger" ) ) + + + true + + + + + matchBadgers.shouldInclude( fakeTestCase( "little badgers" ) ) == false + + + false == false + + + + + + + + matchBadgers.shouldInclude( fakeTestCase( "big badger" ) ) + + + true + + + + + matchBadgers.shouldInclude( fakeTestCase( "little badgers" ) ) + + + true + + + + + matchBadgers.shouldInclude( fakeTestCase( "badgers are big" ) ) + + + true + + + + + matchBadgers.shouldInclude( fakeTestCase( "hedgehogs" ) ) == false + + + false == false + + + + + +
+ + + oneTag.getTestCaseInfo().description == "" + + + "" == "" + + + + + oneTag.hasTag( "one" ) + + + true + + + + + oneTag.getTags().size() == 1 + + + 1 == 1 + + + + + oneTag.matchesTags( p1 ) == true + + + true == true + + + + + oneTag.matchesTags( p2 ) == true + + + true == true + + + + + oneTag.matchesTags( p3 ) == false + + + false == false + + + + + oneTag.matchesTags( p4 ) == false + + + false == false + + + + + oneTag.matchesTags( p5 ) == false + + + false == false + + + +
+
+ + + oneTag.getTestCaseInfo().description == "" + + + "" == "" + + + + + oneTag.hasTag( "two" ) + + + true + + + + + oneTag.getTags().size() == 1 + + + 1 == 1 + + + + + oneTag.matchesTags( p1 ) == false + + + false == false + + + + + oneTag.matchesTags( p2 ) == true + + + true == true + + + + + oneTag.matchesTags( p3 ) == false + + + false == false + + + + + oneTag.matchesTags( p4 ) == false + + + false == false + + + + + oneTag.matchesTags( p5 ) == false + + + false == false + + + +
+
+ + + twoTags.getTestCaseInfo().description == "" + + + "" == "" + + + + + twoTags.hasTag( "one" ) + + + true + + + + + twoTags.hasTag( "two" ) + + + true + + + + + twoTags.hasTag( "Two" ) + + + true + + + + + twoTags.hasTag( "three" ) == false + + + false == false + + + + + twoTags.getTags().size() == 2 + + + 2 == 2 + + + + + twoTags.matchesTags( p1 ) == true + + + true == true + + + + + twoTags.matchesTags( p2 ) == true + + + true == true + + + + + twoTags.matchesTags( p3 ) == true + + + true == true + + + + + twoTags.matchesTags( p4 ) == true + + + true == true + + + + + twoTags.matchesTags( p5 ) == true + + + true == true + + + +
+
+ + + fakeTestCase( "test", "[one][.]" ).matchesTags( p1 ) + + + true + + + + + !fakeTestCase( "test", "[one][.]" ).matchesTags( p5 ) + + + !false + + + + + fakeTestCase( "test", "[three]" ).matchesTags( p4 ) + + + true + + + + + fakeTestCase( "test", "[three]" ).matchesTags( p5 ) + + + true + + + + + fakeTestCase( "test", "[three]" ).matchesTags( "[three]~[one]" ) + + + true + + + + + fakeTestCase( "test", "[unit][not_apple]" ).matchesTags( "[unit]" ) + + + true + + + + + !fakeTestCase( "test", "[unit][not_apple]" ).matchesTags( "[unit]~[not_apple]" ) + + + !false + + + +
+
+ + + oneTagWithExtras.getTestCaseInfo().description == "1234" + + + "1234" == "1234" + + + + + oneTagWithExtras.hasTag( "one" ) + + + true + + + + + oneTagWithExtras.hasTag( "two" ) == false + + + false == false + + + + + oneTagWithExtras.getTags().size() == 1 + + + 1 == 1 + + + +
+
+ + + oneTagOpen.getTestCaseInfo().description == "[one" + + + "[one" == "[one" + + + + + oneTagOpen.hasTag( "one" ) == false + + + false == false + + + + + oneTagOpen.getTags().size() == 0 + + + 0 == 0 + + + +
+
+ + + oneTag.getTestCaseInfo().description == "" + + + "" == "" + + + + + oneTag.hasTag( "." ) + + + true + + + + + oneTag.isHidden() + + + true + + + + + oneTag.matchesTags( "~[.]" ) == false + + + false == false + + + +
+ +
+ +
+ +
+
+
+ + + Text( testString, TextAttributes().setWidth( 80 ) ).toString() == testString + + + "one two three four" +== +"one two three four" + + + + + Text( testString, TextAttributes().setWidth( 18 ) ).toString() == testString + + + "one two three four" +== +"one two three four" + + + +
+ +
+
+
+ + + Text( testString, TextAttributes().setWidth( 17 ) ).toString() == "one two three\nfour" + + + "one two three +four" +== +"one two three +four" + + + + + Text( testString, TextAttributes().setWidth( 16 ) ).toString() == "one two three\nfour" + + + "one two three +four" +== +"one two three +four" + + + + + Text( testString, TextAttributes().setWidth( 14 ) ).toString() == "one two three\nfour" + + + "one two three +four" +== +"one two three +four" + + + + + Text( testString, TextAttributes().setWidth( 13 ) ).toString() == "one two three\nfour" + + + "one two three +four" +== +"one two three +four" + + + + + Text( testString, TextAttributes().setWidth( 12 ) ).toString() == "one two\nthree four" + + + "one two +three four" +== +"one two +three four" + + + +
+ +
+
+
+ + + Text( testString, TextAttributes().setWidth( 9 ) ).toString() == "one two\nthree\nfour" + + + "one two +three +four" +== +"one two +three +four" + + + + + Text( testString, TextAttributes().setWidth( 8 ) ).toString() == "one two\nthree\nfour" + + + "one two +three +four" +== +"one two +three +four" + + + + + Text( testString, TextAttributes().setWidth( 7 ) ).toString() == "one two\nthree\nfour" + + + "one two +three +four" +== +"one two +three +four" + + + +
+ +
+
+
+ + + Text( testString, TextAttributes().setWidth( 6 ) ).toString() == "one\ntwo\nthree\nfour" + + + "one +two +three +four" +== +"one +two +three +four" + + + + + Text( testString, TextAttributes().setWidth( 5 ) ).toString() == "one\ntwo\nthree\nfour" + + + "one +two +three +four" +== +"one +two +three +four" + + + +
+ +
+
+
+ + + Text( "abcdef", TextAttributes().setWidth( 4 ) ).toString() == "abc-\ndef" + + + "abc- +def" +== +"abc- +def" + + + + + Text( "abcdefg", TextAttributes().setWidth( 4 ) ).toString() == "abc-\ndefg" + + + "abc- +defg" +== +"abc- +defg" + + + + + Text( "abcdefgh", TextAttributes().setWidth( 4 ) ).toString() == "abc-\ndef-\ngh" + + + "abc- +def- +gh" +== +"abc- +def- +gh" + + + + + Text( testString, TextAttributes().setWidth( 4 ) ).toString() == "one\ntwo\nthr-\nee\nfour" + + + "one +two +thr- +ee +four" +== +"one +two +thr- +ee +four" + + + + + Text( testString, TextAttributes().setWidth( 3 ) ).toString() == "one\ntwo\nth-\nree\nfo-\nur" + + + "one +two +th- +ree +fo- +ur" +== +"one +two +th- +ree +fo- +ur" + + + +
+ +
+
+
+ + + text.size() == 4 + + + 4 == 4 + + + + + text[0] == "one" + + + "one" == "one" + + + + + text[1] == "two" + + + "two" == "two" + + + + + text[2] == "three" + + + "three" == "three" + + + + + text[3] == "four" + + + "four" == "four" + + + +
+ +
+
+
+ + + text.toString() == " one two\n three\n four" + + + " one two + three + four" +== +" one two + three + four" + + + +
+ +
+
+ +
+
+
+ + + Text( testString, TextAttributes().setWidth( 80 ) ).toString() == testString + + + "one two +three four" +== +"one two +three four" + + + + + Text( testString, TextAttributes().setWidth( 18 ) ).toString() == testString + + + "one two +three four" +== +"one two +three four" + + + + + Text( testString, TextAttributes().setWidth( 10 ) ).toString() == testString + + + "one two +three four" +== +"one two +three four" + + + +
+ +
+
+
+ + + Text( "abcdef\n", TextAttributes().setWidth( 10 ) ).toString() == "abcdef\n" + + + "abcdef +" +== +"abcdef +" + + + + + Text( "abcdef", TextAttributes().setWidth( 6 ) ).toString() == "abcdef" + + + "abcdef" == "abcdef" + + + + + Text( "abcdef\n", TextAttributes().setWidth( 6 ) ).toString() == "abcdef\n" + + + "abcdef +" +== +"abcdef +" + + + +
+ +
+
+
+ + + Text( testString, TextAttributes().setWidth( 9 ) ).toString() == "one two\nthree\nfour" + + + "one two +three +four" +== +"one two +three +four" + + + + + Text( testString, TextAttributes().setWidth( 8 ) ).toString() == "one two\nthree\nfour" + + + "one two +three +four" +== +"one two +three +four" + + + + + Text( testString, TextAttributes().setWidth( 7 ) ).toString() == "one two\nthree\nfour" + + + "one two +three +four" +== +"one two +three +four" + + + +
+ +
+
+
+ + + Text( testString, TextAttributes().setWidth( 6 ) ).toString() == "one\ntwo\nthree\nfour" + + + "one +two +three +four" +== +"one +two +three +four" + + + +
+ +
+
+ + + Text( testString, TextAttributes().setWidth( 15 ) ).toString() == "one two three\n four\n five\n six" + + + "one two three + four + five + six" +== +"one two three + four + five + six" + + + +
+ +
+ + + + + + + Text( "hi there" ).toString() == "hi there" + + + "hi there" == "hi there" + + + + + Text( "hi there", narrow ).toString() == "hi\nthere" + + + "hi +there" +== +"hi +there" + + + + + + + + t.toString() EndsWith( "... message truncated due to excessive size" ) + + + "******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +******************************************************************************- +************************ +******************************************************************************- +... message truncated due to excessive size" ends with: "... message truncated due to excessive size" + + + + + + + + (std::pair<int, int>( 1, 2 )) == aNicePair + + + std::pair( 1, 2 ) == std::pair( 1, 2 ) + + + + + + + Uncomment the code in this test to check that it gives a sensible compiler error + + + + + + Uncomment the code in this test to check that it gives a sensible compiler error + + + + + + + &o1 == &o2 + + + 0x == 0x + + + + + o1 == o2 + + + {?} == {?} + + + + + + + + std::string( "first" ) == "second" + + + "first" == "second" + + + + + + + + i++ == 7 + + + 7 == 7 + + + + + i++ == 8 + + + 8 == 8 + + + + + + + + 0x == o + + + 0x == {?} + + + + + + + + t == 1u + + + {?} == 1 + + + + + + + + 0x == bit30and31 + + + 0x == 3221225472 + + + + + + + + obj.prop != __null + + + 0x != 0 + + + + + +
+ + + is_true<true>::value == true + + + true == true + + + + + true == is_true<true>::value + + + true == true + + + +
+
+ + + is_true<false>::value == false + + + false == false + + + + + false == is_true<false>::value + + + false == false + + + +
+
+ + + !is_true<false>::value + + + true + + + +
+
+ + + !!is_true<true>::value + + + true + + + +
+
+ + + is_true<true>::value + + + true + + + + + !is_true<false>::value + + + !false + + + +
+ +
+ + + + True + + + true + + + + + !False + + + true + + + + + !False + + + !false + + + + + + + + Catch::isTrue( true ) + + + true + + + + + Catch::isTrue( true ) + + + true + + +
+ + + Catch::isTrue( true ) + + + true + + + +
+ + + Catch::isTrue( true ) + + + true + + +
+ + + Catch::isTrue( true ) + + + true + + +
+ + + Catch::isTrue( true ) + + + true + + + +
+ +
+ + + Catch::isTrue( true ) + + + true + + +
+ + + Catch::isTrue( true ) + + + true + + +
+ + + Catch::isTrue( true ) + + + true + + + +
+ +
+ +
+ + + + s == "7" + + + "7" == "7" + + + + + + + + a + + + true + + + + + a == &foo + + + 0x == 0x + + + + + + + + m == &S::f + + + 0x +== +0x + + + + + + + + p == 0 + + + __null == 0 + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+
+ + + itDoesThis() + + + true + + + +
+ +
+ +
+
+
+
+ + + itDoesThis() + + + true + + +
+ + + itDoesThat() + + + true + + + +
+ +
+ +
+ +
+ +
+ +
+ + + v.size() == 0 + + + 0 == 0 + + + +
+
+ + + v.size() == 0 + + + 0 == 0 + + +
+ +
+ +
+
+ + + v.size() == 0 + + + 0 == 0 + + +
+
+ + + v.size() == 10 + + + 10 == 10 + + + + + v.capacity() >= 10 + + + 10 >= 10 + + + +
+ +
+ +
+
+ + + v.size() == 0 + + + 0 == 0 + + +
+
+ + + v.size() == 10 + + + 10 == 10 + + + + + v.capacity() >= 10 + + + 10 >= 10 + + +
+ +
+ +
+ +
+ +
+
+ + + v.size() == 0 + + + 0 == 0 + + +
+
+ + + v.size() == 10 + + + 10 == 10 + + + + + v.capacity() >= 10 + + + 10 >= 10 + + +
+
+ + + v.size() == 5 + + + 5 == 5 + + + + + v.capacity() >= 10 + + + 10 >= 10 + + + +
+ +
+ +
+ +
+ +
+
+ + + v.size() == 0 + + + 0 == 0 + + +
+ +
+ +
+
+ + + v.size() == 0 + + + 0 == 0 + + +
+
+ + + v.capacity() >= 10 + + + 10 >= 10 + + + + + v.size() == 0 + + + 0 == 0 + + + +
+ +
+ +
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+
+ +
+ +
+ +
+ +
+ +
+ + + config.processName == "test" + + + "test" == "test" + + + +
+
+ + + config.fileName == "filename.ext" + + + "filename.ext" == "filename.ext" + + + +
+
+ + + config.fileName == "filename.ext" + + + "filename.ext" == "filename.ext" + + + +
+
+ + + config.fileName == "filename.ext" + + + "filename.ext" == "filename.ext" + + + +
+
+ + + config.fileName == "%stdout" + + + "%stdout" == "%stdout" + + + +
+
+ + + config.number == 42 + + + 42 == 42 + + + +
+
+ + + parseInto( cli, argv, config ) + + + parseInto( cli, argv, config ) + + + + + config.number == 0 + + + 0 == 0 + + + +
+
+ + + config1.number == 42 + + + 42 == 42 + + + + + !unusedTokens.empty() + + + !false + + + + + config2.description == "some text" + + + "some text" == "some text" + + + +
+
+ +
+
+
+ + + config.index == 3 + + + 3 == 3 + + + +
+ +
+
+
+ + + parseInto( cli, argv, config ) + + + parseInto( cli, argv, config ) + + + +
+ +
+
+ +
+
+
+ + + config.flag + + + true + + + +
+ +
+
+
+ + + config.flag == false + + + false == false + + + +
+ +
+
+ + + config.firstPos == "1st" + + + "1st" == "1st" + + + + + config.secondPos == "2nd" + + + "2nd" == "2nd" + + + + + config.unpositional == "3rd" + + + "3rd" == "3rd" + + + +
+ +
+ + + + !testCaseTracker.isCompleted() + + + !false + + + + + !testCaseTracker.isCompleted() + + + !false + + +
+ + + !testCaseTracker.isCompleted() + + + !false + + + + + testCaseTracker.isCompleted() + + + true + + + +
+ + + !testCaseTracker.isCompleted() + + + !false + + +
+ + + !testCaseTracker.enterSection( section1Name ) + + + !false + + + + + !testCaseTracker.isCompleted() + + + !false + + + + + !testCaseTracker.isCompleted() + + + !false + + + + + testCaseTracker.enterSection( section1Name ) + + + true + + + + + testCaseTracker.isCompleted() + + + true + + + +
+ + + !testCaseTracker.isCompleted() + + + !false + + +
+ + + !testCaseTracker.enterSection( section1Name ) + + + !false + + + + + !testCaseTracker.enterSection( section2Name ) + + + !false + + + + + !testCaseTracker.isCompleted() + + + !false + + + + + testCaseTracker.enterSection( section1Name ) + + + true + + + + + !testCaseTracker.enterSection( section2Name ) + + + !false + + + + + !testCaseTracker.isCompleted() + + + !false + + + + + !testCaseTracker.enterSection( section1Name ) + + + !false + + + + + testCaseTracker.enterSection( section2Name ) + + + true + + + + + testCaseTracker.isCompleted() + + + true + + + +
+ + + !testCaseTracker.isCompleted() + + + !false + + +
+ + + !testCaseTracker.enterSection( section1Name ) + + + !false + + + + + !testCaseTracker.isCompleted() + + + !false + + + + + testCaseTracker.enterSection( section1Name ) + + + true + + + + + !testCaseTracker.enterSection( section2Name ) + + + !false + + + + + !testCaseTracker.isCompleted() + + + !false + + + + + testCaseTracker.enterSection( section1Name ) + + + true + + + + + testCaseTracker.enterSection( section2Name ) + + + true + + + + + testCaseTracker.isCompleted() + + + true + + + +
+ +
+ +
+ +
diff --git a/single_include_projects/SelfTest/ClassTests.cpp b/single_include_projects/SelfTest/ClassTests.cpp new file mode 100644 index 00000000..4c306c36 --- /dev/null +++ b/single_include_projects/SelfTest/ClassTests.cpp @@ -0,0 +1,53 @@ +/* + * Created by Phil on 09/11/2010. + * Copyright 2010 Two Blue Cubes Ltd. All rights reserved. + * + * Distributed under the Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + */ + +#include "catch.hpp" + +class TestClass +{ + std::string s; + +public: + TestClass() + : s( "hello" ) + {} + + void succeedingCase() + { + REQUIRE( s == "hello" ); + } + void failingCase() + { + REQUIRE( s == "world" ); + } +}; + +// Note: TestClass conflicts with template class with same name in VS2012 native tests +METHOD_AS_TEST_CASE( ::TestClass::succeedingCase, "A METHOD_AS_TEST_CASE based test run that succeeds", "[class]" ) +METHOD_AS_TEST_CASE( ::TestClass::failingCase, "A METHOD_AS_TEST_CASE based test run that fails", "[.][class][failing]" ) + +struct Fixture +{ + Fixture() : m_a( 1 ) {} + + int m_a; +}; + +TEST_CASE_METHOD( Fixture, "A TEST_CASE_METHOD based test run that succeeds", "[class]" ) +{ + REQUIRE( m_a == 1 ); +} + +// We should be able to write our tests within a different namespace +namespace Inner +{ + TEST_CASE_METHOD( Fixture, "A TEST_CASE_METHOD based test run that fails", "[.][class][failing]" ) + { + REQUIRE( m_a == 2 ); + } +} diff --git a/single_include_projects/SelfTest/CmdLineTests.cpp b/single_include_projects/SelfTest/CmdLineTests.cpp new file mode 100644 index 00000000..8d003fed --- /dev/null +++ b/single_include_projects/SelfTest/CmdLineTests.cpp @@ -0,0 +1,192 @@ +/* + * Created by Phil on 22/10/2010. + * Copyright 2010 Two Blue Cubes Ltd + * + * Distributed under the Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + */ +#ifdef __clang__ +#pragma clang diagnostic ignored "-Wpadded" +#endif + +#include "internal/clara.h" // This will does not declare Clara within the Catch namespace + +#include "catch.hpp" + + +// Helper to deduce size from array literals and pass on to parser +template +std::vector parseInto( Clara::CommandLine& cli, char const * (&argv)[size], ConfigT& config ) { + return cli.parseInto( size, argv, config ); +} + + +struct TestOpt { + TestOpt() : number( 0 ), index( 0 ), flag( false ) {} + + std::string processName; + std::string fileName; + int number; + int index; + bool flag; + std::string firstPos; + std::string secondPos; + std::string unpositional; + + void setValidIndex( int i ) { + if( i < 0 || i > 10 ) + throw std::domain_error( "index must be between 0 and 10" ); + index = i; + } +}; + +struct TestOpt2 { + std::string description; +}; + +#ifdef CATCH_CONFIG_VARIADIC_MACROS + +TEST_CASE( "cmdline" ) { + + TestOpt config; + Clara::CommandLine cli; + cli.bindProcessName( &TestOpt::processName ); + cli.bind( &TestOpt::fileName ) + .describe( "specifies output file" ) + .shortOpt( "o" ) + .longOpt( "output" ) + .hint( "filename" ); + + SECTION( "process name" ) { + char const * argv[] = { "test", "-o filename.ext" }; + parseInto( cli, argv, config ); + + CHECK( config.processName == "test" ); + } + SECTION( "arg separated by spaces" ) { + char const * argv[] = { "test", "-o filename.ext" }; + parseInto( cli, argv, config ); + + CHECK( config.fileName == "filename.ext" ); + } + SECTION( "arg separated by colon" ) { + const char* argv[] = { "test", "-o:filename.ext" }; + parseInto( cli, argv, config ); + + CHECK( config.fileName == "filename.ext" ); + } + SECTION( "arg separated by =" ) { + const char* argv[] = { "test", "-o=filename.ext" }; + parseInto( cli, argv, config ); + + CHECK( config.fileName == "filename.ext" ); + } + SECTION( "long opt" ) { + const char* argv[] = { "test", "--output %stdout" }; + parseInto( cli, argv, config ); + + CHECK( config.fileName == "%stdout" ); + } + + cli.bind( &TestOpt::number ) + .shortOpt( "n" ) + .hint( "an integral value" ); + + SECTION( "a number" ) { + const char* argv[] = { "test", "-n 42" }; + parseInto( cli, argv, config ); + + CHECK( config.number == 42 ); + } + SECTION( "not a number" ) { + const char* argv[] = { "test", "-n forty-two" }; + CHECK_THROWS( parseInto( cli, argv, config ) ); + + CHECK( config.number == 0 ); + } + + SECTION( "two parsers" ) { + + TestOpt config1; + TestOpt2 config2; + Clara::CommandLine cli2; + + cli2.bind( &TestOpt2::description ) + .describe( "description" ) + .shortOpt( "d" ) + .longOpt( "description" ) + .hint( "some text" ); + + const char* argv[] = { "test", "-n 42", "-d some text" }; + std::vector unusedTokens = parseInto( cli, argv, config1 ); + + CHECK( config1.number == 42 ); + + REQUIRE_FALSE( unusedTokens.empty() ); + cli2.populate( unusedTokens, config2 ); + CHECK( config2.description == "some text" ); + } + + SECTION( "methods" ) { + cli.bind( &TestOpt::setValidIndex ) + .describe( "An index, which is an integer between 0 and 10, inclusive" ) + .shortOpt( "i" ) + .hint( "index" ); + + SECTION( "in range" ) { + const char* argv[] = { "test", "-i 3" }; + parseInto( cli, argv, config ); + + REQUIRE( config.index == 3 ); + } + SECTION( "out of range" ) { + const char* argv[] = { "test", "-i 42" }; + + REQUIRE_THROWS( parseInto( cli, argv, config ) ); + } + } + + SECTION( "flags" ) { + cli.bind( &TestOpt::flag ) + .describe( "A flag" ) + .shortOpt( "f" ); + + SECTION( "set" ) { + const char* argv[] = { "test", "-f" }; + parseInto( cli, argv, config ); + + REQUIRE( config.flag ); + } + SECTION( "not set" ) { + const char* argv[] = { "test" }; + parseInto( cli, argv, config ); + + REQUIRE( config.flag == false ); + } + } + SECTION( "positional" ) { + cli.bind( &TestOpt::secondPos ) + .describe( "Second position" ) + .hint( "second arg" ) + .position( 2 ); + cli.bind( &TestOpt::unpositional ) + .hint( "any arg" ) + .describe( "Unpositional" ); + cli.bind( &TestOpt::firstPos ) + .describe( "First position" ) + .hint( "first arg" ) + .position( 1 ); + +// std::cout << cli.usage( "testApp" ) << std::endl; + + const char* argv[] = { "test", "-f", "1st", "-o", "filename", "2nd", "3rd" }; + parseInto( cli, argv, config ); + + REQUIRE( config.firstPos == "1st" ); + REQUIRE( config.secondPos == "2nd" ); + REQUIRE( config.unpositional == "3rd" ); + } +} + + +#endif diff --git a/single_include_projects/SelfTest/ConditionTests.cpp b/single_include_projects/SelfTest/ConditionTests.cpp new file mode 100644 index 00000000..5523b334 --- /dev/null +++ b/single_include_projects/SelfTest/ConditionTests.cpp @@ -0,0 +1,337 @@ +/* + * Created by Phil on 08/11/2010. + * Copyright 2010 Two Blue Cubes Ltd. All rights reserved. + * + * Distributed under the Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + */ +#ifdef __clang__ +#pragma clang diagnostic ignored "-Wpadded" +#endif + +#include "catch.hpp" + +#include +#include + +namespace ConditionTests +{ + + struct TestData { + TestData() + : int_seven( 7 ), + str_hello( "hello" ), + float_nine_point_one( 9.1f ), + double_pi( 3.1415926535 ) + {} + + int int_seven; + std::string str_hello; + float float_nine_point_one; + double double_pi; + }; + + + struct TestDef { + TestDef& operator + ( const std::string& ) { + return *this; + } + TestDef& operator[]( const std::string& ) { + return *this; + } + + }; + + // The "failing" tests all use the CHECK macro, which continues if the specific test fails. + // This allows us to see all results, even if an earlier check fails + + // Equality tests + TEST_CASE( "Equality checks that should succeed", "" ) + { + + TestDef td; + td + "hello" + "hello"; + + TestData data; + + REQUIRE( data.int_seven == 7 ); + REQUIRE( data.float_nine_point_one == Approx( 9.1f ) ); + REQUIRE( data.double_pi == Approx( 3.1415926535 ) ); + REQUIRE( data.str_hello == "hello" ); + REQUIRE( "hello" == data.str_hello ); + REQUIRE( data.str_hello.size() == 5 ); + + double x = 1.1 + 0.1 + 0.1; + REQUIRE( x == Approx( 1.3 ) ); + } + + TEST_CASE( "Equality checks that should fail]", "[.][failing]" ) + { + TestData data; + + CHECK( data.int_seven == 6 ); + CHECK( data.int_seven == 8 ); + CHECK( data.int_seven == 0 ); + CHECK( data.float_nine_point_one == Approx( 9.11f ) ); + CHECK( data.float_nine_point_one == Approx( 9.0f ) ); + CHECK( data.float_nine_point_one == Approx( 1 ) ); + CHECK( data.float_nine_point_one == Approx( 0 ) ); + CHECK( data.double_pi == Approx( 3.1415 ) ); + CHECK( data.str_hello == "goodbye" ); + CHECK( data.str_hello == "hell" ); + CHECK( data.str_hello == "hello1" ); + CHECK( data.str_hello.size() == 6 ); + + double x = 1.1 + 0.1 + 0.1; + CHECK( x == Approx( 1.301 ) ); + } + + TEST_CASE( "Inequality checks that should succeed", "" ) + { + TestData data; + + REQUIRE( data.int_seven != 6 ); + REQUIRE( data.int_seven != 8 ); + REQUIRE( data.float_nine_point_one != Approx( 9.11f ) ); + REQUIRE( data.float_nine_point_one != Approx( 9.0f ) ); + REQUIRE( data.float_nine_point_one != Approx( 1 ) ); + REQUIRE( data.float_nine_point_one != Approx( 0 ) ); + REQUIRE( data.double_pi != Approx( 3.1415 ) ); + REQUIRE( data.str_hello != "goodbye" ); + REQUIRE( data.str_hello != "hell" ); + REQUIRE( data.str_hello != "hello1" ); + REQUIRE( data.str_hello.size() != 6 ); + } + + TEST_CASE( "Inequality checks that should fails", "[.][failing]" ) + { + TestData data; + + CHECK( data.int_seven != 7 ); + CHECK( data.float_nine_point_one != Approx( 9.1f ) ); + CHECK( data.double_pi != Approx( 3.1415926535 ) ); + CHECK( data.str_hello != "hello" ); + CHECK( data.str_hello.size() != 5 ); + } + + // Ordering comparison tests + TEST_CASE( "Ordering comparison checks that should succeed", "" ) + { + TestData data; + + REQUIRE( data.int_seven < 8 ); + REQUIRE( data.int_seven > 6 ); + REQUIRE( data.int_seven > 0 ); + REQUIRE( data.int_seven > -1 ); + + REQUIRE( data.int_seven >= 7 ); + REQUIRE( data.int_seven >= 6 ); + REQUIRE( data.int_seven <= 7 ); + REQUIRE( data.int_seven <= 8 ); + + REQUIRE( data.float_nine_point_one > 9 ); + REQUIRE( data.float_nine_point_one < 10 ); + REQUIRE( data.float_nine_point_one < 9.2 ); + + REQUIRE( data.str_hello <= "hello" ); + REQUIRE( data.str_hello >= "hello" ); + + REQUIRE( data.str_hello < "hellp" ); + REQUIRE( data.str_hello < "zebra" ); + REQUIRE( data.str_hello > "hellm" ); + REQUIRE( data.str_hello > "a" ); + } + + TEST_CASE( "Ordering comparison checks that should fail", "[.][failing]" ) + { + TestData data; + + CHECK( data.int_seven > 7 ); + CHECK( data.int_seven < 7 ); + CHECK( data.int_seven > 8 ); + CHECK( data.int_seven < 6 ); + CHECK( data.int_seven < 0 ); + CHECK( data.int_seven < -1 ); + + CHECK( data.int_seven >= 8 ); + CHECK( data.int_seven <= 6 ); + + CHECK( data.float_nine_point_one < 9 ); + CHECK( data.float_nine_point_one > 10 ); + CHECK( data.float_nine_point_one > 9.2 ); + + CHECK( data.str_hello > "hello" ); + CHECK( data.str_hello < "hello" ); + CHECK( data.str_hello > "hellp" ); + CHECK( data.str_hello > "z" ); + CHECK( data.str_hello < "hellm" ); + CHECK( data.str_hello < "a" ); + + CHECK( data.str_hello >= "z" ); + CHECK( data.str_hello <= "a" ); + } + + // Comparisons with int literals + TEST_CASE( "Comparisons with int literals don't warn when mixing signed/ unsigned", "" ) + { + int i = 1; + unsigned int ui = 2; + long l = 3; + unsigned long ul = 4; + char c = 5; + unsigned char uc = 6; + + REQUIRE( i == 1 ); + REQUIRE( ui == 2 ); + REQUIRE( l == 3 ); + REQUIRE( ul == 4 ); + REQUIRE( c == 5 ); + REQUIRE( uc == 6 ); + + REQUIRE( 1 == i ); + REQUIRE( 2 == ui ); + REQUIRE( 3 == l ); + REQUIRE( 4 == ul ); + REQUIRE( 5 == c ); + REQUIRE( 6 == uc ); + + REQUIRE( (std::numeric_limits::max)() > ul ); + } + +// Disable warnings about sign conversions for the next two tests +// (as we are deliberately invoking them) +// - Currently only disabled for GCC/ LLVM. Should add VC++ too +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wsign-compare" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#endif +#ifdef _MSC_VER +#pragma warning(disable:4389) // '==' : signed/unsigned mismatch +#endif + + TEST_CASE( "comparisons between int variables", "" ) + { + long long_var = 1L; + unsigned char unsigned_char_var = 1; + unsigned short unsigned_short_var = 1; + unsigned int unsigned_int_var = 1; + unsigned long unsigned_long_var = 1L; + + REQUIRE( long_var == unsigned_char_var ); + REQUIRE( long_var == unsigned_short_var ); + REQUIRE( long_var == unsigned_int_var ); + REQUIRE( long_var == unsigned_long_var ); + } + + TEST_CASE( "comparisons between const int variables", "" ) + { + const unsigned char unsigned_char_var = 1; + const unsigned short unsigned_short_var = 1; + const unsigned int unsigned_int_var = 1; + const unsigned long unsigned_long_var = 1L; + + REQUIRE( unsigned_char_var == 1 ); + REQUIRE( unsigned_short_var == 1 ); + REQUIRE( unsigned_int_var == 1 ); + REQUIRE( unsigned_long_var == 1 ); + } + + TEST_CASE( "Comparisons between unsigned ints and negative signed ints match c++ standard behaviour", "" ) + { + CHECK( ( -1 > 2u ) ); + CHECK( -1 > 2u ); + + CHECK( ( 2u < -1 ) ); + CHECK( 2u < -1 ); + + const int minInt = (std::numeric_limits::min)(); + CHECK( ( minInt > 2u ) ); + CHECK( minInt > 2u ); + } + + template + struct Ex + { + Ex( T ){} + + bool operator == ( const T& ) const { return true; } + T operator * ( const T& ) const { return T(); } + }; + + TEST_CASE( "Comparisons between ints where one side is computed", "" ) + { + CHECK( 54 == 6*9 ); + } + +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif + +inline const char* returnsConstNull(){ return NULL; } +inline char* returnsNull(){ return NULL; } + + TEST_CASE( "Pointers can be compared to null", "" ) + { + TestData* p = NULL; + TestData* pNULL = NULL; + + REQUIRE( p == NULL ); + REQUIRE( p == pNULL ); + + TestData data; + p = &data; + + REQUIRE( p != NULL ); + + const TestData* cp = p; + REQUIRE( cp != NULL ); + + const TestData* const cpc = p; + REQUIRE( cpc != NULL ); + + REQUIRE( returnsNull() == NULL ); + REQUIRE( returnsConstNull() == NULL ); + + REQUIRE( NULL != p ); + } + + // Not (!) tests + // The problem with the ! operator is that it has right-to-left associativity. + // This means we can't isolate it when we decompose. The simple REQUIRE( !false ) form, therefore, + // cannot have the operand value extracted. The test will work correctly, and the situation + // is detected and a warning issued. + // An alternative form of the macros (CHECK_FALSE and REQUIRE_FALSE) can be used instead to capture + // the operand value. + TEST_CASE( "'Not' checks that should succeed", "" ) + { + bool falseValue = false; + + REQUIRE( false == false ); + REQUIRE( true == true ); + REQUIRE( !false ); + REQUIRE_FALSE( false ); + + REQUIRE( !falseValue ); + REQUIRE_FALSE( falseValue ); + + REQUIRE( !(1 == 2) ); + REQUIRE_FALSE( 1 == 2 ); + } + + TEST_CASE( "'Not' checks that should fail", "[.][failing]" ) + { + bool trueValue = true; + + CHECK( false != false ); + CHECK( true != true ); + CHECK( !true ); + CHECK_FALSE( true ); + + CHECK( !trueValue ); + CHECK_FALSE( trueValue ); + + CHECK( !(1 == 1) ); + CHECK_FALSE( 1 == 1 ); + } +} diff --git a/single_include_projects/SelfTest/ExceptionTests.cpp b/single_include_projects/SelfTest/ExceptionTests.cpp new file mode 100644 index 00000000..4d4f3232 --- /dev/null +++ b/single_include_projects/SelfTest/ExceptionTests.cpp @@ -0,0 +1,144 @@ +/* + * Created by Phil on 09/11/2010. + * Copyright 2010 Two Blue Cubes Ltd. All rights reserved. + * + * Distributed under the Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + */ + +#include "catch.hpp" + +#include +#include + +namespace +{ + inline int thisThrows() + { + if( Catch::isTrue( true ) ) + throw std::domain_error( "expected exception" ); + return 1; + } + + int thisDoesntThrow() + { + return 0; + } +} + +namespace ExceptionTests +{ + TEST_CASE( "When checked exceptions are thrown they can be expected or unexpected", "" ) + { + REQUIRE_THROWS_AS( thisThrows(), std::domain_error ); + REQUIRE_NOTHROW( thisDoesntThrow() ); + REQUIRE_THROWS( thisThrows() ); + } + + TEST_CASE( "Expected exceptions that don't throw or unexpected exceptions fail the test", "[.][failing]" ) + { + CHECK_THROWS_AS( thisThrows(), std::string ); + CHECK_THROWS_AS( thisDoesntThrow(), std::domain_error ); + CHECK_NOTHROW( thisThrows() ); + } + + TEST_CASE( "When unchecked exceptions are thrown directly they are always failures", "[.][failing]" ) + { + if( Catch::isTrue( true ) ) + throw std::domain_error( "unexpected exception" ); + } + + TEST_CASE( "An unchecked exception reports the line of the last assertion", "[.][failing]" ) + { + CHECK( 1 == 1 ); + if( Catch::isTrue( true ) ) + throw std::domain_error( "unexpected exception" ); + } + TEST_CASE( "When unchecked exceptions are thrown from sections they are always failures", "[.][failing]" ) + { + SECTION( "section name", "" ) + { + if( Catch::isTrue( true ) ) + throw std::domain_error( "unexpected exception" ); + } + } + + TEST_CASE( "When unchecked exceptions are thrown from functions they are always failures", "[.][failing]" ) + { + CHECK( thisThrows() == 0 ); + } + + TEST_CASE( "When unchecked exceptions are thrown, but caught, they do not affect the test", "" ) + { + try + { + throw std::domain_error( "unexpected exception" ); + } + catch(...) + { + } + } + + class CustomException + { + public: + CustomException( const std::string& msg ) + : m_msg( msg ) + {} + + std::string getMessage() const + { + return m_msg; + } + + private: + std::string m_msg; + }; + + CATCH_TRANSLATE_EXCEPTION( CustomException& ex ) + { + return ex.getMessage(); + } + + CATCH_TRANSLATE_EXCEPTION( double& ex ) + { + return Catch::toString( ex ); + } + + TEST_CASE("Unexpected custom exceptions can be translated", "[.][failing]" ) + { + if( Catch::isTrue( true ) ) + throw CustomException( "custom exception" ); + } + + inline void throwCustom() { + if( Catch::isTrue( true ) ) + throw CustomException( "custom exception - not std" ); + } + + TEST_CASE( "Custom exceptions can be translated when testing for nothrow", "[.][failing]" ) + { + REQUIRE_NOTHROW( throwCustom() ); + } + + TEST_CASE( "Custom exceptions can be translated when testing for throwing as something else", "[.][failing]" ) + { + REQUIRE_THROWS_AS( throwCustom(), std::exception ); + } + + + TEST_CASE( "Unexpected exceptions can be translated", "[.][failing]" ) + { + if( Catch::isTrue( true ) ) + throw double( 3.14 ); + } + + inline int thisFunctionNotImplemented( int ) { + CATCH_NOT_IMPLEMENTED; + } + + TEST_CASE( "NotImplemented exception", "" ) + { + REQUIRE_THROWS( thisFunctionNotImplemented( 7 ) ); + } +} diff --git a/single_include_projects/SelfTest/GeneratorTests.cpp b/single_include_projects/SelfTest/GeneratorTests.cpp new file mode 100644 index 00000000..e6ddaa70 --- /dev/null +++ b/single_include_projects/SelfTest/GeneratorTests.cpp @@ -0,0 +1,45 @@ +/* + * Created by Phil on 28/01/2011. + * Copyright 2011 Two Blue Cubes Ltd. All rights reserved. + * + * Distributed under the Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + */ + +// This define means we have to prefix all the CATCH macros with CATCH_ +// We're using it here to test it out +#define CATCH_CONFIG_PREFIX_ALL +#include "catch.hpp" + +namespace GeneratorTests +{ + inline int multiply( int a, int b ) + { + return a*b; + } + + CATCH_TEST_CASE( "Generators over two ranges", "[generators]" ) + { + using namespace Catch::Generators; + + int i = CATCH_GENERATE( between( 1, 5 ).then( values( 15, 20, 21 ).then( 36 ) ) ); + int j = CATCH_GENERATE( between( 100, 107 ) ); + + CATCH_REQUIRE( multiply( i, 2 ) == i*2 ); + CATCH_REQUIRE( multiply( j, 2 ) == j*2 ); + } + + struct IntPair { int first, second; }; + + CATCH_TEST_CASE( "Generator over a range of pairs", "[generators]" ) + { + using namespace Catch::Generators; + + IntPair p[] = { { 0, 1 }, { 2, 3 } }; + + IntPair* i = CATCH_GENERATE( between( p, &p[1] ) ); + + CATCH_REQUIRE( i->first == i->second-1 ); + + } +} diff --git a/single_include_projects/SelfTest/MessageInstantiationTests1.cpp b/single_include_projects/SelfTest/MessageInstantiationTests1.cpp new file mode 100644 index 00000000..55fd4e23 --- /dev/null +++ b/single_include_projects/SelfTest/MessageInstantiationTests1.cpp @@ -0,0 +1,56 @@ +/* + * Created by Phil on 09/11/2010. + * Copyright 2010 Two Blue Cubes Ltd. All rights reserved. + * + * Distributed under the Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + */ + +#include "catch.hpp" +#undef INTERNAL_CATCH_INLINE +#define INTERNAL_CATCH_INLINE inline +#include "../../include/internal/catch_message.hpp" + +namespace Counter { +int g_haveCountedMessages = 0; +} + +namespace MI1 +{ + // This test works with the equivalent in MessageInstantiationTests2.cpp + // The first test to reach this point will increment the MessageInfo counter. Subsequent tests + // just check the value. The purpose of this test is to verify that the compiler's + // greedy instantiation (or whatever process it uses) eliminate all other + // references to the globalCount + + TEST_CASE("message counting1","[vs]") + { + if( Counter::g_haveCountedMessages > 0 ) { + REQUIRE( Catch::MessageInfoCounter::globalCount > 0 ); + } + else + { + ++Catch::MessageInfoCounter::globalCount; + Counter::g_haveCountedMessages = 1; + } + } +} + +namespace LongCounter { +int g_haveCountedMessagesLong = 0; +} + +namespace MI1 +{ + TEST_CASE("long message counting1","[vs]") + { + if( LongCounter::g_haveCountedMessagesLong > 0 ) { + REQUIRE( Catch::MessageInfoCounter::globalCount > 0 ); + } + else + { + ++Catch::MessageInfoCounter::globalCount; + LongCounter::g_haveCountedMessagesLong = 1; + } + } +} diff --git a/single_include_projects/SelfTest/MessageInstantiationTests2.cpp b/single_include_projects/SelfTest/MessageInstantiationTests2.cpp new file mode 100644 index 00000000..5a7b698e --- /dev/null +++ b/single_include_projects/SelfTest/MessageInstantiationTests2.cpp @@ -0,0 +1,55 @@ +/* + * Created by Phil on 09/11/2010. + * Copyright 2010 Two Blue Cubes Ltd. All rights reserved. + * + * Distributed under the Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + */ + +#include "catch.hpp" +#define INTERNAL_CATCH_INLINE inline +#include "../../include/internal/catch_message.hpp" + +namespace Counter { +extern int g_haveCountedMessages; +} + +namespace MI2 +{ + // This test works with the equivalent in MessageInstantiationTests1.cpp + // The first test to reach this point will increment the MessageInfo counter. Subsequent tests + // just check the value. The purpose of this test is to verify that the compiler's + // greedy instantiation (or whatever process it uses) eliminate all other + // references to the globalCount + + TEST_CASE("message counting2","[vs]") + { + if( Counter::g_haveCountedMessages > 0 ) { + REQUIRE( Catch::MessageInfoCounter::globalCount > 0 ); + } + else + { + ++Catch::MessageInfoCounter::globalCount; + Counter::g_haveCountedMessages = 1; + } + } +} + +namespace LongCounter { +extern int g_haveCountedMessagesLong; +} + +namespace MI2 +{ + TEST_CASE("long message counting2","[vs]") + { + if( LongCounter::g_haveCountedMessagesLong > 0 ) { + REQUIRE( Catch::MessageInfoCounter::globalCount > 0 ); + } + else + { + ++Catch::MessageInfoCounter::globalCount; + LongCounter::g_haveCountedMessagesLong = 1; + } + } +} diff --git a/single_include_projects/SelfTest/MessageTests.cpp b/single_include_projects/SelfTest/MessageTests.cpp new file mode 100644 index 00000000..257e343e --- /dev/null +++ b/single_include_projects/SelfTest/MessageTests.cpp @@ -0,0 +1,125 @@ +/* + * Created by Phil on 09/11/2010. + * Copyright 2010 Two Blue Cubes Ltd. All rights reserved. + * + * Distributed under the Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + */ + +#include "catch.hpp" + +namespace MessageTests +{ + + TEST_CASE( "INFO and WARN do not abort tests", "[messages]" ) + { + INFO( "this is a " << "message" ); // This should output the message if a failure occurs + WARN( "this is a " << "warning" ); // This should always output the message but then continue + } + TEST_CASE( "SUCCEED counts as a test pass", "[messages]" ) + { + SUCCEED( "this is a " << "success" ); + } + + TEST_CASE( "INFO gets logged on failure", "[failing][messages][.]" ) + { + INFO( "this message should be logged" ); + INFO( "so should this" ); + int a = 2; + REQUIRE( a == 1 ); + } + + TEST_CASE( "INFO gets logged on failure, even if captured before successful assertions", "[failing][messages][.]" ) + { + INFO( "this message may be logged later" ); + int a = 2; + CHECK( a == 2 ); + + INFO( "this message should be logged" ); + + CHECK( a == 1 ); + + INFO( "and this, but later" ); + + CHECK( a == 0 ); + + INFO( "but not this" ); + + CHECK( a == 2 ); + } + + TEST_CASE( "FAIL aborts the test", "[failing][messages][.]" ) + { + FAIL( "This is a " << "failure" ); // This should output the message and abort + } + + #ifdef CATCH_CONFIG_VARIADIC_MACROS + TEST_CASE( "FAIL does not require an argument", "[failing][messages][.]" ) + { + FAIL(); + } + TEST_CASE( "SUCCESS does not require an argument", "[messages][.]" ) + { + SUCCEED(); + } + #endif + + TEST_CASE( "Output from all sections is reported", "[failing][messages][.]" ) + { + SECTION( "one", "" ) + { + FAIL( "Message from section one" ); + } + + SECTION( "two", "" ) + { + FAIL( "Message from section two" ); + } + } + + TEST_CASE( "Standard output from all sections is reported", "[messages]" ) + { + SECTION( "one", "" ) + { + std::cout << "Message from section one" << std::endl; + } + + SECTION( "two", "" ) + { + std::cout << "Message from section two" << std::endl; + } + } + + TEST_CASE( "SCOPED_INFO is reset for each loop", "[messages][failing][.]" ) + { + for( int i=0; i<100; i++ ) + { + SCOPED_INFO( "current counter " << i ); + SCOPED_CAPTURE( i ); + REQUIRE( i < 10 ); + } + } + + TEST_CASE( "The NO_FAIL macro reports a failure but does not fail the test", "[messages]" ) + { + CHECK_NOFAIL( 1 == 2 ); + } + + TEST_CASE( "just info", "[info][isolated info][messages]" ) + { + INFO( "this should never be seen" ); + } + TEST_CASE( "just failure", "[fail][isolated info][.][messages]" ) + { + FAIL( "Previous info should not be seen" ); + } + + + TEST_CASE( "sends information to INFO", "[.][failing]" ) + { + INFO( "hi" ); + int i = 7; + CAPTURE( i ); + REQUIRE( false ); + } +} diff --git a/single_include_projects/SelfTest/MiscTests.cpp b/single_include_projects/SelfTest/MiscTests.cpp new file mode 100644 index 00000000..f62e265e --- /dev/null +++ b/single_include_projects/SelfTest/MiscTests.cpp @@ -0,0 +1,339 @@ +/* + * Created by Phil on 29/11/2010. + * Copyright 2010 Two Blue Cubes Ltd. All rights reserved. + * + * Distributed under the Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + */ + +#include "catch.hpp" + +#include + +namespace MiscTests +{ + + TEST_CASE( "random SECTION tests", "[.][sections][failing]" ) + { + int a = 1; + int b = 2; + + SECTION( "s1", "doesn't equal" ) + { + REQUIRE( a != b ); + REQUIRE( b != a ); + } + + SECTION( "s2", "not equal" ) + { + REQUIRE( a != b); + } + } + + TEST_CASE( "nested SECTION tests", "[.][sections][failing]" ) + { + int a = 1; + int b = 2; + + SECTION( "s1", "doesn't equal" ) + { + REQUIRE( a != b ); + REQUIRE( b != a ); + + SECTION( "s2", "not equal" ) + { + REQUIRE( a != b); + } + } + } + + TEST_CASE( "more nested SECTION tests", "[sections][failing][.]" ) + { + int a = 1; + int b = 2; + + SECTION( "s1", "doesn't equal" ) + { + SECTION( "s2", "equal" ) + { + REQUIRE( a == b ); + } + + SECTION( "s3", "not equal" ) + { + REQUIRE( a != b ); + } + SECTION( "s4", "less than" ) + { + REQUIRE( a < b ); + } + } + } + + TEST_CASE( "even more nested SECTION tests", "[sections]" ) + { + SECTION( "c", "" ) + { + SECTION( "d (leaf)", "" ) + { + } + + SECTION( "e (leaf)", "" ) + { + } + } + + SECTION( "f (leaf)", "" ) + { + } + } + + TEST_CASE( "looped SECTION tests", "[.][failing][sections]" ) + { + int a = 1; + + for( int b = 0; b < 10; ++b ) + { + std::ostringstream oss; + oss << "b is currently: " << b; + SECTION( "s1", oss.str() ) + { + CHECK( b > a ); + } + } + } + + TEST_CASE( "looped tests", "[.][failing]" ) + { + static const int fib[] = { 1, 1, 2, 3, 5, 8, 13, 21 }; + + for( size_t i=0; i < sizeof(fib)/sizeof(int); ++i ) + { + INFO( "Testing if fib[" << i << "] (" << fib[i] << ") is even" ); + CHECK( ( fib[i] % 2 ) == 0 ); + } + } + + TEST_CASE( "Sends stuff to stdout and stderr", "" ) + { + std::cout << "A string sent directly to stdout" << std::endl; + + std::cerr << "A string sent directly to stderr" << std::endl; + } + + inline const char* makeString( bool makeNull ) + { + return makeNull ? NULL : "valid string"; + } + + TEST_CASE( "null strings", "" ) + { + REQUIRE( makeString( false ) != static_cast(NULL)); + REQUIRE( makeString( true ) == static_cast(NULL)); + } + + + inline bool testCheckedIf( bool flag ) + { + CHECKED_IF( flag ) + return true; + else + return false; + } + + TEST_CASE( "checkedIf", "" ) + { + REQUIRE( testCheckedIf( true ) ); + } + + TEST_CASE( "checkedIf, failing", "[failing][.]" ) + { + REQUIRE( testCheckedIf( false ) ); + } + + inline bool testCheckedElse( bool flag ) + { + CHECKED_ELSE( flag ) + return false; + + return true; + } + + TEST_CASE( "checkedElse", "" ) + { + REQUIRE( testCheckedElse( true ) ); + } + + TEST_CASE( "checkedElse, failing", "[failing][.]" ) + { + REQUIRE( testCheckedElse( false ) ); + } + + TEST_CASE( "xmlentitycheck", "" ) + { + SECTION( "embedded xml", "it should be possible to embed xml characters, such as <, \" or &, or even whole documents within an attribute" ) + { + // No test + } + SECTION( "encoded chars", "these should all be encoded: &&&\"\"\"<<<&\"<<&\"" ) + { + // No test + } + } + + TEST_CASE( "send a single char to INFO", "[failing][.]" ) + { + INFO(3); + REQUIRE(false); + } + + TEST_CASE( "atomic if", "[failing][0]") + { + size_t x = 0; + + if( x ) + REQUIRE(x > 0); + else + REQUIRE(x == 0); + } + + inline const char* testStringForMatching() + { + return "this string contains 'abc' as a substring"; + } + + TEST_CASE("String matchers", "[matchers]" ) + { + REQUIRE_THAT( testStringForMatching(), Contains( "string" ) ); + CHECK_THAT( testStringForMatching(), Contains( "abc" ) ); + + CHECK_THAT( testStringForMatching(), StartsWith( "this" ) ); + CHECK_THAT( testStringForMatching(), EndsWith( "substring" ) ); + } + + TEST_CASE("Contains string matcher", "[.][failing][matchers]") + { + CHECK_THAT( testStringForMatching(), Contains( "not there" ) ); + } + + TEST_CASE("StartsWith string matcher", "[.][failing][matchers]") + { + CHECK_THAT( testStringForMatching(), StartsWith( "string" ) ); + } + + TEST_CASE("EndsWith string matcher", "[.][failing][matchers]") + { + CHECK_THAT( testStringForMatching(), EndsWith( "this" ) ); + } + + TEST_CASE("Equals string matcher", "[.][failing][matchers]") + { + CHECK_THAT( testStringForMatching(), Equals( "something else" ) ); + } + TEST_CASE("Equals string matcher, with NULL", "[matchers]") + { + REQUIRE_THAT("", Equals(NULL)); + } + TEST_CASE("AllOf matcher", "[matchers]") + { + CHECK_THAT( testStringForMatching(), AllOf( Catch::Contains( "string" ), Catch::Contains( "abc" ) ) ); + } + TEST_CASE("AnyOf matcher", "[matchers]") + { + CHECK_THAT( testStringForMatching(), AnyOf( Catch::Contains( "string" ), Catch::Contains( "not there" ) ) ); + CHECK_THAT( testStringForMatching(), AnyOf( Catch::Contains( "not there" ), Catch::Contains( "string" ) ) ); + } + + TEST_CASE("Equals", "[matchers]") + { + CHECK_THAT( testStringForMatching(), Equals( "this string contains 'abc' as a substring" ) ); + } + + inline unsigned int Factorial( unsigned int number ) + { + // return number <= 1 ? number : Factorial(number-1)*number; + return number > 1 ? Factorial(number-1)*number : 1; + } + + TEST_CASE( "Factorials are computed", "[factorial]" ) { + REQUIRE( Factorial(0) == 1 ); + REQUIRE( Factorial(1) == 1 ); + REQUIRE( Factorial(2) == 2 ); + REQUIRE( Factorial(3) == 6 ); + REQUIRE( Factorial(10) == 3628800 ); + } + + TEST_CASE( "An empty test with no assertions", "[empty]" ) + { + } + + TEST_CASE( "Nice descriptive name", "[tag1][tag2][tag3][.]" ) + { + WARN( "This one ran" ); + } + TEST_CASE( "first tag", "[tag1]" ) + { + } + TEST_CASE( "second tag", "[tag2]" ) + { + } + // + //TEST_CASE( "spawn a new process", "[.]" ) + //{ + // // !TBD Work in progress + // char line[200]; + // FILE* output = popen("./CatchSelfTest ./failing/matchers/StartsWith", "r"); + // while ( fgets(line, 199, output) ) + // std::cout << line; + //} + + TEST_CASE( "vectors can be sized and resized", "[vector]" ) { + + std::vector v( 5 ); + + REQUIRE( v.size() == 5 ); + REQUIRE( v.capacity() >= 5 ); + + SECTION( "resizing bigger changes size and capacity", "" ) { + v.resize( 10 ); + + REQUIRE( v.size() == 10 ); + REQUIRE( v.capacity() >= 10 ); + } + SECTION( "resizing smaller changes size but not capacity", "" ) { + v.resize( 0 ); + + REQUIRE( v.size() == 0 ); + REQUIRE( v.capacity() >= 5 ); + + SECTION( "We can use the 'swap trick' to reset the capacity", "" ) { + std::vector empty; + empty.swap( v ); + + REQUIRE( v.capacity() == 0 ); + } + } + SECTION( "reserving bigger changes capacity but not size", "" ) { + v.reserve( 10 ); + + REQUIRE( v.size() == 5 ); + REQUIRE( v.capacity() >= 10 ); + } + SECTION( "reserving smaller does not change size or capacity", "" ) { + v.reserve( 0 ); + + REQUIRE( v.size() == 5 ); + REQUIRE( v.capacity() >= 5 ); + } + } + + // https://github.com/philsquared/Catch/issues/166 + TEST_CASE("A couple of nested sections followed by a failure", "[failing][.]") + { + SECTION("Outer", "") + SECTION("Inner", "") + SUCCEED("that's not flying - that's failing in style"); + + FAIL("to infinity and beyond"); + } +} diff --git a/single_include_projects/SelfTest/RunAllTests.cpp b/single_include_projects/SelfTest/RunAllTests.cpp new file mode 100644 index 00000000..838a3867 --- /dev/null +++ b/single_include_projects/SelfTest/RunAllTests.cpp @@ -0,0 +1,53 @@ +/* + * Created by Phil on 22/10/2010. + * Copyright 2010 Two Blue Cubes Ltd + * + * Distributed under the Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + */ + +#include "catch.hpp" +#include "../../include/internal/catch_text.h" +#include "../../include/internal/catch_console_colour.hpp" + +namespace AllTestsRunner { + + // VS2010 + // mstest /TestContainer:Debug\ManagedTestCatch.dll /category:"all" + // + // VS2012 managed + // vstest.console.exe /Logger:Trx Debug\ManagedTestCatch.dll /TestCaseFilter:"TestCategory=all" + // + // VS2012 native + // vstest.console.exe /Logger:Trx Debug\NativeTestCatch.dll /TestCaseFilter:"Owner=all" + #if defined(INTERNAL_CATCH_VS_MANAGED) || defined(INTERNAL_CATCH_VS_NATIVE) + CATCH_MAP_CATEGORY_TO_TAG(all, "~[vs]"); + + CATCH_CONFIG_SHOW_SUCCESS(true) + CATCH_CONFIG_WARN_MISSING_ASSERTIONS(true) + CATCH_MAP_CATEGORY_TO_TAG(allSucceeding, "~[vs]"); + + CATCH_CONFIG_SHOW_SUCCESS(true) + CATCH_CONFIG_WARN_MISSING_ASSERTIONS(true) + CATCH_CONFIG_ABORT_AFTER(4) + CATCH_INTERNAL_CONFIG_ADD_TEST("Some simple comparisons between doubles") + CATCH_INTERNAL_CONFIG_ADD_TEST("Approximate comparisons with different epsilons") + CATCH_INTERNAL_CONFIG_ADD_TEST("Approximate comparisons with floats") + CATCH_INTERNAL_CONFIG_ADD_TEST("Approximate comparisons with ints") + CATCH_INTERNAL_CONFIG_ADD_TEST("Approximate comparisons with mixed numeric types") + CATCH_INTERNAL_CONFIG_ADD_TEST("Use a custom approx") + CATCH_INTERNAL_CONFIG_ADD_TEST("Approximate PI") + CATCH_INTERNAL_CONFIG_ADD_TEST("A METHOD_AS_TEST_CASE based test run that succeeds") + CATCH_INTERNAL_CONFIG_ADD_TEST("A METHOD_AS_TEST_CASE based test run that fails") + CATCH_INTERNAL_CONFIG_ADD_TEST("A TEST_CASE_METHOD based test run that succeeds") + CATCH_INTERNAL_CONFIG_ADD_TEST("A TEST_CASE_METHOD based test run that fails") + CATCH_INTERNAL_CONFIG_ADD_TEST("Equality checks that should succeed") + CATCH_INTERNAL_CONFIG_ADD_TEST("Equality checks that should fail]") + INTERNAL_CATCH_MAP_CATEGORY_TO_LIST(allSucceedingAborting); + + CATCH_INTERNAL_CONFIG_ADD_TEST("Output from all sections is reported") + CATCH_INTERNAL_CONFIG_ADD_TEST("Standard output from all sections is reported") + INTERNAL_CATCH_MAP_CATEGORY_TO_LIST(OutputFromAllSectionsIsReported); +#endif + +} diff --git a/single_include_projects/SelfTest/SectionTrackerTests.cpp b/single_include_projects/SelfTest/SectionTrackerTests.cpp new file mode 100644 index 00000000..56b2d9fa --- /dev/null +++ b/single_include_projects/SelfTest/SectionTrackerTests.cpp @@ -0,0 +1,164 @@ +/* + * Created by Phil on 20/07/2013. + * Copyright 2013 Two Blue Cubes Ltd + * + * Distributed under the Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + */ + +#ifdef __clang__ +#pragma clang diagnostic ignored "-Wpadded" +#endif + +#include "catch.hpp" +#include "../../include/internal/catch_test_case_tracker.hpp" + + +TEST_CASE( "section tracking" ) { + + using namespace Catch; + TestCaseTracker testCaseTracker( "test case" ); + + const std::string section1Name = "section 1"; + const std::string section2Name = "section 2"; + + CHECK_FALSE( testCaseTracker.isCompleted() ); + + SECTION( "test case with no sections" ) { + + { + TestCaseTracker::Guard guard( testCaseTracker ); + CHECK_FALSE( testCaseTracker.isCompleted() ); + } + CHECK( testCaseTracker.isCompleted() ); + } + + SECTION( "test case with one section" ) { + + { + TestCaseTracker::Guard guard( testCaseTracker ); + + // Enter section? - no, not yet + CHECK_FALSE( testCaseTracker.enterSection( section1Name ) ); + CHECK_FALSE( testCaseTracker.isCompleted() ); + + // Leave test case - incomplete (still need to visit section) + } + CHECK_FALSE( testCaseTracker.isCompleted() ); + + // ... + + // Enter test case again + { + TestCaseTracker::Guard guard( testCaseTracker ); + + // Enter section? - yes + CHECK( testCaseTracker.enterSection( section1Name ) ); + + // Leave section and test case - now complete + testCaseTracker.leaveSection(); + } + CHECK( testCaseTracker.isCompleted() ); + } + + SECTION( "test case with two consecutive sections" ) { + + // Enter test case + { + TestCaseTracker::Guard guard( testCaseTracker ); + + // Enter section 1? - no, not yet + CHECK_FALSE( testCaseTracker.enterSection( section1Name ) ); + + // Enter section 2? - no, not yet + CHECK_FALSE( testCaseTracker.enterSection( section2Name ) ); + + // Leave test case - incomplete (still need to visit sections) + } + CHECK_FALSE( testCaseTracker.isCompleted() ); + + // ... + + // Enter test case again + { + TestCaseTracker::Guard guard( testCaseTracker ); + + // Enter section 1? - yes + CHECK( testCaseTracker.enterSection( section1Name ) ); + testCaseTracker.leaveSection(); + + // Enter section 2? - no, not yet + CHECK_FALSE( testCaseTracker.enterSection( section2Name ) ); + + // Leave test case - incomplete (still need to visit section 2) + } + CHECK_FALSE( testCaseTracker.isCompleted() ); + + // ... + + // Enter test case again + { + TestCaseTracker::Guard guard( testCaseTracker ); + + // Enter section 1? - no, already done now + CHECK_FALSE( testCaseTracker.enterSection( section1Name ) ); + + // Enter section 2? - yes - finally + CHECK( testCaseTracker.enterSection( section2Name ) ); + testCaseTracker.leaveSection(); + + // Leave test case - now complete + } + CHECK( testCaseTracker.isCompleted() ); + } + + SECTION( "test case with one section within another" ) { + + // Enter test case + { + TestCaseTracker::Guard guard( testCaseTracker ); + + // Enter section 1? - no, not yet + CHECK_FALSE( testCaseTracker.enterSection( section1Name ) ); + + // Leave test case - incomplete (still need to visit sections) + } + CHECK_FALSE( testCaseTracker.isCompleted() ); + + // ... + + // Enter test case again + { + TestCaseTracker::Guard guard( testCaseTracker ); + + // Enter section 1? - yes + CHECK( testCaseTracker.enterSection( section1Name ) ); + + // Enter section 2? - no, not yet + CHECK_FALSE( testCaseTracker.enterSection( section2Name ) ); + + testCaseTracker.leaveSection(); // section 1 - incomplete (section 2) + + // Leave test case - incomplete + } + CHECK_FALSE( testCaseTracker.isCompleted() ); + + // ... + + // Enter test case again + { + TestCaseTracker::Guard guard( testCaseTracker ); + + // Enter section 1? - yes - so we can execute section 2 + CHECK( testCaseTracker.enterSection( section1Name ) ); + + // Enter section 2? - yes - finally + CHECK( testCaseTracker.enterSection( section2Name ) ); + testCaseTracker.leaveSection(); // section 2 + testCaseTracker.leaveSection(); // section 1 + + // Leave test case - now complete + } + CHECK( testCaseTracker.isCompleted() ); + } +} diff --git a/single_include_projects/SelfTest/SurrogateCpps/catch_common.cpp b/single_include_projects/SelfTest/SurrogateCpps/catch_common.cpp new file mode 100644 index 00000000..e828ef62 --- /dev/null +++ b/single_include_projects/SelfTest/SurrogateCpps/catch_common.cpp @@ -0,0 +1,2 @@ +// This file is only here to verify (to the extent possible) the self sufficiency of the header +#include "catch_common.h" diff --git a/single_include_projects/SelfTest/SurrogateCpps/catch_console_colour.cpp b/single_include_projects/SelfTest/SurrogateCpps/catch_console_colour.cpp new file mode 100644 index 00000000..46e02333 --- /dev/null +++ b/single_include_projects/SelfTest/SurrogateCpps/catch_console_colour.cpp @@ -0,0 +1,2 @@ +// This file is only here to verify (to the extent possible) the self sufficiency of the header +#include "catch_console_colour.hpp" diff --git a/single_include_projects/SelfTest/SurrogateCpps/catch_debugger.cpp b/single_include_projects/SelfTest/SurrogateCpps/catch_debugger.cpp new file mode 100644 index 00000000..33f76ae6 --- /dev/null +++ b/single_include_projects/SelfTest/SurrogateCpps/catch_debugger.cpp @@ -0,0 +1,2 @@ +// This file is only here to verify (to the extent possible) the self sufficiency of the header +#include "catch_debugger.h" diff --git a/single_include_projects/SelfTest/SurrogateCpps/catch_interfaces_capture.cpp b/single_include_projects/SelfTest/SurrogateCpps/catch_interfaces_capture.cpp new file mode 100644 index 00000000..d2129650 --- /dev/null +++ b/single_include_projects/SelfTest/SurrogateCpps/catch_interfaces_capture.cpp @@ -0,0 +1,2 @@ +// This file is only here to verify (to the extent possible) the self sufficiency of the header +#include "catch_interfaces_capture.h" diff --git a/single_include_projects/SelfTest/SurrogateCpps/catch_interfaces_config.cpp b/single_include_projects/SelfTest/SurrogateCpps/catch_interfaces_config.cpp new file mode 100644 index 00000000..acc64cc3 --- /dev/null +++ b/single_include_projects/SelfTest/SurrogateCpps/catch_interfaces_config.cpp @@ -0,0 +1 @@ +#include "catch_interfaces_config.h" diff --git a/single_include_projects/SelfTest/SurrogateCpps/catch_interfaces_exception.cpp b/single_include_projects/SelfTest/SurrogateCpps/catch_interfaces_exception.cpp new file mode 100644 index 00000000..65709351 --- /dev/null +++ b/single_include_projects/SelfTest/SurrogateCpps/catch_interfaces_exception.cpp @@ -0,0 +1 @@ +#include "catch_interfaces_exception.h" diff --git a/single_include_projects/SelfTest/SurrogateCpps/catch_interfaces_generators.cpp b/single_include_projects/SelfTest/SurrogateCpps/catch_interfaces_generators.cpp new file mode 100644 index 00000000..271b1bcc --- /dev/null +++ b/single_include_projects/SelfTest/SurrogateCpps/catch_interfaces_generators.cpp @@ -0,0 +1 @@ +#include "catch_interfaces_generators.h" diff --git a/single_include_projects/SelfTest/SurrogateCpps/catch_interfaces_registry_hub.cpp b/single_include_projects/SelfTest/SurrogateCpps/catch_interfaces_registry_hub.cpp new file mode 100644 index 00000000..9446c5cf --- /dev/null +++ b/single_include_projects/SelfTest/SurrogateCpps/catch_interfaces_registry_hub.cpp @@ -0,0 +1,2 @@ +// This file is only here to verify (to the extent possible) the self sufficiency of the header +#include "catch_interfaces_registry_hub.h" diff --git a/single_include_projects/SelfTest/SurrogateCpps/catch_interfaces_reporter.cpp b/single_include_projects/SelfTest/SurrogateCpps/catch_interfaces_reporter.cpp new file mode 100644 index 00000000..c6f466d1 --- /dev/null +++ b/single_include_projects/SelfTest/SurrogateCpps/catch_interfaces_reporter.cpp @@ -0,0 +1 @@ +#include "catch_interfaces_reporter.h" diff --git a/single_include_projects/SelfTest/SurrogateCpps/catch_interfaces_runner.cpp b/single_include_projects/SelfTest/SurrogateCpps/catch_interfaces_runner.cpp new file mode 100644 index 00000000..401de262 --- /dev/null +++ b/single_include_projects/SelfTest/SurrogateCpps/catch_interfaces_runner.cpp @@ -0,0 +1 @@ +#include "catch_interfaces_runner.h" diff --git a/single_include_projects/SelfTest/SurrogateCpps/catch_interfaces_testcase.cpp b/single_include_projects/SelfTest/SurrogateCpps/catch_interfaces_testcase.cpp new file mode 100644 index 00000000..9227790e --- /dev/null +++ b/single_include_projects/SelfTest/SurrogateCpps/catch_interfaces_testcase.cpp @@ -0,0 +1 @@ +#include "catch_interfaces_testcase.h" diff --git a/single_include_projects/SelfTest/SurrogateCpps/catch_message.cpp b/single_include_projects/SelfTest/SurrogateCpps/catch_message.cpp new file mode 100644 index 00000000..257c8b06 --- /dev/null +++ b/single_include_projects/SelfTest/SurrogateCpps/catch_message.cpp @@ -0,0 +1,2 @@ +// This file is only here to verify (to the extent possible) the self sufficiency of the header +#include "catch_message.h" diff --git a/single_include_projects/SelfTest/SurrogateCpps/catch_option.cpp b/single_include_projects/SelfTest/SurrogateCpps/catch_option.cpp new file mode 100644 index 00000000..9461fdef --- /dev/null +++ b/single_include_projects/SelfTest/SurrogateCpps/catch_option.cpp @@ -0,0 +1,2 @@ +// This file is only here to verify (to the extent possible) the self sufficiency of the header +#include "catch_option.hpp" diff --git a/single_include_projects/SelfTest/SurrogateCpps/catch_ptr.cpp b/single_include_projects/SelfTest/SurrogateCpps/catch_ptr.cpp new file mode 100644 index 00000000..24ff97b1 --- /dev/null +++ b/single_include_projects/SelfTest/SurrogateCpps/catch_ptr.cpp @@ -0,0 +1,2 @@ +// This file is only here to verify (to the extent possible) the self sufficiency of the header +#include "catch_ptr.hpp" diff --git a/single_include_projects/SelfTest/SurrogateCpps/catch_stream.cpp b/single_include_projects/SelfTest/SurrogateCpps/catch_stream.cpp new file mode 100644 index 00000000..9911aec6 --- /dev/null +++ b/single_include_projects/SelfTest/SurrogateCpps/catch_stream.cpp @@ -0,0 +1,2 @@ +// This file is only here to verify (to the extent possible) the self sufficiency of the header +#include "catch_stream.h" diff --git a/single_include_projects/SelfTest/SurrogateCpps/catch_streambuf.cpp b/single_include_projects/SelfTest/SurrogateCpps/catch_streambuf.cpp new file mode 100644 index 00000000..f2983e25 --- /dev/null +++ b/single_include_projects/SelfTest/SurrogateCpps/catch_streambuf.cpp @@ -0,0 +1,2 @@ +// This file is only here to verify (to the extent possible) the self sufficiency of the header +#include "catch_streambuf.h" diff --git a/single_include_projects/SelfTest/SurrogateCpps/catch_tags.cpp b/single_include_projects/SelfTest/SurrogateCpps/catch_tags.cpp new file mode 100644 index 00000000..36e8789b --- /dev/null +++ b/single_include_projects/SelfTest/SurrogateCpps/catch_tags.cpp @@ -0,0 +1,2 @@ +// This file is only here to verify (to the extent possible) the self sufficiency of the header +#include "catch_tags.h" diff --git a/single_include_projects/SelfTest/SurrogateCpps/catch_xmlwriter.cpp b/single_include_projects/SelfTest/SurrogateCpps/catch_xmlwriter.cpp new file mode 100644 index 00000000..ca853847 --- /dev/null +++ b/single_include_projects/SelfTest/SurrogateCpps/catch_xmlwriter.cpp @@ -0,0 +1,2 @@ +// This file is only here to verify (to the extent possible) the self sufficiency of the header +#include "catch_xmlwriter.hpp" diff --git a/single_include_projects/SelfTest/TestMain.cpp b/single_include_projects/SelfTest/TestMain.cpp new file mode 100644 index 00000000..9ed89634 --- /dev/null +++ b/single_include_projects/SelfTest/TestMain.cpp @@ -0,0 +1,543 @@ +/* + * Created by Phil on 22/10/2010. + * Copyright 2010 Two Blue Cubes Ltd + * + * Distributed under the Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + */ + +#if !defined(_WINDLL) +#define CATCH_CONFIG_MAIN +#endif +#include "catch.hpp" + +#ifdef __clang__ +#pragma clang diagnostic ignored "-Wpadded" +#pragma clang diagnostic ignored "-Wweak-vtables" +#endif + +template +void parseIntoConfig( const char * (&argv)[size], Catch::ConfigData& config ) { + Catch::Clara::CommandLine parser = Catch::makeCommandLineParser(); + parser.parseInto( size, argv, config ); +} + +template +std::string parseIntoConfigAndReturnError( const char * (&argv)[size], Catch::ConfigData& config ) { + try { + parseIntoConfig( argv, config ); + FAIL( "expected exception" ); + } + catch( std::exception& ex ) { + return ex.what(); + } + return ""; +} + +inline Catch::TestCase fakeTestCase( const char* name, const char* desc = "" ){ return Catch::makeTestCase( NULL, "", name, desc, CATCH_INTERNAL_LINEINFO ); } + +TEST_CASE( "Process can be configured on command line", "[config][command-line]" ) { + + Catch::ConfigData config; + + SECTION( "default - no arguments", "" ) { + const char* argv[] = { "test" }; + CHECK_NOTHROW( parseIntoConfig( argv, config ) ); + + CHECK( config.shouldDebugBreak == false ); + CHECK( config.abortAfter == -1 ); + CHECK( config.noThrow == false ); + CHECK( config.reporterName.empty() ); + } + + SECTION( "test lists", "" ) { + SECTION( "1 test", "Specify one test case using" ) { + const char* argv[] = { "test", "test1" }; + CHECK_NOTHROW( parseIntoConfig( argv, config ) ); + + Catch::Config cfg( config ); + REQUIRE( cfg.filters().size() == 1 ); + REQUIRE( cfg.filters()[0].shouldInclude( fakeTestCase( "notIncluded" ) ) == false ); + REQUIRE( cfg.filters()[0].shouldInclude( fakeTestCase( "test1" ) ) ); + } + SECTION( "Specify one test case exclusion using exclude:", "" ) { + const char* argv[] = { "test", "exclude:test1" }; + CHECK_NOTHROW( parseIntoConfig( argv, config ) ); + + Catch::Config cfg( config ); + REQUIRE( cfg.filters().size() == 1 ); + REQUIRE( cfg.filters()[0].shouldInclude( fakeTestCase( "test1" ) ) == false ); + REQUIRE( cfg.filters()[0].shouldInclude( fakeTestCase( "alwaysIncluded" ) ) ); + } + + SECTION( "Specify one test case exclusion using ~", "" ) { + const char* argv[] = { "test", "~test1" }; + CHECK_NOTHROW( parseIntoConfig( argv, config ) ); + + Catch::Config cfg( config ); + REQUIRE( cfg.filters().size() == 1 ); + REQUIRE( cfg.filters()[0].shouldInclude( fakeTestCase( "test1" ) ) == false ); + REQUIRE( cfg.filters()[0].shouldInclude( fakeTestCase( "alwaysIncluded" ) ) ); + } + + SECTION( "Specify two test cases using -t", "" ) { + const char* argv[] = { "test", "-t", "test1", "test2" }; + CHECK_NOTHROW( parseIntoConfig( argv, config ) ); + + Catch::Config cfg( config ); + REQUIRE( cfg.filters().size() == 1 ); + REQUIRE( cfg.filters()[0].shouldInclude( fakeTestCase( "notIncluded" ) ) == false ); + REQUIRE( cfg.filters()[0].shouldInclude( fakeTestCase( "test1" ) ) ); + REQUIRE( cfg.filters()[0].shouldInclude( fakeTestCase( "test2" ) ) ); + } + } + + SECTION( "reporter", "" ) { + SECTION( "-r/console", "" ) { + const char* argv[] = { "test", "-r", "console" }; + CHECK_NOTHROW( parseIntoConfig( argv, config ) ); + + REQUIRE( config.reporterName == "console" ); + } + SECTION( "-r/xml", "" ) { + const char* argv[] = { "test", "-r", "xml" }; + CHECK_NOTHROW( parseIntoConfig( argv, config ) ); + + REQUIRE( config.reporterName == "xml" ); + } + SECTION( "--reporter/junit", "" ) { + const char* argv[] = { "test", "--reporter", "junit" }; + CHECK_NOTHROW( parseIntoConfig( argv, config ) ); + + REQUIRE( config.reporterName == "junit" ); + } + } + + SECTION( "debugger", "" ) { + SECTION( "-b", "" ) { + const char* argv[] = { "test", "-b" }; + CHECK_NOTHROW( parseIntoConfig( argv, config ) ); + + REQUIRE( config.shouldDebugBreak == true ); + } + SECTION( "--break", "" ) { + const char* argv[] = { "test", "--break" }; + CHECK_NOTHROW( parseIntoConfig( argv, config ) ); + + REQUIRE( config.shouldDebugBreak ); + } + } + + SECTION( "abort", "" ) { + SECTION( "-a aborts after first failure", "" ) { + const char* argv[] = { "test", "-a" }; + CHECK_NOTHROW( parseIntoConfig( argv, config ) ); + + REQUIRE( config.abortAfter == 1 ); + } + SECTION( "-x 2 aborts after two failures", "" ) { + const char* argv[] = { "test", "-x", "2" }; + CHECK_NOTHROW( parseIntoConfig( argv, config ) ); + + REQUIRE( config.abortAfter == 2 ); + } + SECTION( "-x must be greater than zero", "" ) { + const char* argv[] = { "test", "-x", "0" }; + REQUIRE_THAT( parseIntoConfigAndReturnError( argv, config ), Contains( "greater than zero" ) ); + } + SECTION( "-x must be numeric", "" ) { + const char* argv[] = { "test", "-x", "oops" }; + REQUIRE_THAT( parseIntoConfigAndReturnError( argv, config ), Contains( "-x" ) ); + } + } + + SECTION( "nothrow", "" ) { + SECTION( "-e", "" ) { + const char* argv[] = { "test", "-e" }; + CHECK_NOTHROW( parseIntoConfig( argv, config ) ); + + REQUIRE( config.noThrow == true ); + } + SECTION( "--nothrow", "" ) { + const char* argv[] = { "test", "--nothrow" }; + CHECK_NOTHROW( parseIntoConfig( argv, config ) ); + + REQUIRE( config.noThrow == true ); + } + } + + SECTION( "output filename", "" ) { + SECTION( "-o filename", "" ) { + const char* argv[] = { "test", "-o", "filename.ext" }; + CHECK_NOTHROW( parseIntoConfig( argv, config ) ); + + REQUIRE( config.outputFilename == "filename.ext" ); + } + SECTION( "--out", "" ) { + const char* argv[] = { "test", "--out", "filename.ext" }; + CHECK_NOTHROW( parseIntoConfig( argv, config ) ); + + REQUIRE( config.outputFilename == "filename.ext" ); + } + } + + SECTION( "combinations", "" ) { + SECTION( "Single character flags can be combined", "" ) { + const char* argv[] = { "test", "-abe" }; + CHECK_NOTHROW( parseIntoConfig( argv, config ) ); + + CHECK( config.abortAfter == 1 ); + CHECK( config.shouldDebugBreak ); + CHECK( config.noThrow == true ); + } + } +} + +TEST_CASE( "selftest/test filter", "Individual filters" ) { + + Catch::TestCaseFilter matchAny( "*" ); + Catch::TestCaseFilter matchNone( "*", Catch::IfFilterMatches::ExcludeTests ); + CHECK( matchAny.shouldInclude( fakeTestCase( "any" ) )); + CHECK( matchNone.shouldInclude( fakeTestCase( "any" ) ) == false ); + + Catch::TestCaseFilter matchHidden( "./*" ); + Catch::TestCaseFilter matchNonHidden( "./*", Catch::IfFilterMatches::ExcludeTests ); + + CHECK( matchHidden.shouldInclude( fakeTestCase( "any" ) ) == false ); + CHECK( matchNonHidden.shouldInclude( fakeTestCase( "any" ) ) ); + + CHECK( matchHidden.shouldInclude( fakeTestCase( "./any" ) ) ); + CHECK( matchNonHidden.shouldInclude( fakeTestCase( "./any" ) ) == false ); +} + +TEST_CASE( "selftest/test filters", "Sets of filters" ) { + + Catch::TestCaseFilter matchHidden( "./*" ); + Catch::TestCaseFilter dontMatchA( "./a*", Catch::IfFilterMatches::ExcludeTests ); + Catch::TestCaseFilters filters( "" ); + filters.addFilter( matchHidden ); + filters.addFilter( dontMatchA ); + + CHECK( matchHidden.shouldInclude( fakeTestCase( "./something" ) ) ); + + CHECK( filters.shouldInclude( fakeTestCase( "any" ) ) == false ); + CHECK( filters.shouldInclude( fakeTestCase( "./something" ) ) ); + CHECK( filters.shouldInclude( fakeTestCase( "./anything" ) ) == false ); +} + +TEST_CASE( "selftest/filter/prefix wildcard", "Individual filters with wildcards at the start" ) { + Catch::TestCaseFilter matchBadgers( "*badger" ); + + CHECK( matchBadgers.shouldInclude( fakeTestCase( "big badger" ) )); + CHECK( matchBadgers.shouldInclude( fakeTestCase( "little badgers" ) ) == false ); +} +TEST_CASE( "selftest/filter/wildcard at both ends", "Individual filters with wildcards at both ends" ) { + Catch::TestCaseFilter matchBadgers( "*badger*" ); + + CHECK( matchBadgers.shouldInclude( fakeTestCase( "big badger" ) )); + CHECK( matchBadgers.shouldInclude( fakeTestCase( "little badgers" ) ) ); + CHECK( matchBadgers.shouldInclude( fakeTestCase( "badgers are big" ) ) ); + CHECK( matchBadgers.shouldInclude( fakeTestCase( "hedgehogs" ) ) == false ); +} + + +template +int getArgc( const char * (&)[size] ) { + return size; +} + +TEST_CASE( "selftest/tags", "[tags]" ) { + + std::string p1 = "[one]"; + std::string p2 = "[one],[two]"; + std::string p3 = "[one][two]"; + std::string p4 = "[one][two],[three]"; + std::string p5 = "[one][two]~[.],[three]"; + + SECTION( "single [one] tag", "" ) { + Catch::TestCase oneTag = makeTestCase( NULL, "", "test", "[one]", CATCH_INTERNAL_LINEINFO ); + + CHECK( oneTag.getTestCaseInfo().description == "" ); + CHECK( oneTag.hasTag( "one" ) ); + CHECK( oneTag.getTags().size() == 1 ); + + CHECK( oneTag.matchesTags( p1 ) == true ); + CHECK( oneTag.matchesTags( p2 ) == true ); + CHECK( oneTag.matchesTags( p3 ) == false ); + CHECK( oneTag.matchesTags( p4 ) == false ); + CHECK( oneTag.matchesTags( p5 ) == false ); + } + + SECTION( "single [two] tag", "" ) { + Catch::TestCase oneTag = makeTestCase( NULL, "", "test", "[two]", CATCH_INTERNAL_LINEINFO ); + + CHECK( oneTag.getTestCaseInfo().description == "" ); + CHECK( oneTag.hasTag( "two" ) ); + CHECK( oneTag.getTags().size() == 1 ); + + CHECK( oneTag.matchesTags( p1 ) == false ); + CHECK( oneTag.matchesTags( p2 ) == true ); + CHECK( oneTag.matchesTags( p3 ) == false ); + CHECK( oneTag.matchesTags( p4 ) == false ); + CHECK( oneTag.matchesTags( p5 ) == false ); + } + + SECTION( "two tags", "" ) { + Catch::TestCase twoTags= makeTestCase( NULL, "", "test", "[one][two]", CATCH_INTERNAL_LINEINFO ); + + CHECK( twoTags.getTestCaseInfo().description == "" ); + CHECK( twoTags.hasTag( "one" ) ); + CHECK( twoTags.hasTag( "two" ) ); + CHECK( twoTags.hasTag( "Two" ) ); + CHECK( twoTags.hasTag( "three" ) == false ); + CHECK( twoTags.getTags().size() == 2 ); + + CHECK( twoTags.matchesTags( p1 ) == true ); + CHECK( twoTags.matchesTags( p2 ) == true ); + CHECK( twoTags.matchesTags( p3 ) == true ); + CHECK( twoTags.matchesTags( p4 ) == true ); + CHECK( twoTags.matchesTags( p5 ) == true ); + } + SECTION( "complex", "" ) { + CHECK( fakeTestCase( "test", "[one][.]" ).matchesTags( p1 ) ); + CHECK_FALSE( fakeTestCase( "test", "[one][.]" ).matchesTags( p5 ) ); + CHECK( fakeTestCase( "test", "[three]" ).matchesTags( p4 ) ); + CHECK( fakeTestCase( "test", "[three]" ).matchesTags( p5 ) ); + CHECK( fakeTestCase( "test", "[three]" ).matchesTags( "[three]~[one]" ) ); + CHECK( fakeTestCase( "test", "[unit][not_apple]" ).matchesTags( "[unit]" ) ); + CHECK_FALSE( fakeTestCase( "test", "[unit][not_apple]" ).matchesTags( "[unit]~[not_apple]" ) ); + } + + SECTION( "one tag with characters either side", "" ) { + + Catch::TestCase oneTagWithExtras = makeTestCase( NULL, "", "test", "12[one]34", CATCH_INTERNAL_LINEINFO ); + CHECK( oneTagWithExtras.getTestCaseInfo().description == "1234" ); + CHECK( oneTagWithExtras.hasTag( "one" ) ); + CHECK( oneTagWithExtras.hasTag( "two" ) == false ); + CHECK( oneTagWithExtras.getTags().size() == 1 ); + } + + SECTION( "start of a tag, but not closed", "" ) { + + Catch::TestCase oneTagOpen = makeTestCase( NULL, "", "test", "[one", CATCH_INTERNAL_LINEINFO ); + + CHECK( oneTagOpen.getTestCaseInfo().description == "[one" ); + CHECK( oneTagOpen.hasTag( "one" ) == false ); + CHECK( oneTagOpen.getTags().size() == 0 ); + } + + SECTION( "hidden", "" ) { + Catch::TestCase oneTag = makeTestCase( NULL, "", "test", "[.]", CATCH_INTERNAL_LINEINFO ); + + CHECK( oneTag.getTestCaseInfo().description == "" ); + CHECK( oneTag.hasTag( "." ) ); + CHECK( oneTag.isHidden() ); + + CHECK( oneTag.matchesTags( "~[.]" ) == false ); + + } +} + +TEST_CASE( "Long strings can be wrapped", "[wrap]" ) { + + using namespace Catch; + SECTION( "plain string", "" ) { + // guide: 123456789012345678 + std::string testString = "one two three four"; + + SECTION( "No wrapping", "" ) { + CHECK( Catch::Text( testString, TextAttributes().setWidth( 80 ) ).toString() == testString ); + CHECK( Catch::Text( testString, TextAttributes().setWidth( 18 ) ).toString() == testString ); + } + SECTION( "Wrapped once", "" ) { + CHECK( Catch::Text( testString, TextAttributes().setWidth( 17 ) ).toString() == "one two three\nfour" ); + CHECK( Catch::Text( testString, TextAttributes().setWidth( 16 ) ).toString() == "one two three\nfour" ); + CHECK( Catch::Text( testString, TextAttributes().setWidth( 14 ) ).toString() == "one two three\nfour" ); + CHECK( Catch::Text( testString, TextAttributes().setWidth( 13 ) ).toString() == "one two three\nfour" ); + CHECK( Catch::Text( testString, TextAttributes().setWidth( 12 ) ).toString() == "one two\nthree four" ); + } + SECTION( "Wrapped twice", "" ) { + CHECK( Catch::Text( testString, TextAttributes().setWidth( 9 ) ).toString() == "one two\nthree\nfour" ); + CHECK( Catch::Text( testString, TextAttributes().setWidth( 8 ) ).toString() == "one two\nthree\nfour" ); + CHECK( Catch::Text( testString, TextAttributes().setWidth( 7 ) ).toString() == "one two\nthree\nfour" ); + } + SECTION( "Wrapped three times", "" ) { + CHECK( Catch::Text( testString, TextAttributes().setWidth( 6 ) ).toString() == "one\ntwo\nthree\nfour" ); + CHECK( Catch::Text( testString, TextAttributes().setWidth( 5 ) ).toString() == "one\ntwo\nthree\nfour" ); + } + SECTION( "Short wrap", "" ) { + CHECK( Catch::Text( "abcdef", TextAttributes().setWidth( 4 ) ).toString() == "abc-\ndef" ); + CHECK( Catch::Text( "abcdefg", TextAttributes().setWidth( 4 ) ).toString() == "abc-\ndefg" ); + CHECK( Catch::Text( "abcdefgh", TextAttributes().setWidth( 4 ) ).toString() == "abc-\ndef-\ngh" ); + + CHECK( Catch::Text( testString, TextAttributes().setWidth( 4 ) ).toString() == "one\ntwo\nthr-\nee\nfour" ); + CHECK( Catch::Text( testString, TextAttributes().setWidth( 3 ) ).toString() == "one\ntwo\nth-\nree\nfo-\nur" ); + } + SECTION( "As container", "" ) { + Catch::Text text( testString, TextAttributes().setWidth( 6 ) ); + REQUIRE( text.size() == 4 ); + CHECK( text[0] == "one" ); + CHECK( text[1] == "two" ); + CHECK( text[2] == "three" ); + CHECK( text[3] == "four" ); + } + SECTION( "Indent first line differently", "" ) { + Catch::Text text( testString, TextAttributes() + .setWidth( 10 ) + .setIndent( 4 ) + .setInitialIndent( 1 ) ); + CHECK( text.toString() == " one two\n three\n four" ); + } + + } + + SECTION( "With newlines", "" ) { + + // guide: 1234567890123456789 + std::string testString = "one two\nthree four"; + + SECTION( "No wrapping" , "" ) { + CHECK( Catch::Text( testString, TextAttributes().setWidth( 80 ) ).toString() == testString ); + CHECK( Catch::Text( testString, TextAttributes().setWidth( 18 ) ).toString() == testString ); + CHECK( Catch::Text( testString, TextAttributes().setWidth( 10 ) ).toString() == testString ); + } + SECTION( "Trailing newline" , "" ) { + CHECK( Catch::Text( "abcdef\n", TextAttributes().setWidth( 10 ) ).toString() == "abcdef\n" ); + CHECK( Catch::Text( "abcdef", TextAttributes().setWidth( 6 ) ).toString() == "abcdef" ); + CHECK( Catch::Text( "abcdef\n", TextAttributes().setWidth( 6 ) ).toString() == "abcdef\n" ); + } + SECTION( "Wrapped once", "" ) { + CHECK( Catch::Text( testString, TextAttributes().setWidth( 9 ) ).toString() == "one two\nthree\nfour" ); + CHECK( Catch::Text( testString, TextAttributes().setWidth( 8 ) ).toString() == "one two\nthree\nfour" ); + CHECK( Catch::Text( testString, TextAttributes().setWidth( 7 ) ).toString() == "one two\nthree\nfour" ); + } + SECTION( "Wrapped twice", "" ) { + CHECK( Catch::Text( testString, TextAttributes().setWidth( 6 ) ).toString() == "one\ntwo\nthree\nfour" ); + } + } + + SECTION( "With tabs", "" ) { + + // guide: 1234567890123456789 + std::string testString = "one two \tthree four five six"; + + CHECK( Catch::Text( testString, TextAttributes().setWidth( 15 ) ).toString() + == "one two three\n four\n five\n six" ); + } + + +} + +using namespace Catch; + +class ColourString { +public: + + struct ColourIndex { + ColourIndex( Colour::Code _colour, std::size_t _fromIndex, std::size_t _toIndex ) + : colour( _colour ), + fromIndex( _fromIndex ), + toIndex( _toIndex ) + {} + + Colour::Code colour; + std::size_t fromIndex; + std::size_t toIndex; + }; + + ColourString( std::string const& _string ) + : string( _string ) + {} + ColourString( std::string const& _string, std::vector const& _colours ) + : string( _string ), colours( _colours ) + {} + + ColourString& addColour( Colour::Code colour, int _index ) { + colours.push_back( ColourIndex( colour, + resolveRelativeIndex( _index ), + resolveRelativeIndex( _index )+1 ) ); + return *this; + } + ColourString& addColour( Colour::Code colour, int _fromIndex, int _toIndex ) { + colours.push_back( ColourIndex( colour, + resolveRelativeIndex(_fromIndex), + resolveLastRelativeIndex( _toIndex ) ) ); + return *this; + } + + void writeToStream( std::ostream& _stream ) const { + std::size_t last = 0; + for( std::size_t i = 0; i < colours.size(); ++i ) { + ColourIndex const& index = colours[i]; + if( index.fromIndex > last ) + _stream << string.substr( last, index.fromIndex-last ); + { + Colour colourGuard( index.colour ); + _stream << string.substr( index.fromIndex, index.toIndex-index.fromIndex ); + } + last = index.toIndex; + } + if( last < string.size() ) + _stream << string.substr( last ); + } + friend std::ostream& operator << ( std::ostream& _stream, ColourString const& _colourString ) { + _colourString.writeToStream( _stream ); + return _stream; + } + +private: + + std::size_t resolveLastRelativeIndex( int _index ) { + std::size_t index = resolveRelativeIndex( _index ); + return index == 0 ? string.size() : index; + } + std::size_t resolveRelativeIndex( int _index ) { + return static_cast( _index >= 0 + ? _index + : static_cast( string.size() )+_index ); + } + std::string string; + std::vector colours; +}; + +// !TBD: This will be folded into Text class +TEST_CASE( "Strings can be rendered with colour", "[colour]" ) { + + { + ColourString cs( "hello" ); + cs .addColour( Colour::Red, 0 ) + .addColour( Colour::Green, -1 ); + + std::cout << cs << std::endl; + } + + { + ColourString cs( "hello" ); + cs .addColour( Colour::Blue, 1, -2 ); + + std::cout << cs << std::endl; + } + +} + +TEST_CASE( "Text can be formatted using the Text class", "" ) { + + CHECK( Catch::Text( "hi there" ).toString() == "hi there" ); + + TextAttributes narrow; + narrow.setWidth( 6 ); + + CHECK( Catch::Text( "hi there", narrow ).toString() == "hi\nthere" ); +} + +TEST_CASE( "Long text is truncted", "[Text][Truncated]" ) { + + std::string longLine( 90, '*' ); + + std::ostringstream oss; + for(int i = 0; i < 600; ++i ) + oss << longLine << longLine << "\n"; + Catch::Text t( oss.str() ); + CHECK_THAT( t.toString(), EndsWith( "... message truncated due to excessive size" ) ); + +} diff --git a/single_include_projects/SelfTest/TrickyTests.cpp b/single_include_projects/SelfTest/TrickyTests.cpp new file mode 100644 index 00000000..d30ff429 --- /dev/null +++ b/single_include_projects/SelfTest/TrickyTests.cpp @@ -0,0 +1,402 @@ +/* + * Created by Phil on 09/11/2010. + * Copyright 2010 Two Blue Cubes Ltd. All rights reserved. + * + * Distributed under the Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + */ + +#ifdef __clang__ +#pragma clang diagnostic ignored "-Wpadded" +#endif + +#include "catch.hpp" + +namespace Catch +{ + template<> + std::string toString >( const std::pair& value ) + { + std::ostringstream oss; + oss << "std::pair( " << value.first << ", " << value.second << " )"; + return oss.str(); + + } +} + +namespace TrickyTests +{ + /////////////////////////////////////////////////////////////////////////////// + TEST_CASE + ( + "Parsing a std::pair", + "[Tricky][std::pair]" + ) + { + std::pair aNicePair( 1, 2 ); + + REQUIRE( (std::pair( 1, 2 )) == aNicePair ); + } + + /////////////////////////////////////////////////////////////////////////////// + TEST_CASE + ( + "Where the is more to the expression after the RHS[failing]", + "[Tricky][failing][.]" + ) + { + // int a = 1, b = 2; + // REQUIRE( a == 2 || b == 2 ); + WARN( "Uncomment the code in this test to check that it gives a sensible compiler error" ); + } + /////////////////////////////////////////////////////////////////////////////// + TEST_CASE + ( + "Where the LHS is not a simple value[failing]", + "[Tricky][failing][.]" + ) + { + /* + int a = 1; + int b = 2; + + // This only captures part of the expression, but issues a warning about the rest + REQUIRE( a+1 == b-1 ); + */ + WARN( "Uncomment the code in this test to check that it gives a sensible compiler error" ); + } + + struct Opaque + { + int val; + bool operator ==( const Opaque& o ) const + { + return val == o.val; + } + }; + + /////////////////////////////////////////////////////////////////////////////// + TEST_CASE + ( + "A failing expression with a non streamable type is still captured[failing]", + "[Tricky][failing][.]" + ) + { + + Opaque o1, o2; + o1.val = 7; + o2.val = 8; + + CHECK( &o1 == &o2 ); + CHECK( o1 == o2 ); + } + + /////////////////////////////////////////////////////////////////////////////// + TEST_CASE + ( + "string literals of different sizes can be compared[failing]", + "[Tricky][failing][.]" + ) + { + REQUIRE( std::string( "first" ) == "second" ); + + } + + /////////////////////////////////////////////////////////////////////////////// + TEST_CASE + ( + "An expression with side-effects should only be evaluated once", + "[Tricky]" + ) + { + int i = 7; + + REQUIRE( i++ == 7 ); + REQUIRE( i++ == 8 ); + + } +} + +namespace A { + struct X + { + X() : a(4), b(2), c(7) {} + X(int v) : a(v), b(2), c(7) {} + int a; + int b; + int c; + }; +} + +namespace B { + struct Y + { + Y() : a(4), b(2), c(7) {} + Y(int v) : a(v), b(2), c(7) {} + int a; + int b; + int c; + }; +} + +inline bool operator==(const A::X& lhs, const B::Y& rhs) +{ + return (lhs.a == rhs.a); +} + +inline bool operator==(const B::Y& lhs, const A::X& rhs) +{ + return (lhs.a == rhs.a); +} + + +/////////////////////////////////////////////////////////////////////////////// +/* This, currently, does not compile with LLVM +TEST_CASE +( + "Operators at different namespace levels not hijacked by Koenig lookup" + "[Tricky]" +) +{ + A::X x; + B::Y y; + REQUIRE( x == y ); +} +*/ + +namespace ObjectWithConversions +{ + struct Object + { + operator unsigned int() {return 0xc0000000;} + }; + + /////////////////////////////////////////////////////////////////////////////// + TEST_CASE + ( + "Operators at different namespace levels not hijacked by Koenig lookup", + "[Tricky]" + ) + { + Object o; + REQUIRE(0xc0000000 == o ); + } +} + +namespace ObjectWithNonConstEqualityOperator +{ + struct Test + { + Test( unsigned int v ) + : m_value(v) + {} + + bool operator==( const Test&rhs ) + { + return (m_value == rhs.m_value); + } + bool operator==( const Test&rhs ) const + { + return (m_value != rhs.m_value); + } + unsigned int m_value; + }; + + TEST_CASE("Demonstrate that a non-const == is not used", "[Tricky]" ) + { + Test t( 1 ); + REQUIRE( t == 1u ); + } +} + +namespace TrickyTests +{ + namespace EnumBitFieldTests + { + enum Bits {bit0 = 0x0001, bit1 = 0x0002, bit2 = 0x0004, bit3 = 0x0008, bit1and2 = 0x0006, + bit30 = 0x40000000, bit31 = 0x80000000, + bit30and31 = 0xc0000000}; + + TEST_CASE( "Test enum bit values", "[Tricky]" ) + { + REQUIRE( 0xc0000000 == bit30and31 ); + } + } + + struct Obj + { + Obj():prop(&p){} + + int p; + int* prop; + }; + + TEST_CASE("boolean member", "[Tricky]") + { + Obj obj; + REQUIRE( obj.prop != NULL ); + } + + // Tests for a problem submitted by Ralph McArdell + // + // The static bool value should not need to be defined outside the + // struct it is declared in - but when evaluating it in a deduced + // context it appears to require the extra definition. + // The issue was fixed by adding bool overloads to bypass the + // templates that were there to deduce it. + template + struct is_true + { + static const bool value = B; + }; + + TEST_CASE( "(unimplemented) static bools can be evaluated", "[Tricky]" ) + { + SECTION("compare to true","") + { + REQUIRE( is_true::value == true ); + REQUIRE( true == is_true::value ); + } + SECTION("compare to false","") + { + REQUIRE( is_true::value == false ); + REQUIRE( false == is_true::value ); + } + + SECTION("negation", "") + { + REQUIRE( !is_true::value ); + } + + SECTION("double negation","") + { + REQUIRE( !!is_true::value ); + } + + SECTION("direct","") + { + REQUIRE( is_true::value ); + REQUIRE_FALSE( is_true::value ); + } + } + + // Uncomment these tests to produce an error at test registration time + /* + TEST_CASE( "Tests with the same name are not allowed", "[Tricky]" ) + { + + } + TEST_CASE( "Tests with the same name are not allowed", "[Tricky]" ) + { + + } + */ + + struct Boolable + { + explicit Boolable( bool value ) : m_value( value ) {} + + operator Catch::SafeBool::type() const { + return Catch::SafeBool::makeSafe( m_value ); + } + + bool m_value; + }; + + TEST_CASE( "Objects that evaluated in boolean contexts can be checked", "[Tricky][SafeBool]" ) + { + Boolable True( true ); + Boolable False( false ); + + CHECK( True ); + CHECK( !False ); + CHECK_FALSE( False ); + } + + TEST_CASE( "Assertions then sections", "[Tricky]" ) + { + // This was causing a failure due to the way the console reporter was handling + // the current section + + REQUIRE( Catch::isTrue( true ) ); + + SECTION( "A section", "" ) + { + REQUIRE( Catch::isTrue( true ) ); + + SECTION( "Another section", "" ) + { + REQUIRE( Catch::isTrue( true ) ); + } + SECTION( "Another other section", "" ) + { + REQUIRE( Catch::isTrue( true ) ); + } + } + } + + struct Awkward + { + operator int() const { return 7; } + }; + + TEST_CASE( "non streamable - with conv. op", "[Tricky]" ) + { + Awkward awkward; + std::string s = Catch::toString( awkward ); + REQUIRE( s == "7" ); + } + + inline void foo() {} + + typedef void (*fooptr_t)(); + + TEST_CASE( "Comparing function pointers", "[Tricky][function pointer]" ) + { + // This was giving a warning in VS2010 + // #179 + fooptr_t a = foo; + + REQUIRE( a ); + REQUIRE( a == &foo ); + } + + struct S + { + void f() {} + }; + + + TEST_CASE( "Comparing member function pointers", "[Tricky][member function pointer]" ) + { + typedef void (S::*MF)(); + MF m = &S::f; + + CHECK( m == &S::f ); + } + + class ClassName {}; + + TEST_CASE( "pointer to class", "[Tricky]" ) + { + ClassName *p = 0; + REQUIRE( p == 0 ); + } + + #ifdef CATCH_CONFIG_CPP11_NULLPTR + + #include + + TEST_CASE( "null_ptr", "[Tricky]" ) + { + std::unique_ptr ptr; + REQUIRE(ptr.get() == nullptr); + } + + #endif + + TEST_CASE( "X/level/0/a", "[Tricky]" ) { SUCCEED(""); } + TEST_CASE( "X/level/0/b", "[Tricky][fizz]" ){ SUCCEED(""); } + TEST_CASE( "X/level/1/a", "[Tricky]" ) { SUCCEED(""); } + TEST_CASE( "X/level/1/b", "[Tricky]" ) { SUCCEED(""); } +} diff --git a/single_include_projects/SelfTest/VariadicMacrosTests.cpp b/single_include_projects/SelfTest/VariadicMacrosTests.cpp new file mode 100644 index 00000000..d680432e --- /dev/null +++ b/single_include_projects/SelfTest/VariadicMacrosTests.cpp @@ -0,0 +1,34 @@ +/* + * Created by Phil on 15/03/2013. + * Copyright 2013 Two Blue Cubes Ltd. All rights reserved. + * + * Distributed under the Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + */ + +#include "catch.hpp" + +#ifdef CATCH_CONFIG_VARIADIC_MACROS + +namespace VariadicMacroTests +{ + TEST_CASE() + { + SUCCEED( "anonymous test case" ); + } + + TEST_CASE( "Test case with one argument" ) + { + SUCCEED( "no assertions" ); + } + + TEST_CASE( "Variadic macros", "[variadic][sections]" ) + { + SECTION( "Section with one argument" ) + { + SUCCEED( "no assertions" ); + } + } +} + +#endif diff --git a/single_include_projects/SelfTest/VisualStudioConfigTests.cpp b/single_include_projects/SelfTest/VisualStudioConfigTests.cpp new file mode 100644 index 00000000..6a771164 --- /dev/null +++ b/single_include_projects/SelfTest/VisualStudioConfigTests.cpp @@ -0,0 +1,107 @@ +/* + * Created by Phil on 22/10/2010. + * Copyright 2010 Two Blue Cubes Ltd + * + * Distributed under the Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + */ + +#include "catch.hpp" + +#if defined(INTERNAL_CATCH_VS_MANAGED) || defined(INTERNAL_CATCH_VS_NATIVE) + +namespace VisualStudioConfigTests +{ + struct Z1 {}; + TEST_CASE("VSRequire 1, initial config defaults are set", "[vs]") + { + CatchOverrides::ConfigReset guard("VisualStudioConfigTests.cpp",0, 1); + REQUIRE(!CatchOverrides::Config::instance().includeSuccessfulResults("VisualStudioConfigTests.cpp",0)); + REQUIRE(!CatchOverrides::Config::instance().warnAboutMissingAssertions("VisualStudioConfigTests.cpp",0)); + REQUIRE(CatchOverrides::Config::instance().abortAfter("VisualStudioConfigTests.cpp",0) == 1); + std::vector tests = CatchOverrides::Config::instance().listOfTests("VisualStudioConfigTests.cpp",0); + REQUIRE(tests.empty()); + } + + struct Z2 {}; + TEST_CASE("VSRequire 2, initial config defaults are overridden", "[vs]") + { + CatchOverrides::ConfigShowSuccessfulTests isr1("VisualStudioConfigTests.cpp",0, true); + CatchOverrides::ConfigWarnMissingAssertions wma1("VisualStudioConfigTests.cpp",0, true); + CatchOverrides::ConfigAbortAfter aa1("VisualStudioConfigTests.cpp",0, 42); + CatchOverrides::ConfigAddTest at1("VisualStudioConfigTests.cpp",0,"T1"); + CatchOverrides::ConfigReset guard("VisualStudioConfigTests.cpp",0, 1); + REQUIRE(CatchOverrides::Config::instance().includeSuccessfulResults("VisualStudioConfigTests.cpp",0)); + REQUIRE(CatchOverrides::Config::instance().warnAboutMissingAssertions("VisualStudioConfigTests.cpp",0)); + REQUIRE(CatchOverrides::Config::instance().abortAfter("VisualStudioConfigTests.cpp",0) == 42); + std::vector tests = CatchOverrides::Config::instance().listOfTests("VisualStudioConfigTests.cpp",0); + REQUIRE(tests.size() == 1); + REQUIRE(tests[0] == "T1"); + } + + struct Z3 {}; + TEST_CASE("VSRequire 3, initial config defaults are reset", "[vs]") + { + CatchOverrides::ConfigShowSuccessfulTests isr1("VisualStudioConfigTests.cpp",0, true); + CatchOverrides::ConfigWarnMissingAssertions wma1("VisualStudioConfigTests.cpp",0, true); + CatchOverrides::ConfigAbortAfter aa1("VisualStudioConfigTests.cpp",0, 42); + CatchOverrides::ConfigAddTest at1("VisualStudioConfigTests.cpp",0,"T1"); + CatchOverrides::ConfigReset guard0("VisualStudioConfigTests.cpp",0, 1); + CatchOverrides::ConfigReset guard1("VisualStudioConfigTests.cpp",1, 1); + REQUIRE(CatchOverrides::Config::instance().includeSuccessfulResults("VisualStudioConfigTests.cpp",0)); + REQUIRE(CatchOverrides::Config::instance().warnAboutMissingAssertions("VisualStudioConfigTests.cpp",0)); + REQUIRE(CatchOverrides::Config::instance().abortAfter("VisualStudioConfigTests.cpp",0) == 42); + std::vector tests = CatchOverrides::Config::instance().listOfTests("VisualStudioConfigTests.cpp",0); + REQUIRE(tests.size() == 1); + REQUIRE(tests[0] == "T1"); + + REQUIRE(!CatchOverrides::Config::instance().includeSuccessfulResults("VisualStudioConfigTests.cpp",1)); + REQUIRE(!CatchOverrides::Config::instance().warnAboutMissingAssertions("VisualStudioConfigTests.cpp",1)); + REQUIRE(CatchOverrides::Config::instance().abortAfter("VisualStudioConfigTests.cpp",1) == 1); + tests = CatchOverrides::Config::instance().listOfTests("VisualStudioConfigTests.cpp",1); + REQUIRE(tests.empty()); + } + + struct Z7 {}; + TEST_CASE("VSRequire 7, initial multi-line list config gets all values", "[vs]") + { + CatchOverrides::ConfigAddTest a1("VisualStudioConfigTests.cpp",0,"T1"); + CatchOverrides::ConfigAddTest a2("VisualStudioConfigTests.cpp",0,"T2"); + CatchOverrides::ConfigAddTest a3("VisualStudioConfigTests.cpp",0,"T3"); + CatchOverrides::ConfigReset guard0("VisualStudioConfigTests.cpp",0, 1); + CatchOverrides::ConfigReset guard1("VisualStudioConfigTests.cpp",1, 1); + + std::vector tests = CatchOverrides::Config::instance().listOfTests("VisualStudioConfigTests.cpp",0); + REQUIRE(tests.size() == 3); + REQUIRE(tests[0] == "T1"); + REQUIRE(tests[1] == "T2"); + REQUIRE(tests[2] == "T3"); + tests = CatchOverrides::Config::instance().listOfTests("VisualStudioConfigTests.cpp",1); + REQUIRE(tests.empty()); + } + + struct Z8 {}; + TEST_CASE("VSRequire 8, initial incrementing 'line' sets values", "[vs]") + { + CatchOverrides::ConfigShowSuccessfulTests isr1("VisualStudioConfigTests.cpp",0, true); + CatchOverrides::ConfigWarnMissingAssertions wma1("VisualStudioConfigTests.cpp",1, true); + CatchOverrides::ConfigAbortAfter aa1("VisualStudioConfigTests.cpp",2, 42); + CatchOverrides::ConfigAddTest at1("VisualStudioConfigTests.cpp",3,"T1"); + CatchOverrides::ConfigReset guard0("VisualStudioConfigTests.cpp",4, 1); + CatchOverrides::ConfigReset guard1("VisualStudioConfigTests.cpp",5, 1); + REQUIRE(CatchOverrides::Config::instance().includeSuccessfulResults("VisualStudioConfigTests.cpp",4)); + REQUIRE(CatchOverrides::Config::instance().warnAboutMissingAssertions("VisualStudioConfigTests.cpp",4)); + REQUIRE(CatchOverrides::Config::instance().abortAfter("VisualStudioConfigTests.cpp",4) == 42); + std::vector tests = CatchOverrides::Config::instance().listOfTests("VisualStudioConfigTests.cpp",4); + REQUIRE(tests.size() == 1); + REQUIRE(tests[0] == "T1"); + + REQUIRE(!CatchOverrides::Config::instance().includeSuccessfulResults("VisualStudioConfigTests.cpp",5)); + REQUIRE(!CatchOverrides::Config::instance().warnAboutMissingAssertions("VisualStudioConfigTests.cpp",5)); + REQUIRE(CatchOverrides::Config::instance().abortAfter("VisualStudioConfigTests.cpp",5) == 1); + tests = CatchOverrides::Config::instance().listOfTests("VisualStudioConfigTests.cpp",5); + REQUIRE(tests.empty()); + } + +} +#endif diff --git a/single_include_projects/SelfTest/VisualStudioTests.cpp b/single_include_projects/SelfTest/VisualStudioTests.cpp new file mode 100644 index 00000000..063fb704 --- /dev/null +++ b/single_include_projects/SelfTest/VisualStudioTests.cpp @@ -0,0 +1,112 @@ +/* + * Created by Phil on 22/10/2010. + * Copyright 2010 Two Blue Cubes Ltd + * + * Distributed under the Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + */ + +#include "catch.hpp" + +#if defined(INTERNAL_CATCH_VS_MANAGED) || defined(INTERNAL_CATCH_VS_NATIVE) + +namespace VisualStudioTests +{ + class UniqueTestsFixture { + private: + static int uniqueID; + public: + UniqueTestsFixture() { } + protected: + int getID() { + return ++uniqueID; + } + }; + + int UniqueTestsFixture::uniqueID = 0; + TEST_CASE("M00", "[m_off][vs]") + { + bool show = Catch::getCurrentContext().getConfig()->includeSuccessfulResults(); + REQUIRE(!show); + int abortAfter = Catch::getCurrentContext().getConfig()->abortAfter(); + REQUIRE(abortAfter == 1); + } + + CATCH_CONFIG_SHOW_SUCCESS(true) + TEST_CASE("M01", "[m_on][vs]") + { + bool show = Catch::getCurrentContext().getConfig()->includeSuccessfulResults(); + REQUIRE(show); + } + + TEST_CASE("M02", "[m_off][vs]") + { + bool show = Catch::getCurrentContext().getConfig()->includeSuccessfulResults(); + REQUIRE(!show); + } + + TEST_CASE_METHOD(UniqueTestsFixture, "M10", "[m_off][vs]") + { + bool show = Catch::getCurrentContext().getConfig()->includeSuccessfulResults(); + REQUIRE(!show); + getID(); + } + + CATCH_CONFIG_WARN_MISSING_ASSERTIONS(true) + CATCH_CONFIG_SHOW_SUCCESS(true) + TEST_CASE_METHOD(UniqueTestsFixture, "M11", "[m_on][vs]") + { + bool show = Catch::getCurrentContext().getConfig()->includeSuccessfulResults(); + REQUIRE(show); + getID(); + } + + CATCH_CONFIG_WARN_MISSING_ASSERTIONS(true) + CATCH_CONFIG_SHOW_SUCCESS(true) + TEST_CASE_METHOD(UniqueTestsFixture, "M99", "[m_on][vs]") + { + bool show = Catch::getCurrentContext().getConfig()->includeSuccessfulResults(); + REQUIRE(show); + WARN("Warning message"); + getID(); + } + + TEST_CASE_METHOD(UniqueTestsFixture, "M12", "[m_off][vs]") + { + bool show = Catch::getCurrentContext().getConfig()->includeSuccessfulResults(); + REQUIRE(!show); + getID(); + } + + class ConfigTest + { + public: + void run1() + { + bool show = Catch::getCurrentContext().getConfig()->includeSuccessfulResults(); + REQUIRE(!show); + } + void run2() + { + bool show = Catch::getCurrentContext().getConfig()->includeSuccessfulResults(); + REQUIRE(show); + } + void run3() + { + bool show = Catch::getCurrentContext().getConfig()->includeSuccessfulResults(); + REQUIRE(!show); + } + }; + METHOD_AS_TEST_CASE(ConfigTest::run1,"M20", "[m_off][vs]"); + + CATCH_CONFIG_SHOW_SUCCESS(true) + METHOD_AS_TEST_CASE(ConfigTest::run2,"M21", "[m_on][vs]"); + + METHOD_AS_TEST_CASE(ConfigTest::run3,"M22", "[m_off][vs]"); + + CATCH_MAP_CATEGORY_TO_TAG(vstestsCheckOutputOff, "[m_off][vs]"); + CATCH_CONFIG_SHOW_SUCCESS(true) + CATCH_MAP_CATEGORY_TO_TAG(vstestsCheckOutputOn, "[m_on][vs]"); + CATCH_MAP_CATEGORY_TO_TAG(vstestsCheckOutputOff2, "[m_off][vs]"); +} +#endif diff --git a/single_include_projects/SelfTest/internal/clara.h b/single_include_projects/SelfTest/internal/clara.h new file mode 100644 index 00000000..5b79e04c --- /dev/null +++ b/single_include_projects/SelfTest/internal/clara.h @@ -0,0 +1,625 @@ +/* + * Created by Phil on 25/05/2013. + * Copyright 2013 Two Blue Cubes Ltd. All rights reserved. + * + * Distributed under the Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + */ + +// Only use header guard if we are not using an outer namespace +#ifndef CLICHE_CLARA_OUTER_NAMESPACE +# ifdef TWOBLUECUBES_CLARA_H_INCLUDED +# ifndef TWOBLUECUBES_CLARA_H_ALREADY_INCLUDED +# define TWOBLUECUBES_CLARA_H_ALREADY_INCLUDED +# endif +# else +# define TWOBLUECUBES_CLARA_H_INCLUDED +# endif +#endif +#ifndef TWOBLUECUBES_CLARA_H_ALREADY_INCLUDED + +#ifndef CLICHE_CLARA_OUTER_NAMESPACE +#define CLICHE_TBC_TEXT_FORMAT_OUTER_NAMESPACE Clara +#include "tbc_text_format.h" +#undef CLICHE_TBC_TEXT_FORMAT_OUTER_NAMESPACE +#endif + +#include +#include +#include +#include +#include +#include + +// Use optional outer namespace +#ifdef CLICHE_CLARA_OUTER_NAMESPACE +namespace CLICHE_CLARA_OUTER_NAMESPACE { +#endif + +namespace Clara { + namespace Detail { + +#ifdef CLARA_CONSOLE_WIDTH + const unsigned int consoleWidth = CLARA_CONFIG_CONSOLE_WIDTH; +#else + const unsigned int consoleWidth = 80; +#endif + + using namespace Tbc; + + template struct RemoveConstRef{ typedef T type; }; + template struct RemoveConstRef{ typedef T type; }; + template struct RemoveConstRef{ typedef T type; }; + template struct RemoveConstRef{ typedef T type; }; + + template struct IsBool { static const bool value = false; }; + template<> struct IsBool { static const bool value = true; }; + + template + void convertInto( std::string const& _source, T& _dest ) { + std::stringstream ss; + ss << _source; + ss >> _dest; + if( ss.fail() ) + throw std::runtime_error( "Unable to convert " + _source + " to destination type" ); + } + inline void convertInto( std::string const& _source, std::string& _dest ) { + _dest = _source; + } + inline void convertInto( std::string const& _source, bool& _dest ) { + std::string sourceLC = _source; + std::transform( sourceLC.begin(), sourceLC.end(), sourceLC.begin(), ::tolower ); + if( sourceLC == "y" || sourceLC == "1" || sourceLC == "true" || sourceLC == "yes" || sourceLC == "on" ) + _dest = true; + else if( sourceLC == "n" || sourceLC == "0" || sourceLC == "false" || sourceLC == "no" || sourceLC == "off" ) + _dest = false; + else + throw std::runtime_error( "Expected a boolean value but did not recognise:\n '" + _source + "'" ); + } + inline void convertInto( bool _source, bool& _dest ) { + _dest = _source; + } + template + inline void convertInto( bool, T& ) { + throw std::runtime_error( "Invalid conversion" ); + } + + template + struct IArgFunction { + virtual ~IArgFunction() {} + virtual void set( ConfigT& config, std::string const& value ) const = 0; + virtual void setFlag( ConfigT& config ) const = 0; + virtual bool takesArg() const = 0; + virtual IArgFunction* clone() const = 0; + }; + + template + class BoundArgFunction { + public: + BoundArgFunction( IArgFunction* _functionObj ) : functionObj( _functionObj ) {} + BoundArgFunction( BoundArgFunction const& other ) : functionObj( other.functionObj->clone() ) {} + BoundArgFunction& operator = ( BoundArgFunction const& other ) { + IArgFunction* newFunctionObj = other.functionObj->clone(); + delete functionObj; + functionObj = newFunctionObj; + return *this; + } + ~BoundArgFunction() { delete functionObj; } + + void set( ConfigT& config, std::string const& value ) const { + functionObj->set( config, value ); + } + void setFlag( ConfigT& config ) const { + functionObj->setFlag( config ); + } + bool takesArg() const { return functionObj->takesArg(); } + private: + IArgFunction* functionObj; + }; + + + template + struct NullBinder : IArgFunction{ + virtual void set( C&, std::string const& ) const {} + virtual void setFlag( C& ) const {} + virtual bool takesArg() const { return true; } + virtual IArgFunction* clone() const { return new NullBinder( *this ); } + }; + + template + struct BoundDataMember : IArgFunction{ + BoundDataMember( M C::* _member ) : member( _member ) {} + virtual void set( C& p, std::string const& stringValue ) const { + convertInto( stringValue, p.*member ); + } + virtual void setFlag( C& p ) const { + convertInto( true, p.*member ); + } + virtual bool takesArg() const { return !IsBool::value; } + virtual IArgFunction* clone() const { return new BoundDataMember( *this ); } + M C::* member; + }; + template + struct BoundUnaryMethod : IArgFunction{ + BoundUnaryMethod( void (C::*_member)( M ) ) : member( _member ) {} + virtual void set( C& p, std::string const& stringValue ) const { + typename RemoveConstRef::type value; + convertInto( stringValue, value ); + (p.*member)( value ); + } + virtual void setFlag( C& p ) const { + typename RemoveConstRef::type value; + convertInto( true, value ); + (p.*member)( value ); + } + virtual bool takesArg() const { return !IsBool::value; } + virtual IArgFunction* clone() const { return new BoundUnaryMethod( *this ); } + void (C::*member)( M ); + }; + template + struct BoundNullaryMethod : IArgFunction{ + BoundNullaryMethod( void (C::*_member)() ) : member( _member ) {} + virtual void set( C& p, std::string const& stringValue ) const { + bool value; + convertInto( stringValue, value ); + if( value ) + (p.*member)(); + } + virtual void setFlag( C& p ) const { + (p.*member)(); + } + virtual bool takesArg() const { return false; } + virtual IArgFunction* clone() const { return new BoundNullaryMethod( *this ); } + void (C::*member)(); + }; + + template + struct BoundUnaryFunction : IArgFunction{ + BoundUnaryFunction( void (*_function)( C& ) ) : function( _function ) {} + virtual void set( C& obj, std::string const& stringValue ) const { + bool value; + convertInto( stringValue, value ); + if( value ) + function( obj ); + } + virtual void setFlag( C& p ) const { + function( p ); + } + virtual bool takesArg() const { return false; } + virtual IArgFunction* clone() const { return new BoundUnaryFunction( *this ); } + void (*function)( C& ); + }; + + template + struct BoundBinaryFunction : IArgFunction{ + BoundBinaryFunction( void (*_function)( C&, T ) ) : function( _function ) {} + virtual void set( C& obj, std::string const& stringValue ) const { + typename RemoveConstRef::type value; + convertInto( stringValue, value ); + function( obj, value ); + } + virtual void setFlag( C& obj ) const { + typename RemoveConstRef::type value; + convertInto( true, value ); + function( obj, value ); + } + virtual bool takesArg() const { return !IsBool::value; } + virtual IArgFunction* clone() const { return new BoundBinaryFunction( *this ); } + void (*function)( C&, T ); + }; + + template + BoundArgFunction makeBoundField( M C::* _member ) { + return BoundArgFunction( new BoundDataMember( _member ) ); + } + template + BoundArgFunction makeBoundField( void (C::*_member)( M ) ) { + return BoundArgFunction( new BoundUnaryMethod( _member ) ); + } + template + BoundArgFunction makeBoundField( void (C::*_member)() ) { + return BoundArgFunction( new BoundNullaryMethod( _member ) ); + } + template + BoundArgFunction makeBoundField( void (*_function)( C& ) ) { + return BoundArgFunction( new BoundUnaryFunction( _function ) ); + } + template + BoundArgFunction makeBoundField( void (*_function)( C&, T ) ) { + return BoundArgFunction( new BoundBinaryFunction( _function ) ); + } + } // namespace Detail + + struct Parser { + Parser() : separators( " \t=:" ) {} + + struct Token { + enum Type { Positional, ShortOpt, LongOpt }; + Token( Type _type, std::string const& _data ) : type( _type ), data( _data ) {} + Type type; + std::string data; + }; + + void parseIntoTokens( int argc, char const * const * argv, std::vector& tokens ) const { + const std::string doubleDash = "--"; + for( int i = 1; i < argc && argv[i] != doubleDash; ++i ) + parseIntoTokens( argv[i] , tokens); + } + void parseIntoTokens( std::string arg, std::vector& tokens ) const { + while( !arg.empty() ) { + Parser::Token token( Parser::Token::Positional, arg ); + arg = ""; + if( token.data[0] == '-' ) { + if( token.data.size() > 1 && token.data[1] == '-' ) { + token = Parser::Token( Parser::Token::LongOpt, token.data.substr( 2 ) ); + } + else { + token = Parser::Token( Parser::Token::ShortOpt, token.data.substr( 1 ) ); + if( token.data.size() > 1 && separators.find( token.data[1] ) == std::string::npos ) { + arg = "-" + token.data.substr( 1 ); + token.data = token.data.substr( 0, 1 ); + } + } + } + if( token.type != Parser::Token::Positional ) { + std::size_t pos = token.data.find_first_of( separators ); + if( pos != std::string::npos ) { + arg = token.data.substr( pos+1 ); + token.data = token.data.substr( 0, pos ); + } + } + tokens.push_back( token ); + } + } + std::string separators; + }; + + template + class CommandLine { + + struct Arg { + Arg( Detail::BoundArgFunction const& _boundField ) : boundField( _boundField ), position( -1 ) {} + + bool hasShortName( std::string const& shortName ) const { + for( std::vector::const_iterator + it = shortNames.begin(), itEnd = shortNames.end(); + it != itEnd; + ++it ) + if( *it == shortName ) + return true; + return false; + } + bool hasLongName( std::string const& _longName ) const { + return _longName == longName; + } + bool takesArg() const { + return !hint.empty(); + } + bool isFixedPositional() const { + return position != -1; + } + bool isAnyPositional() const { + return position == -1 && shortNames.empty() && longName.empty(); + } + std::string dbgName() const { + if( !longName.empty() ) + return "--" + longName; + if( !shortNames.empty() ) + return "-" + shortNames[0]; + return "positional args"; + } + void validate() const { + if( boundField.takesArg() && !takesArg() ) + throw std::logic_error( dbgName() + " must specify an arg name" ); + } + std::string commands() const { + std::ostringstream oss; + bool first = true; + std::vector::const_iterator it = shortNames.begin(), itEnd = shortNames.end(); + for(; it != itEnd; ++it ) { + if( first ) + first = false; + else + oss << ", "; + oss << "-" << *it; + } + if( !longName.empty() ) { + if( !first ) + oss << ", "; + oss << "--" << longName; + } + if( !hint.empty() ) + oss << " <" << hint << ">"; + return oss.str(); + } + + Detail::BoundArgFunction boundField; + std::vector shortNames; + std::string longName; + std::string description; + std::string hint; + int position; + }; + + // NOTE: std::auto_ptr is deprecated in c++11/c++0x +#if defined(__cplusplus) && __cplusplus > 199711L + typedef std::unique_ptr ArgAutoPtr; +#else + typedef std::auto_ptr ArgAutoPtr; +#endif + + class ArgBinder { + public: + template + ArgBinder( CommandLine* cl, F f ) + : m_cl( cl ), + m_arg( Detail::makeBoundField( f ) ) + {} + ArgBinder( ArgBinder& other ) + : m_cl( other.m_cl ), + m_arg( other.m_arg ) + { + other.m_cl = NULL; + } + ~ArgBinder() { + if( m_cl ) { + m_arg.validate(); + if( m_arg.isFixedPositional() ) { + m_cl->m_positionalArgs.insert( std::make_pair( m_arg.position, m_arg ) ); + if( m_arg.position > m_cl->m_highestSpecifiedArgPosition ) + m_cl->m_highestSpecifiedArgPosition = m_arg.position; + } + else if( m_arg.isAnyPositional() ) { + if( m_cl->m_arg.get() ) + throw std::logic_error( "Only one unpositional argument can be added" ); + m_cl->m_arg = ArgAutoPtr( new Arg( m_arg ) ); + } + else + m_cl->m_options.push_back( m_arg ); + } + } + ArgBinder& shortOpt( std::string const& name ) { + m_arg.shortNames.push_back( name ); + return *this; + } + ArgBinder& longOpt( std::string const& name ) { + m_arg.longName = name; + return *this; + } + ArgBinder& describe( std::string const& description ) { + m_arg.description = description; + return *this; + } + ArgBinder& hint( std::string const& hint ) { + m_arg.hint = hint; + return *this; + } + ArgBinder& position( int position ) { + m_arg.position = position; + return *this; + } + private: + CommandLine* m_cl; + Arg m_arg; + }; + + public: + + CommandLine() + : m_boundProcessName( new Detail::NullBinder() ), + m_highestSpecifiedArgPosition( 0 ), + m_throwOnUnrecognisedTokens( false ) + {} + CommandLine( CommandLine const& other ) + : m_boundProcessName( other.m_boundProcessName ), + m_options ( other.m_options ), + m_positionalArgs( other.m_positionalArgs ), + m_highestSpecifiedArgPosition( other.m_highestSpecifiedArgPosition ), + m_throwOnUnrecognisedTokens( other.m_throwOnUnrecognisedTokens ) + { + if( other.m_arg.get() ) + m_arg = ArgAutoPtr( new Arg( *other.m_arg ) ); + } + + CommandLine& setThrowOnUnrecognisedTokens( bool shouldThrow = true ) { + m_throwOnUnrecognisedTokens = shouldThrow; + return *this; + } + + template + ArgBinder bind( F f ) { + ArgBinder binder( this, f ); + return binder; + } + template + void bindProcessName( F f ) { + m_boundProcessName = Detail::makeBoundField( f ); + } + + void optUsage( std::ostream& os, std::size_t indent = 0, std::size_t width = Detail::consoleWidth ) const { + typename std::vector::const_iterator itBegin = m_options.begin(), itEnd = m_options.end(), it; + std::size_t maxWidth = 0; + for( it = itBegin; it != itEnd; ++it ) + maxWidth = (std::max)( maxWidth, it->commands().size() ); + + for( it = itBegin; it != itEnd; ++it ) { + Detail::Text usage( it->commands(), Detail::TextAttributes() + .setWidth( maxWidth+indent ) + .setIndent( indent ) ); + // !TBD handle longer usage strings + Detail::Text desc( it->description, Detail::TextAttributes() + .setWidth( width - maxWidth -3 ) ); + + for( std::size_t i = 0; i < (std::max)( usage.size(), desc.size() ); ++i ) { + std::string usageCol = i < usage.size() ? usage[i] : ""; + os << usageCol; + + if( i < desc.size() && !desc[i].empty() ) + os << std::string( indent + 2 + maxWidth - usageCol.size(), ' ' ) + << desc[i]; + os << "\n"; + } + } + } + std::string optUsage() const { + std::ostringstream oss; + optUsage( oss ); + return oss.str(); + } + + void argSynopsis( std::ostream& os ) const { + for( int i = 1; i <= m_highestSpecifiedArgPosition; ++i ) { + if( i > 1 ) + os << " "; + typename std::map::const_iterator it = m_positionalArgs.find( i ); + if( it != m_positionalArgs.end() ) + os << "<" << it->second.hint << ">"; + else if( m_arg.get() ) + os << "<" << m_arg->hint << ">"; + else + throw std::logic_error( "non consecutive positional arguments with no floating args" ); + } + // !TBD No indication of mandatory args + if( m_arg.get() ) { + if( m_highestSpecifiedArgPosition > 1 ) + os << " "; + os << "[<" << m_arg->hint << "> ...]"; + } + } + std::string argSynopsis() const { + std::ostringstream oss; + argSynopsis( oss ); + return oss.str(); + } + + void usage( std::ostream& os, std::string const& procName ) const { + os << "usage:\n " << procName << " "; + argSynopsis( os ); + if( !m_options.empty() ) { + os << " [options]\n\nwhere options are: \n"; + optUsage( os, 2 ); + } + os << "\n"; + } + std::string usage( std::string const& procName ) const { + std::ostringstream oss; + usage( oss, procName ); + return oss.str(); + } + + std::vector parseInto( int argc, char const * const * argv, ConfigT& config ) const { + std::string processName = argv[0]; + std::size_t lastSlash = processName.find_last_of( "/\\" ); + if( lastSlash != std::string::npos ) + processName = processName.substr( lastSlash+1 ); + m_boundProcessName.set( config, processName ); + std::vector tokens; + Parser parser; + parser.parseIntoTokens( argc, argv, tokens ); + return populate( tokens, config ); + } + + std::vector populate( std::vector const& tokens, ConfigT& config ) const { + if( m_options.empty() && m_positionalArgs.empty() ) + throw std::logic_error( "No options or arguments specified" ); + + std::vector unusedTokens = populateOptions( tokens, config ); + unusedTokens = populateFixedArgs( unusedTokens, config ); + unusedTokens = populateFloatingArgs( unusedTokens, config ); + return unusedTokens; + } + + std::vector populateOptions( std::vector const& tokens, ConfigT& config ) const { + std::vector unusedTokens; + std::vector errors; + for( std::size_t i = 0; i < tokens.size(); ++i ) { + Parser::Token const& token = tokens[i]; + typename std::vector::const_iterator it = m_options.begin(), itEnd = m_options.end(); + for(; it != itEnd; ++it ) { + Arg const& arg = *it; + + try { + if( ( token.type == Parser::Token::ShortOpt && arg.hasShortName( token.data ) ) || + ( token.type == Parser::Token::LongOpt && arg.hasLongName( token.data ) ) ) { + if( arg.takesArg() ) { + if( i == tokens.size()-1 || tokens[i+1].type != Parser::Token::Positional ) + errors.push_back( "Expected argument to option: " + token.data ); + else + arg.boundField.set( config, tokens[++i].data ); + } + else { + arg.boundField.setFlag( config ); + } + break; + } + } + catch( std::exception& ex ) { + errors.push_back( std::string( ex.what() ) + "\n- while parsing: (" + arg.commands() + ")" ); + } + } + if( it == itEnd ) { + if( token.type == Parser::Token::Positional || !m_throwOnUnrecognisedTokens ) + unusedTokens.push_back( token ); + else if( m_throwOnUnrecognisedTokens ) + errors.push_back( "unrecognised option: " + token.data ); + } + } + if( !errors.empty() ) { + std::ostringstream oss; + for( std::vector::const_iterator it = errors.begin(), itEnd = errors.end(); + it != itEnd; + ++it ) { + if( it != errors.begin() ) + oss << "\n"; + oss << *it; + } + throw std::runtime_error( oss.str() ); + } + return unusedTokens; + } + std::vector populateFixedArgs( std::vector const& tokens, ConfigT& config ) const { + std::vector unusedTokens; + int position = 1; + for( std::size_t i = 0; i < tokens.size(); ++i ) { + Parser::Token const& token = tokens[i]; + typename std::map::const_iterator it = m_positionalArgs.find( position ); + if( it != m_positionalArgs.end() ) + it->second.boundField.set( config, token.data ); + else + unusedTokens.push_back( token ); + if( token.type == Parser::Token::Positional ) + position++; + } + return unusedTokens; + } + std::vector populateFloatingArgs( std::vector const& tokens, ConfigT& config ) const { + if( !m_arg.get() ) + return tokens; + std::vector unusedTokens; + for( std::size_t i = 0; i < tokens.size(); ++i ) { + Parser::Token const& token = tokens[i]; + if( token.type == Parser::Token::Positional ) + m_arg->boundField.set( config, token.data ); + else + unusedTokens.push_back( token ); + } + return unusedTokens; + } + + private: + Detail::BoundArgFunction m_boundProcessName; + std::vector m_options; + std::map m_positionalArgs; + ArgAutoPtr m_arg; + int m_highestSpecifiedArgPosition; + bool m_throwOnUnrecognisedTokens; + }; + +} // end namespace Clara + +#ifdef CLICHE_CLARA_OUTER_NAMESPACE +} // end outer namespace +#endif + +#endif // TWOBLUECUBES_CLARA_H_ALREADY_INCLUDED + diff --git a/single_include_projects/SelfTest/internal/tbc_text_format.h b/single_include_projects/SelfTest/internal/tbc_text_format.h new file mode 100644 index 00000000..a63d6a14 --- /dev/null +++ b/single_include_projects/SelfTest/internal/tbc_text_format.h @@ -0,0 +1,153 @@ +/* + * Created by Phil on 18/4/2013. + * Copyright 2013 Two Blue Cubes Ltd. All rights reserved. + * + * Distributed under the Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + */ +// Only use header guard if we are not using an outer namespace +#ifndef CLICHE_TBC_TEXT_FORMAT_OUTER_NAMESPACE +# ifdef TWOBLUECUBES_TEXT_FORMAT_H_INCLUDED +# ifndef TWOBLUECUBES_TEXT_FORMAT_H_ALREADY_INCLUDED +# define TWOBLUECUBES_TEXT_FORMAT_H_ALREADY_INCLUDED +# endif +# else +# define TWOBLUECUBES_TEXT_FORMAT_H_INCLUDED +# endif +#endif +#ifndef TWOBLUECUBES_TEXT_FORMAT_H_ALREADY_INCLUDED +#include +#include +#include + +// Use optional outer namespace +#ifdef CLICHE_TBC_TEXT_FORMAT_OUTER_NAMESPACE +namespace CLICHE_TBC_TEXT_FORMAT_OUTER_NAMESPACE { +#endif + +namespace Tbc { + +#ifdef TBC_TEXT_FORMAT_CONSOLE_WIDTH + const unsigned int consoleWidth = TBC_TEXT_FORMAT_CONSOLE_WIDTH; +#else + const unsigned int consoleWidth = 80; +#endif + + struct TextAttributes { + TextAttributes() + : initialIndent( std::string::npos ), + indent( 0 ), + width( consoleWidth-1 ), + tabChar( '\t' ) + {} + + TextAttributes& setInitialIndent( std::size_t _value ) { initialIndent = _value; return *this; } + TextAttributes& setIndent( std::size_t _value ) { indent = _value; return *this; } + TextAttributes& setWidth( std::size_t _value ) { width = _value; return *this; } + TextAttributes& setTabChar( char _value ) { tabChar = _value; return *this; } + + std::size_t initialIndent; // indent of first line, or npos + std::size_t indent; // indent of subsequent lines, or all if initialIndent is npos + std::size_t width; // maximum width of text, including indent. Longer text will wrap + char tabChar; // If this char is seen the indent is changed to current pos + }; + + class Text { + public: + Text( std::string const& _str, TextAttributes const& _attr = TextAttributes() ) + : attr( _attr ) + { + std::string wrappableChars = " [({.,/|\\-"; + std::size_t indent = _attr.initialIndent != std::string::npos + ? _attr.initialIndent + : _attr.indent; + std::string remainder = _str; + + while( !remainder.empty() ) { + if( lines.size() >= 1000 ) { + lines.push_back( "... message truncated due to excessive size" ); + return; + } + std::size_t tabPos = std::string::npos; + std::size_t width = (std::min)( remainder.size(), _attr.width - indent ); + std::size_t pos = remainder.find_first_of( '\n' ); + if( pos <= width ) { + width = pos; + } + pos = remainder.find_last_of( _attr.tabChar, width ); + if( pos != std::string::npos ) { + tabPos = pos; + if( remainder[width] == '\n' ) + width--; + remainder = remainder.substr( 0, tabPos ) + remainder.substr( tabPos+1 ); + } + + if( width == remainder.size() ) { + spliceLine( indent, remainder, width ); + } + else if( remainder[width] == '\n' ) { + spliceLine( indent, remainder, width ); + if( width <= 1 || remainder.size() != 1 ) + remainder = remainder.substr( 1 ); + indent = _attr.indent; + } + else { + pos = remainder.find_last_of( wrappableChars, width ); + if( pos != std::string::npos && pos > 0 ) { + spliceLine( indent, remainder, pos ); + if( remainder[0] == ' ' ) + remainder = remainder.substr( 1 ); + } + else { + spliceLine( indent, remainder, width-1 ); + lines.back() += "-"; + } + if( lines.size() == 1 ) + indent = _attr.indent; + if( tabPos != std::string::npos ) + indent += tabPos; + } + } + } + + void spliceLine( std::size_t _indent, std::string& _remainder, std::size_t _pos ) { + lines.push_back( std::string( _indent, ' ' ) + _remainder.substr( 0, _pos ) ); + _remainder = _remainder.substr( _pos ); + } + + typedef std::vector::const_iterator const_iterator; + + const_iterator begin() const { return lines.begin(); } + const_iterator end() const { return lines.end(); } + std::string const& last() const { return lines.back(); } + std::size_t size() const { return lines.size(); } + std::string const& operator[]( std::size_t _index ) const { return lines[_index]; } + std::string toString() const { + std::ostringstream oss; + oss << *this; + return oss.str(); + } + + inline friend std::ostream& operator << ( std::ostream& _stream, Text const& _text ) { + for( Text::const_iterator it = _text.begin(), itEnd = _text.end(); + it != itEnd; ++it ) { + if( it != _text.begin() ) + _stream << "\n"; + _stream << *it; + } + return _stream; + } + + private: + std::string str; + TextAttributes attr; + std::vector lines; + }; + +} // end namespace Tbc + +#ifdef CLICHE_TBC_TEXT_FORMAT_OUTER_NAMESPACE +} // end outer namespace +#endif + +#endif // TWOBLUECUBES_TEXT_FORMAT_H_ALREADY_INCLUDED diff --git a/single_include_projects/SelfTest/makefile b/single_include_projects/SelfTest/makefile new file mode 100644 index 00000000..d89e2d00 --- /dev/null +++ b/single_include_projects/SelfTest/makefile @@ -0,0 +1,21 @@ +SOURCES = ApproxTests.cpp \ + BDDTests.cpp \ + ClassTests.cpp \ + CmdLineTests.cpp \ + ConditionTests.cpp \ + ExceptionTests.cpp \ + GeneratorTests.cpp \ + MessageTests.cpp \ + MiscTests.cpp \ + TestMain.cpp \ + TrickyTests.cpp \ + VariadicMacrosTests.cpp +OBJECTS = $(patsubst %.cpp, %.o, $(SOURCES)) +CXX = g++ +CXXFLAGS = -I../../single_include + +CatchSelfTest: $(OBJECTS) + $(CXX) -o $@ $^ + +clean: + rm -f CatchSelfTest CatchSelfTest.exe $(OBJECTS) diff --git a/single_include_projects/VS2010/ManagedTestCatch/AssemblyInfo.cpp b/single_include_projects/VS2010/ManagedTestCatch/AssemblyInfo.cpp new file mode 100644 index 00000000..a4276585 --- /dev/null +++ b/single_include_projects/VS2010/ManagedTestCatch/AssemblyInfo.cpp @@ -0,0 +1,34 @@ +#include "stdafx.h" + +using namespace System::Reflection; +using namespace System::Runtime::CompilerServices; +using namespace System::Runtime::InteropServices; + +// +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +// +[assembly:AssemblyTitleAttribute("ManagedTestCatch")]; +[assembly:AssemblyDescriptionAttribute("")]; +[assembly:AssemblyConfigurationAttribute("")]; +[assembly:AssemblyCompanyAttribute("Instron")]; +[assembly:AssemblyProductAttribute("ManagedTestCatch")]; +[assembly:AssemblyCopyrightAttribute("Copyright (c) Instron 2013")]; +[assembly:AssemblyTrademarkAttribute("")]; +[assembly:AssemblyCultureAttribute("")]; + +// +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the value or you can default the Build and Revision Numbers +// by using the '*' as shown below: + +[assembly:AssemblyVersionAttribute("1.0.*")]; +[assembly:ComVisible(false)]; + diff --git a/single_include_projects/VS2010/ManagedTestCatch/Local.testsettings b/single_include_projects/VS2010/ManagedTestCatch/Local.testsettings new file mode 100644 index 00000000..a3ce38d6 --- /dev/null +++ b/single_include_projects/VS2010/ManagedTestCatch/Local.testsettings @@ -0,0 +1,10 @@ + + + These are default test settings for a local test run. + + + + + + + \ No newline at end of file diff --git a/single_include_projects/VS2010/ManagedTestCatch/ManagedTestCatch.sln b/single_include_projects/VS2010/ManagedTestCatch/ManagedTestCatch.sln new file mode 100644 index 00000000..7cfd3e6c --- /dev/null +++ b/single_include_projects/VS2010/ManagedTestCatch/ManagedTestCatch.sln @@ -0,0 +1,36 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ManagedTestCatch", "ManagedTestCatch.vcxproj", "{7CC06A6B-763E-42B3-AF6C-8F1E340372A1}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{EAFF2A33-B90A-4957-A39D-F49589A088C8}" + ProjectSection(SolutionItems) = preProject + Local.testsettings = Local.testsettings + ManagedTestCatch.vsmdi = ManagedTestCatch.vsmdi + TraceAndTestImpact.testsettings = TraceAndTestImpact.testsettings + EndProjectSection +EndProject +Global + GlobalSection(TestCaseManagementSettings) = postSolution + CategoryFile = ManagedTestCatch.vsmdi + EndGlobalSection + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + DebugMbcs|Win32 = DebugMbcs|Win32 + Release|Win32 = Release|Win32 + ReleaseMbcs|Win32 = ReleaseMbcs|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {7CC06A6B-763E-42B3-AF6C-8F1E340372A1}.Debug|Win32.ActiveCfg = Debug|Win32 + {7CC06A6B-763E-42B3-AF6C-8F1E340372A1}.Debug|Win32.Build.0 = Debug|Win32 + {7CC06A6B-763E-42B3-AF6C-8F1E340372A1}.DebugMbcs|Win32.ActiveCfg = DebugMbcs|Win32 + {7CC06A6B-763E-42B3-AF6C-8F1E340372A1}.DebugMbcs|Win32.Build.0 = DebugMbcs|Win32 + {7CC06A6B-763E-42B3-AF6C-8F1E340372A1}.Release|Win32.ActiveCfg = Release|Win32 + {7CC06A6B-763E-42B3-AF6C-8F1E340372A1}.Release|Win32.Build.0 = Release|Win32 + {7CC06A6B-763E-42B3-AF6C-8F1E340372A1}.ReleaseMbcs|Win32.ActiveCfg = ReleaseMbcs|Win32 + {7CC06A6B-763E-42B3-AF6C-8F1E340372A1}.ReleaseMbcs|Win32.Build.0 = ReleaseMbcs|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/single_include_projects/VS2010/ManagedTestCatch/ManagedTestCatch.vcxproj b/single_include_projects/VS2010/ManagedTestCatch/ManagedTestCatch.vcxproj new file mode 100644 index 00000000..51eebfd3 --- /dev/null +++ b/single_include_projects/VS2010/ManagedTestCatch/ManagedTestCatch.vcxproj @@ -0,0 +1,177 @@ + + + + + DebugMbcs + Win32 + + + Debug + Win32 + + + ReleaseMbcs + Win32 + + + Release + Win32 + + + + $(ProjectName) + {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942} + {7CC06A6B-763E-42B3-AF6C-8F1E340372A1} + ManagedCProj + ManagedTestCatch + + + + DynamicLibrary + true + Unicode + + + DynamicLibrary + true + MultiByte + + + DynamicLibrary + Safe + Unicode + + + DynamicLibrary + Safe + MultiByte + + + + + + + + + + + + + + + + + + if exist app.config copy app.config "$(OutDir)app.config" + true + true + false + false + + + + Level4 + Disabled + WIN32;_DEBUG;%(PreprocessorDefinitions) + NotUsing + ..\..\..\single_include + true + MultiThreadedDebugDLL + + + true + + + + + + + Level4 + Disabled + WIN32;_DEBUG;%(PreprocessorDefinitions) + NotUsing + ..\..\..\single_include + true + MultiThreadedDebugDLL + + + true + + + + + + + Level3 + WIN32;NDEBUG;%(PreprocessorDefinitions) + NotUsing + true + ../../../single_include + + + true + + + + + + + Level3 + WIN32;NDEBUG;%(PreprocessorDefinitions) + NotUsing + true + ../../../single_include + + + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/single_include_projects/VS2010/ManagedTestCatch/ManagedTestCatch.vcxproj.filters b/single_include_projects/VS2010/ManagedTestCatch/ManagedTestCatch.vcxproj.filters new file mode 100644 index 00000000..6c23ab87 --- /dev/null +++ b/single_include_projects/VS2010/ManagedTestCatch/ManagedTestCatch.vcxproj.filters @@ -0,0 +1,97 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + + + Resource Files + + + + + Resource Files + + + \ No newline at end of file diff --git a/single_include_projects/VS2010/ManagedTestCatch/ManagedTestCatch.vsmdi b/single_include_projects/VS2010/ManagedTestCatch/ManagedTestCatch.vsmdi new file mode 100644 index 00000000..04402af4 --- /dev/null +++ b/single_include_projects/VS2010/ManagedTestCatch/ManagedTestCatch.vsmdi @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/single_include_projects/VS2010/ManagedTestCatch/TraceAndTestImpact.testsettings b/single_include_projects/VS2010/ManagedTestCatch/TraceAndTestImpact.testsettings new file mode 100644 index 00000000..6d465319 --- /dev/null +++ b/single_include_projects/VS2010/ManagedTestCatch/TraceAndTestImpact.testsettings @@ -0,0 +1,9 @@ + + + These are test settings for Trace and Test Impact. + + + + + + \ No newline at end of file diff --git a/single_include_projects/VS2010/ManagedTestCatch/app.ico b/single_include_projects/VS2010/ManagedTestCatch/app.ico new file mode 100644 index 00000000..3a5525fd Binary files /dev/null and b/single_include_projects/VS2010/ManagedTestCatch/app.ico differ diff --git a/single_include_projects/VS2010/ManagedTestCatch/app.rc b/single_include_projects/VS2010/ManagedTestCatch/app.rc new file mode 100644 index 00000000..a30366af --- /dev/null +++ b/single_include_projects/VS2010/ManagedTestCatch/app.rc @@ -0,0 +1,52 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon placed first or with lowest ID value becomes application icon + +LANGUAGE 9, 2 +#pragma code_page(1252) +1 ICON "app.ico" + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" + "\0" +END + +#endif // APSTUDIO_INVOKED + +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/single_include_projects/VS2010/ManagedTestCatch/resource.h b/single_include_projects/VS2010/ManagedTestCatch/resource.h new file mode 100644 index 00000000..d5ac7c42 --- /dev/null +++ b/single_include_projects/VS2010/ManagedTestCatch/resource.h @@ -0,0 +1,3 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by app.rc diff --git a/single_include_projects/VS2010/ManagedTestCatch/stdafx.cpp b/single_include_projects/VS2010/ManagedTestCatch/stdafx.cpp new file mode 100644 index 00000000..c7888519 --- /dev/null +++ b/single_include_projects/VS2010/ManagedTestCatch/stdafx.cpp @@ -0,0 +1,5 @@ +// stdafx.cpp : source file that includes just the standard includes +// ManagedTestCatch.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" diff --git a/single_include_projects/VS2010/ManagedTestCatch/stdafx.h b/single_include_projects/VS2010/ManagedTestCatch/stdafx.h new file mode 100644 index 00000000..3cc4c24e --- /dev/null +++ b/single_include_projects/VS2010/ManagedTestCatch/stdafx.h @@ -0,0 +1,7 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, +// but are changed infrequently + +#pragma once + + diff --git a/single_include_projects/VS2010/TestCatch/TestCatch.sln b/single_include_projects/VS2010/TestCatch/TestCatch.sln new file mode 100644 index 00000000..efb4502b --- /dev/null +++ b/single_include_projects/VS2010/TestCatch/TestCatch.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestCatch", "TestCatch\TestCatch.vcxproj", "{A2F23B19-9CF7-4246-AE58-BC65E39C6F7E}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {A2F23B19-9CF7-4246-AE58-BC65E39C6F7E}.Debug|Win32.ActiveCfg = Debug|Win32 + {A2F23B19-9CF7-4246-AE58-BC65E39C6F7E}.Debug|Win32.Build.0 = Debug|Win32 + {A2F23B19-9CF7-4246-AE58-BC65E39C6F7E}.Release|Win32.ActiveCfg = Release|Win32 + {A2F23B19-9CF7-4246-AE58-BC65E39C6F7E}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/single_include_projects/VS2010/TestCatch/TestCatch/TestCatch.vcxproj b/single_include_projects/VS2010/TestCatch/TestCatch/TestCatch.vcxproj new file mode 100644 index 00000000..5a51e881 --- /dev/null +++ b/single_include_projects/VS2010/TestCatch/TestCatch/TestCatch.vcxproj @@ -0,0 +1,149 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {A2F23B19-9CF7-4246-AE58-BC65E39C6F7E} + TestCatch + Win32Proj + + + + Application + Unicode + true + + + Application + Unicode + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + AllRules.ruleset + + + AllRules.ruleset + + + + + + Disabled + ..\..\..\..\single_include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level4 + EditAndContinue + + + true + Console + MachineX86 + + + + + MaxSpeed + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + MultiThreadedDLL + true + + + Level3 + ProgramDatabase + ..\..\..\..\single_include;%(AdditionalIncludeDirectories) + + + true + Console + true + true + MachineX86 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/single_include_projects/VS2010/TestCatch/TestCatch/TestCatch.vcxproj.filters b/single_include_projects/VS2010/TestCatch/TestCatch/TestCatch.vcxproj.filters new file mode 100644 index 00000000..9742aa2a --- /dev/null +++ b/single_include_projects/VS2010/TestCatch/TestCatch/TestCatch.vcxproj.filters @@ -0,0 +1,162 @@ + + + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + Sources + + + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + Headers + + + + + {18bce7d6-45c2-4f57-8334-f3e8469d4d41} + + + {fea8fbb4-5032-451a-ba31-e5cb8f32e0de} + + + \ No newline at end of file diff --git a/single_include_projects/VS2012/ManagedTestCatch/AssemblyInfo.cpp b/single_include_projects/VS2012/ManagedTestCatch/AssemblyInfo.cpp new file mode 100644 index 00000000..04d565a3 --- /dev/null +++ b/single_include_projects/VS2012/ManagedTestCatch/AssemblyInfo.cpp @@ -0,0 +1,34 @@ +#include "stdafx.h" + +using namespace System::Reflection; +using namespace System::Runtime::CompilerServices; +using namespace System::Runtime::InteropServices; + +// +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +// +[assembly:AssemblyTitleAttribute("ManagedTestCatch2012")]; +[assembly:AssemblyDescriptionAttribute("")]; +[assembly:AssemblyConfigurationAttribute("")]; +[assembly:AssemblyCompanyAttribute("Instron")]; +[assembly:AssemblyProductAttribute("ManagedTestCatch2012")]; +[assembly:AssemblyCopyrightAttribute("Copyright (c) Instron 2013")]; +[assembly:AssemblyTrademarkAttribute("")]; +[assembly:AssemblyCultureAttribute("")]; + +// +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the value or you can default the Build and Revision Numbers +// by using the '*' as shown below: + +[assembly:AssemblyVersionAttribute("1.0.*")]; +[assembly:ComVisible(false)]; + diff --git a/single_include_projects/VS2012/ManagedTestCatch/ManagedTestCatch.sln b/single_include_projects/VS2012/ManagedTestCatch/ManagedTestCatch.sln new file mode 100644 index 00000000..a0be7336 --- /dev/null +++ b/single_include_projects/VS2012/ManagedTestCatch/ManagedTestCatch.sln @@ -0,0 +1,26 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ManagedTestCatch", "ManagedTestCatch.vcxproj", "{9757CB21-B840-49A6-B057-9F322E543DD6}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + DebugMbcs|Win32 = DebugMbcs|Win32 + Release|Win32 = Release|Win32 + ReleaseMbcs|Win32 = ReleaseMbcs|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {9757CB21-B840-49A6-B057-9F322E543DD6}.Debug|Win32.ActiveCfg = Debug|Win32 + {9757CB21-B840-49A6-B057-9F322E543DD6}.Debug|Win32.Build.0 = Debug|Win32 + {9757CB21-B840-49A6-B057-9F322E543DD6}.DebugMbcs|Win32.ActiveCfg = DebugMbcs|Win32 + {9757CB21-B840-49A6-B057-9F322E543DD6}.DebugMbcs|Win32.Build.0 = DebugMbcs|Win32 + {9757CB21-B840-49A6-B057-9F322E543DD6}.Release|Win32.ActiveCfg = Release|Win32 + {9757CB21-B840-49A6-B057-9F322E543DD6}.Release|Win32.Build.0 = Release|Win32 + {9757CB21-B840-49A6-B057-9F322E543DD6}.ReleaseMbcs|Win32.ActiveCfg = ReleaseMbcs|Win32 + {9757CB21-B840-49A6-B057-9F322E543DD6}.ReleaseMbcs|Win32.Build.0 = ReleaseMbcs|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/single_include_projects/VS2012/ManagedTestCatch/ManagedTestCatch.vcxproj b/single_include_projects/VS2012/ManagedTestCatch/ManagedTestCatch.vcxproj new file mode 100644 index 00000000..b1d19ecb --- /dev/null +++ b/single_include_projects/VS2012/ManagedTestCatch/ManagedTestCatch.vcxproj @@ -0,0 +1,196 @@ + + + + + DebugMbcs + Win32 + + + Debug + Win32 + + + ReleaseMbcs + Win32 + + + Release + Win32 + + + + $(ProjectName) + {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942} + {9757CB21-B840-49A6-B057-9F322E543DD6} + ManagedCProj + ManagedTestCatch2012 + + + + DynamicLibrary + v110 + Safe + Unicode + + + DynamicLibrary + v110 + Safe + MultiByte + + + DynamicLibrary + v110 + true + Unicode + + + DynamicLibrary + v110 + true + MultiByte + + + + + + + + + + + + + + + + + + if exist app.config copy app.config "$(OutDir)app.config" + + + true + + + true + + + false + + + false + + + + Level3 + Disabled + WIN32;_DEBUG;%(PreprocessorDefinitions) + NotUsing + ../../../single_include + true + MultiThreadedDebugDLL + + + true + + + + taskkill /F /IM vstest.executionengine.x86.exe /FI "MEMUSAGE gt 1" + + + + + Level3 + Disabled + WIN32;_DEBUG;%(PreprocessorDefinitions) + NotUsing + ../../../single_include + true + MultiThreadedDebugDLL + + + true + + + + + taskkill /F /IM vstest.executionengine.x86.exe /FI "MEMUSAGE gt 1" + + + + + Level3 + WIN32;NDEBUG;%(PreprocessorDefinitions) + NotUsing + ../../../single_include + true + + + true + + + + + + Level3 + WIN32;NDEBUG;%(PreprocessorDefinitions) + NotUsing + ../../../single_include + true + + + true + + + + + + + ..\..\..\..\..\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll + false + + + + + + + + + + + + + + + + + + + + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/single_include_projects/VS2012/ManagedTestCatch/ManagedTestCatch.vcxproj.filters b/single_include_projects/VS2012/ManagedTestCatch/ManagedTestCatch.vcxproj.filters new file mode 100644 index 00000000..6c7a2dfd --- /dev/null +++ b/single_include_projects/VS2012/ManagedTestCatch/ManagedTestCatch.vcxproj.filters @@ -0,0 +1,97 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + + + Resource Files + + + + + Resource Files + + + \ No newline at end of file diff --git a/single_include_projects/VS2012/ManagedTestCatch/app.ico b/single_include_projects/VS2012/ManagedTestCatch/app.ico new file mode 100644 index 00000000..301942f6 Binary files /dev/null and b/single_include_projects/VS2012/ManagedTestCatch/app.ico differ diff --git a/single_include_projects/VS2012/ManagedTestCatch/app.rc b/single_include_projects/VS2012/ManagedTestCatch/app.rc new file mode 100644 index 00000000..a30366af --- /dev/null +++ b/single_include_projects/VS2012/ManagedTestCatch/app.rc @@ -0,0 +1,52 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon placed first or with lowest ID value becomes application icon + +LANGUAGE 9, 2 +#pragma code_page(1252) +1 ICON "app.ico" + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" + "\0" +END + +#endif // APSTUDIO_INVOKED + +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/single_include_projects/VS2012/ManagedTestCatch/resource.h b/single_include_projects/VS2012/ManagedTestCatch/resource.h new file mode 100644 index 00000000..d5ac7c42 --- /dev/null +++ b/single_include_projects/VS2012/ManagedTestCatch/resource.h @@ -0,0 +1,3 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by app.rc diff --git a/single_include_projects/VS2012/ManagedTestCatch/stdafx.cpp b/single_include_projects/VS2012/ManagedTestCatch/stdafx.cpp new file mode 100644 index 00000000..defbf61a --- /dev/null +++ b/single_include_projects/VS2012/ManagedTestCatch/stdafx.cpp @@ -0,0 +1,5 @@ +// stdafx.cpp : source file that includes just the standard includes +// ManagedTestCatch2012.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" diff --git a/single_include_projects/VS2012/ManagedTestCatch/stdafx.h b/single_include_projects/VS2012/ManagedTestCatch/stdafx.h new file mode 100644 index 00000000..3cc4c24e --- /dev/null +++ b/single_include_projects/VS2012/ManagedTestCatch/stdafx.h @@ -0,0 +1,7 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, +// but are changed infrequently + +#pragma once + + diff --git a/single_include_projects/VS2012/NativeTestCatch/NativeTestCatch.sln b/single_include_projects/VS2012/NativeTestCatch/NativeTestCatch.sln new file mode 100644 index 00000000..9e250bd9 --- /dev/null +++ b/single_include_projects/VS2012/NativeTestCatch/NativeTestCatch.sln @@ -0,0 +1,26 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "NativeTestCatch", "NativeTestCatch.vcxproj", "{977CE524-3FC7-4281-9C1B-77C210F24A9B}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + DebugMbcs|Win32 = DebugMbcs|Win32 + Release|Win32 = Release|Win32 + ReleaseMbcs|Win32 = ReleaseMbcs|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {977CE524-3FC7-4281-9C1B-77C210F24A9B}.Debug|Win32.ActiveCfg = Debug|Win32 + {977CE524-3FC7-4281-9C1B-77C210F24A9B}.Debug|Win32.Build.0 = Debug|Win32 + {977CE524-3FC7-4281-9C1B-77C210F24A9B}.DebugMbcs|Win32.ActiveCfg = DebugMbcs|Win32 + {977CE524-3FC7-4281-9C1B-77C210F24A9B}.DebugMbcs|Win32.Build.0 = DebugMbcs|Win32 + {977CE524-3FC7-4281-9C1B-77C210F24A9B}.Release|Win32.ActiveCfg = Release|Win32 + {977CE524-3FC7-4281-9C1B-77C210F24A9B}.Release|Win32.Build.0 = Release|Win32 + {977CE524-3FC7-4281-9C1B-77C210F24A9B}.ReleaseMbcs|Win32.ActiveCfg = ReleaseMbcs|Win32 + {977CE524-3FC7-4281-9C1B-77C210F24A9B}.ReleaseMbcs|Win32.Build.0 = ReleaseMbcs|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/single_include_projects/VS2012/NativeTestCatch/NativeTestCatch.vcxproj b/single_include_projects/VS2012/NativeTestCatch/NativeTestCatch.vcxproj new file mode 100644 index 00000000..0982ecf7 --- /dev/null +++ b/single_include_projects/VS2012/NativeTestCatch/NativeTestCatch.vcxproj @@ -0,0 +1,181 @@ + + + + + DebugMbcs + Win32 + + + Debug + Win32 + + + ReleaseMbcs + Win32 + + + Release + Win32 + + + + {977CE524-3FC7-4281-9C1B-77C210F24A9B} + Win32Proj + NativeTestCatch + + + + DynamicLibrary + true + v110 + Unicode + false + + + DynamicLibrary + true + v110 + MultiByte + false + + + DynamicLibrary + true + v110 + MultiByte + false + + + DynamicLibrary + false + v110 + true + Unicode + false + + + + + + + + + + + + + + + + + + + true + + + true + + + true + + + true + + + + NotUsing + Level4 + Disabled + ../../../single_include;$(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;%(PreprocessorDefinitions) + true + + + Windows + true + $(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories) + + + + + NotUsing + Level3 + Disabled + ../../../single_include;$(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;%(PreprocessorDefinitions) + true + + + Windows + true + $(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories) + + + + + NotUsing + Level3 + Disabled + ../../../single_include;$(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;%(PreprocessorDefinitions) + true + + + Windows + true + $(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories) + + + + + Level3 + NotUsing + MaxSpeed + true + true + ../../../single_include;$(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;%(PreprocessorDefinitions) + true + + + Windows + true + true + true + $(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories) + + + + + + + + + + + + + + + + + + + + + + + + + + + Create + Create + Create + Create + + + + + + \ No newline at end of file diff --git a/single_include_projects/VS2012/NativeTestCatch/NativeTestCatch.vcxproj.filters b/single_include_projects/VS2012/NativeTestCatch/NativeTestCatch.vcxproj.filters new file mode 100644 index 00000000..2b8c76a0 --- /dev/null +++ b/single_include_projects/VS2012/NativeTestCatch/NativeTestCatch.vcxproj.filters @@ -0,0 +1,84 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Header Files + + + Header Files + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + \ No newline at end of file diff --git a/single_include_projects/VS2012/NativeTestCatch/stdafx.cpp b/single_include_projects/VS2012/NativeTestCatch/stdafx.cpp new file mode 100644 index 00000000..7734a57c --- /dev/null +++ b/single_include_projects/VS2012/NativeTestCatch/stdafx.cpp @@ -0,0 +1,9 @@ +// stdafx.cpp : source file that includes just the standard includes +// NativeTestCatch.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file + diff --git a/single_include_projects/VS2012/NativeTestCatch/stdafx.h b/single_include_projects/VS2012/NativeTestCatch/stdafx.h new file mode 100644 index 00000000..43280fca --- /dev/null +++ b/single_include_projects/VS2012/NativeTestCatch/stdafx.h @@ -0,0 +1,13 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#pragma once + +#include "targetver.h" + +// Headers for CppUnitTest +#include "CppUnitTest.h" + +// TODO: reference additional headers your program requires here diff --git a/single_include_projects/VS2012/NativeTestCatch/targetver.h b/single_include_projects/VS2012/NativeTestCatch/targetver.h new file mode 100644 index 00000000..87c0086d --- /dev/null +++ b/single_include_projects/VS2012/NativeTestCatch/targetver.h @@ -0,0 +1,8 @@ +#pragma once + +// Including SDKDDKVer.h defines the highest available Windows platform. + +// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and +// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. + +#include