diff --git a/binarycpython/tests/c_bindings/__init__.py b/binarycpython/tests/c_bindings/__init__.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/binarycpython/tests/c_bindings/test_custom_logging_code.py b/binarycpython/tests/c_bindings/test_custom_logging_code.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/binarycpython/tests/c_bindings/test_return_store_memaddr.py b/binarycpython/tests/c_bindings/test_return_store_memaddr.py deleted file mode 100644 index 3da497b453298dbad9e398b0e1db6c36a30727b4..0000000000000000000000000000000000000000 --- a/binarycpython/tests/c_bindings/test_return_store_memaddr.py +++ /dev/null @@ -1,27 +0,0 @@ -import textwrap -from binarycpython import _binary_c_bindings - - -def test_return_store_memaddr(): - output = _binary_c_bindings.return_store_memaddr() - - print("function: test_return_store") - print("store memory adress:") - print(textwrap.indent(str(output), "\t")) - - -def test_unload_store_memaddr(): - output = _binary_c_bindings.return_store_memaddr() - - print("function: test_return_store") - print("store memory adress:") - print(textwrap.indent(str(output), "\t")) - print(type(output)) - _ = _binary_c_bindings.free_store_memaddr(output) - print("freed store memaddr") - - -#### -if __name__ == "__main__": - test_return_store_memaddr() - test_unload_store_memaddr() diff --git a/binarycpython/tests/c_bindings/test_run_system.py b/binarycpython/tests/c_bindings/test_run_system.py deleted file mode 100644 index c12e37cf1e498193d1fa4bdf8fe1d410a89c8bae..0000000000000000000000000000000000000000 --- a/binarycpython/tests/c_bindings/test_run_system.py +++ /dev/null @@ -1,36 +0,0 @@ -from binarycpython import _binary_c_bindings - -import textwrap - - -# Evolution functions -def test_run_system(): - m1 = 15.0 # Msun - m2 = 14.0 # Msun - separation = 0 # 0 = ignored, use period - orbital_period = 4530.0 # days - eccentricity = 0.0 - metallicity = 0.02 - max_evolution_time = 15000 - argstring = "binary_c M_1 {0:g} M_2 {1:g} separation {2:g} orbital_period {3:g} eccentricity {4:g} metallicity {5:g} max_evolution_time {6:g} ".format( - m1, - m2, - separation, - orbital_period, - eccentricity, - metallicity, - max_evolution_time, - ) - - output = _binary_c_bindings.run_system(argstring=argstring) - - # print("function: test_run_system") - # print("Binary_c output:") - # print(textwrap.indent(output, "\t")) - - assert "SINGLE_STAR_LIFETIME" in output, "Run system not working properly" - - -#### -if __name__ == "__main__": - test_run_system() diff --git a/binarycpython/tests/grid/__init__.py b/binarycpython/tests/grid/__init__.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/binarycpython/tests/grid/test_grid.py b/binarycpython/tests/grid/test_grid.py deleted file mode 100644 index 9ed72bb4973a6eb3ad33a7b89f5cf3827fd21249..0000000000000000000000000000000000000000 --- a/binarycpython/tests/grid/test_grid.py +++ /dev/null @@ -1 +0,0 @@ -# empty for now diff --git a/binarycpython/tests/c_bindings/test_ensemble.py b/binarycpython/tests/test_c_bindings.py similarity index 84% rename from binarycpython/tests/c_bindings/test_ensemble.py rename to binarycpython/tests/test_c_bindings.py index 3fe9ab111b7870906c7cf8f69f68a79151aa65cc..5021bcf5cafb63829fd1537e6b9a2d4fc8dab4fc 100644 --- a/binarycpython/tests/c_bindings/test_ensemble.py +++ b/binarycpython/tests/test_c_bindings.py @@ -1,7 +1,3 @@ -""" -Module containing tests regarding the persistent_data memory and the ensemble output -""" - import os import sys import time @@ -18,6 +14,67 @@ from binarycpython.utils.functions import ( handle_ensemble_string_to_json, ) +####################################################################################################################################################### +### General run_system test +####################################################################################################################################################### + +# Evolution functions +def test_run_system(): + m1 = 15.0 # Msun + m2 = 14.0 # Msun + separation = 0 # 0 = ignored, use period + orbital_period = 4530.0 # days + eccentricity = 0.0 + metallicity = 0.02 + max_evolution_time = 15000 + argstring = "binary_c M_1 {0:g} M_2 {1:g} separation {2:g} orbital_period {3:g} eccentricity {4:g} metallicity {5:g} max_evolution_time {6:g} ".format( + m1, + m2, + separation, + orbital_period, + eccentricity, + metallicity, + max_evolution_time, + ) + + output = _binary_c_bindings.run_system(argstring=argstring) + + # print("function: test_run_system") + # print("Binary_c output:") + # print(textwrap.indent(output, "\t")) + + assert "SINGLE_STAR_LIFETIME" in output, "Run system not working properly" + +####################################################################################################################################################### +### memaddr test +####################################################################################################################################################### + +def test_return_store_memaddr(): + output = _binary_c_bindings.return_store_memaddr() + + print("function: test_return_store") + print("store memory adress:") + print(textwrap.indent(str(output), "\t")) + + +def test_unload_store_memaddr(): + output = _binary_c_bindings.return_store_memaddr() + + print("function: test_return_store") + print("store memory adress:") + print(textwrap.indent(str(output), "\t")) + print(type(output)) + _ = _binary_c_bindings.free_store_memaddr(output) + print("freed store memaddr") + +####################################################################################################################################################### +### ensemble tests +####################################################################################################################################################### + +""" +Module containing tests regarding the persistent_data memory and the ensemble output +""" + TMP_DIR = temp_dir() os.makedirs(os.path.join(TMP_DIR, "test"), exist_ok=True) @@ -385,6 +442,9 @@ def test_full_ensemble_output(): assert "scalars" in json_1.keys() def all(): + test_run_system() + test_return_store_memaddr() + test_unload_store_memaddr() test_minimal_ensemble_output() test_return_persistent_data_memaddr() test_passing_persistent_data_to_run_system() @@ -404,4 +464,4 @@ if __name__ == "__main__": # test_free_and_json_output() # test_combine_with_empty_json() all() - print("Done") + print("Done") \ No newline at end of file diff --git a/setup.py b/setup.py index 4564e923fc2ad7e73cd4574150deb550667d2952..92c4c25e35615c1b1a341a5c436770dfe5b650f2 100644 --- a/setup.py +++ b/setup.py @@ -266,7 +266,6 @@ This is a python API for binary_c (versions {}) by David Hendriks, Rob Izzard an "binarycpython.utils", "binarycpython.core", "binarycpython.tests", - "binarycpython.tests.c_bindings", ], install_requires=["numpy", "pytest", "h5py", "pathos", "pandas"], include_package_data=True,