|
@ -0,0 +1,20 @@ |
|
|
|
|
|
#include "unity.h" // Include the Unity header file |
|
|
|
|
|
#include "../src/convert_ton_to_mt.h" // Include the header file containing the function to be tested |
|
|
|
|
|
|
|
|
|
|
|
// Test setup function |
|
|
|
|
|
void setUp(void) { |
|
|
|
|
|
// This function will be called before each test |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Test teardown function |
|
|
|
|
|
void tearDown(void) { |
|
|
|
|
|
// This function will be called after each test |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Test case for tons_to_megatons function |
|
|
|
|
|
void test_tons_to_megatons(void) { |
|
|
|
|
|
// Test case |
|
|
|
|
|
double input = 2500000; // 2.5 million tons |
|
|
|
|
|
double expected_output = 2.5; // 2.5 megatons |
|
|
|
|
|
TEST_ASSERT_EQUAL_DOUBLE(expected_output, tons_to_megatons(input)); |
|
|
|
|
|
} |