From e7700f8faf785caa218ec909ae84b74da16076ed Mon Sep 17 00:00:00 2001 From: Sandro Welte Date: Thu, 8 Feb 2024 17:24:58 +0100 Subject: [PATCH] added test for the meter to foot and cm to inch converter --- test/test_convert_m_to_ft.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 test/test_convert_m_to_ft.c diff --git a/test/test_convert_m_to_ft.c b/test/test_convert_m_to_ft.c new file mode 100644 index 0000000..8c117a8 --- /dev/null +++ b/test/test_convert_m_to_ft.c @@ -0,0 +1,29 @@ + +#include "../src/convert_m_to_ft.h" +#include "unity.h" +#include "limits.h" + +void setUp(void) { + // Set up resources here if needed +} + +void tearDown(void) { + // Clean up resources here if needed +} + +void test_convert_length(void) { + float value = 10.0; + char from_unit = 'm'; + char to_unit = 'f'; + + // Perform the conversion + float result = convert_length(value, from_unit, to_unit); + + // Define the expected result (10 meters to feet is approximately 32.81 feet) + float expectedResult = 32.81; + + // Assert the result + TEST_ASSERT_EQUAL_FLOAT(expectedResult, result); +} + +// Note: No main function needed in unit tests \ No newline at end of file