59 lines
1.6 KiB
Python
59 lines
1.6 KiB
Python
import os
|
|
import re
|
|
import shutil
|
|
|
|
# c cs java bash php perl python
|
|
|
|
def CheckOutput(output):
|
|
return output == 'Hello world!\n'
|
|
|
|
def test_c():
|
|
print(os.getcwd())
|
|
fh = os.popen("make c &>/dev/null; ./HelloWorld", mode='r', buffering=-1)
|
|
output = fh.read()
|
|
retcode = fh.close()
|
|
assert retcode == None and CheckOutput(output)
|
|
|
|
def test_cs():
|
|
print(os.getcwd())
|
|
fh = os.popen("make cs &>/dev/null; mono ./HelloWorld.exe", mode='r', buffering=-1)
|
|
output = fh.read()
|
|
retcode = fh.close()
|
|
assert retcode == None and CheckOutput(output)
|
|
|
|
def test_java():
|
|
print(os.getcwd())
|
|
fh = os.popen("make java &>/dev/null; java HelloWorld", mode='r', buffering=-1)
|
|
output = fh.read()
|
|
retcode = fh.close()
|
|
assert retcode == None and CheckOutput(output)
|
|
|
|
def test_bash():
|
|
print(os.getcwd())
|
|
fh = os.popen("./HelloWorld.bash", mode='r', buffering=-1)
|
|
output = fh.read()
|
|
retcode = fh.close()
|
|
assert retcode == None and CheckOutput(output)
|
|
|
|
def test_perl():
|
|
print(os.getcwd())
|
|
fh = os.popen("./HelloWorld.pl", mode='r', buffering=-1)
|
|
output = fh.read()
|
|
retcode = fh.close()
|
|
assert retcode == None and CheckOutput(output)
|
|
|
|
def test_php():
|
|
print(os.getcwd())
|
|
fh = os.popen("php ./HelloWorld.php", mode='r', buffering=-1)
|
|
output = fh.read()
|
|
retcode = fh.close()
|
|
assert retcode == None and CheckOutput(output)
|
|
|
|
def test_python():
|
|
print(os.getcwd())
|
|
fh = os.popen("./HelloWorld.py", mode='r', buffering=-1)
|
|
output = fh.read()
|
|
retcode = fh.close()
|
|
assert retcode == None and CheckOutput(output)
|
|
|