Commit 42d19530 authored by Purves, Murray's avatar Purves, Murray
Browse files

Integrating python test with CTest

parent 02d269e9
Pipeline #39789 passed with stages
in 16 minutes and 53 seconds
......@@ -4,3 +4,20 @@ ADD_GOOGLE_TEST(tstInterpolate.cc NP 1)
ADD_GOOGLE_TEST(tstLognormal.cc NP 1)
ADD_GOOGLE_TEST(tstMatrix.cc NP 1)
ADD_GOOGLE_TEST(tstUtil.cc NP 1)
# Add the Python test
IF(ENABLE_PYTHON_WRAPPERS)
SET(INTERPOLATE_PYTHON_TEST_NAME tst_interpolate_py)
SET(INTERPOLATE_PYTHON_TEST_FILE test_interpolate.py)
TRIBITS_ADD_ADVANCED_TEST(
${INTERPOLATE_PYTHON_TEST_NAME}
OVERALL_WORKING_DIRECTORY TEST_NAME
TEST_0
CMND ${CMAKE_COMMAND}
ARGS -E copy "${CMAKE_CURRENT_SOURCE_DIR}/${INTERPOLATE_PYTHON_TEST_FILE}" "${CMAKE_CURRENT_BINARY_DIR}/../python/${INTERPOLATE_PYTHON_TEST_FILE}"
TEST_1
CMND "python"
ARGS "../../python/${INTERPOLATE_PYTHON_TEST_FILE}"
PASS_REGULAR_EXPRESSION "OK"
)
ENDIF()
\ No newline at end of file
......@@ -23,7 +23,8 @@ class TestInterpolateBindings(unittest.TestCase):
base_values, interp_values, logarithmic, circular, missing_value
)
self.assertEqual(expect_values, test_values)
for i in range(0, len(expect_values)):
self.assertAlmostEqual(expect_values[i], test_values[i])
def test_interpolate_log_basic(self):
# Basic test of interpolate_values
......@@ -40,7 +41,8 @@ class TestInterpolateBindings(unittest.TestCase):
base_values, interp_values, logarithmic, circular, missing_value
)
self.assertEqual(expect_values, test_values)
for i in range(0, len(expect_values)):
self.assertAlmostEqual(expect_values[i], test_values[i])
def test_interpolate_to_other_base_basic(self):
print("Testing interpolate_to_other_base_values (linear)...")
......@@ -57,7 +59,8 @@ class TestInterpolateBindings(unittest.TestCase):
circular, missing_value
)
self.assertEqual(expect_values, test_values)
for i in range(0, len(expect_values)):
self.assertAlmostEqual(expect_values[i], test_values[i])
def test_interpolate_to_other_base_basic_log(self):
print("Testing interpolate_to_other_base_values (logarithmic)...")
......@@ -74,7 +77,8 @@ class TestInterpolateBindings(unittest.TestCase):
circular, missing_value
)
self.assertEqual(expect_values, test_values)
for i in range(0, len(expect_values)):
self.assertAlmostEqual(expect_values[i], test_values[i])
if __name__ == '__main__':
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment