86 lines
1.8 KiB
Python
86 lines
1.8 KiB
Python
|
|
# one
|
|
one = {
|
|
'defs': [
|
|
'int f(auto b){return 0;};',
|
|
'int f(long b){return 0;};',
|
|
'int f(void* b){return 0;};',
|
|
'int f(){return 0;};',
|
|
],
|
|
'tests' : [
|
|
'int A = f();',
|
|
'int B = f(0);',
|
|
'int C = f({});',
|
|
'int D = f(nullptr);',
|
|
], 'url': 'https://cppcon.digital-medium.co.uk/v3bqsv/'
|
|
}
|
|
|
|
three = {
|
|
'defs': [
|
|
'int f(int b){return 0;}',
|
|
'int f(int b=0){return 0;}',
|
|
'int f(void* b){return 0;}',
|
|
'int f(){return 0;}',
|
|
'int f(long b){return 0;}',
|
|
],
|
|
|
|
'tests': [
|
|
'int A = f();',
|
|
'int B = f(0);',
|
|
'int C = f(1);',
|
|
'int D = f({});',
|
|
'int E = f(nullptr);',
|
|
],
|
|
'url': 'https://cppcon.digital-medium.co.uk/urea44/'
|
|
}
|
|
|
|
four = {
|
|
'defs': [
|
|
'int f(int b){return 0;}',
|
|
'int f(int b=0){return 0;}',
|
|
'int f(void* b){return 0;}',
|
|
'int f(){return 0;}',
|
|
'int f(long b){return 0;}',
|
|
],
|
|
|
|
'tests': [
|
|
'int A = f();',
|
|
'int B = f(0);',
|
|
'int C = f(1);',
|
|
'int D = f({});',
|
|
'int E = f(nullptr);',
|
|
],
|
|
'url': 'https://cppcon.digital-medium.co.uk/j2hv4d/'
|
|
}
|
|
|
|
|
|
import subprocess
|
|
import tempfile
|
|
for a in [one, three, four]:
|
|
print (a['url'])
|
|
defs = a['defs']
|
|
tests = a['tests']
|
|
for i, d in enumerate(defs, start=1):
|
|
buffer = d
|
|
|
|
sol = ''
|
|
for test in tests:
|
|
tbuffer = buffer + 'int main(){' + test + 'return 0;}'
|
|
|
|
with tempfile.NamedTemporaryFile(mode='w+', encoding='utf8', suffix='.cpp') as fp:
|
|
fp.write(tbuffer)
|
|
fp.flush()
|
|
#print(subprocess.check_output(["cat", fp.name]))
|
|
print(' ' + tbuffer, end="")
|
|
try:
|
|
subprocess.check_call(["clang++", "-std=c++20", fp.name])
|
|
subprocess.check_call(['./a.out'])
|
|
sol += test[4]
|
|
except:
|
|
print('XXX')
|
|
continue
|
|
print()
|
|
print(str(i) + " " + sol)
|
|
|
|
|