|
@ -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 |