Browse Source

added test for the meter to foot and cm to inch converter

remotes/origin/develop
Sandro Welte 11 months ago
parent
commit
e7700f8faf
  1. 29
      test/test_convert_m_to_ft.c

29
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
Loading…
Cancel
Save