From 2cb7694ee7bbe456828b2911de4d4b23fc627f0a Mon Sep 17 00:00:00 2001 From: David Hendriks <davidhendriks93@gmail.com> Date: Sun, 10 Jan 2021 23:36:50 +0000 Subject: [PATCH] added tests for grid --- binarycpython/tests/test_grid.py | 34 ++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/binarycpython/tests/test_grid.py b/binarycpython/tests/test_grid.py index ff44027ae..5290067ef 100644 --- a/binarycpython/tests/test_grid.py +++ b/binarycpython/tests/test_grid.py @@ -14,6 +14,7 @@ import datetime from binarycpython.utils.grid import Population from binarycpython.utils.functions import temp_dir +from binarycpython.utils.custom_logging_functions import binary_c_log_code binary_c_temp_dir = temp_dir() @@ -350,6 +351,39 @@ class test_Population(unittest.TestCase): self.assertTrue(argdict["M_1"] == 10) self.assertTrue(argdict["metallicity"] == 0.02) + def test_evolve_single(self): + """ + Unittests for the function evolve_single + """ + + CUSTOM_LOGGING_STRING_MASSES = """ + Printf("MASS_PLOTTING %30.12e %g %g %g %g\\n", + // + stardata->model.time, // 1 + + // masses + stardata->common.zero_age.mass[0], // + stardata->common.zero_age.mass[1], // + + stardata->star[0].mass, + stardata->star[1].mass + ); + """ + + test_pop = Population() + test_pop.set(M_1=10, M_2=5, orbital_period=100000, metallicty=0.02, max_evolution_time = 15000) + + custom_logging_code = binary_c_log_code( + CUSTOM_LOGGING_STRING_MASSES + ) + test_pop.set(custom_logging_code=custom_logging_code) + + output = test_pop.evolve_single() + + print(output) + + + if __name__ == "__main__": unittest.main() -- GitLab