https://github.com/philsquared/Catch
Revision 4b614ee1d19514b9f72352b48589301ab808e774 authored by Phil Nash on 27 November 2017, 19:21:47 UTC, committed by Phil Nash on 27 November 2017, 19:23:15 UTC
This makes the assertion handling much less "chatty". AssertionHandler is now just a thin shim over RunContext
1 parent 5461242
Tip revision: 4b614ee1d19514b9f72352b48589301ab808e774 authored by Phil Nash on 27 November 2017, 19:21:47 UTC
Moved all AssertionHandler logic into RunContext and de-virtualised interface
Moved all AssertionHandler logic into RunContext and de-virtualised interface
Tip revision: 4b614ee
updateWandbox.py
#!/usr/bin/env python
import json
import os
import urllib2
from scriptCommon import catchPath
def upload(options):
request = urllib2.Request('http://melpon.org/wandbox/api/compile.json')
request.add_header('Content-Type', 'application/json')
response = urllib2.urlopen(request, json.dumps(options))
return json.loads(response.read())
main_file = '''
#define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do this in one cpp file
#include "catch.hpp"
unsigned int Factorial( unsigned int number ) {
return number <= 1 ? number : Factorial(number-1)*number;
}
TEST_CASE( "Factorials are computed", "[factorial]" ) {
REQUIRE( Factorial(1) == 1 );
REQUIRE( Factorial(2) == 2 );
REQUIRE( Factorial(3) == 6 );
REQUIRE( Factorial(10) == 3628800 );
}
'''
def uploadFiles():
response = upload({
'compiler': 'gcc-head',
'code': main_file,
'codes': [{
'file': 'catch.hpp',
'code': open(os.path.join(catchPath, 'single_include', 'catch.hpp')).read()
}],
'options': 'c++11,cpp-no-pedantic,boost-nothing',
'compiler-option-raw': '-DCATCH_CONFIG_FAST_COMPILE',
'save': True
})
if 'status' in response and not 'compiler_error' in response:
return True, response['url']
else:
return False, response
Computing file changes ...