You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
1012 B
Python
35 lines
1012 B
Python
import filecmp
|
|
import os.path
|
|
import numpy as np
|
|
|
|
def equal_binaries(path_original, path):
|
|
binary_original = np.load(path_original)
|
|
binary = np.load(path)
|
|
|
|
diffs = binary_original - binary
|
|
comparisons = np.array([(abs(x) < 0.01).all() for x in diffs])
|
|
return comparisons.all()
|
|
|
|
BINARIES = ['Cmap', 'D', 'P', 'V']
|
|
|
|
def test():
|
|
os.chdir('../..')
|
|
config_file = os.path.abspath("./tests/integration/conf_test.ini")
|
|
os.system("CONFIG_FILE_PATH="+ config_file + " mpirun python mpirunner.py")
|
|
|
|
for i in range(90):
|
|
for binary in BINARIES:
|
|
path = './tests/integration/tmp_output/{}/{}.npy'.format(i, binary)
|
|
path_original = './test_loop/{}/{}.npy'.format(i, binary)
|
|
|
|
if not equal_binaries(path_original, path):
|
|
print("Failure :( on {}".format(i))
|
|
os.system("rm -rf ./tests/integration/tmp_output")
|
|
|
|
return
|
|
|
|
print("Success!")
|
|
os.system("rm -rf ./tests/integration/tmp_output")
|
|
|
|
|
|
test() |