diff --git a/test/test_arithmeticMultiplication_Double.c b/test/test_arithmeticMultiplication_Double.c new file mode 100644 index 0000000..2077e91 --- /dev/null +++ b/test/test_arithmeticMultiplication_Double.c @@ -0,0 +1,18 @@ +#include "unity.h" +#include "../src/arithmeticMultiplication_Double.h" +#include "limits.h" + +void setUp(void) { + // set up code here +} + +void tearDown(void) { + // clean up code here +} + +void test_arithmeticMultiplication_doubletimesdoubleequalsdouble(void) { + double expectedResult = 10.0; + double* result = multiplication_double(2.0, 5.0); + TEST_ASSERT_EQUAL_DOUBLE(expectedResult, *result); + +} diff --git a/test/test_arithmeticMultiplication_Float.c b/test/test_arithmeticMultiplication_Float.c new file mode 100644 index 0000000..8121145 --- /dev/null +++ b/test/test_arithmeticMultiplication_Float.c @@ -0,0 +1,18 @@ +#include "unity.h" +#include "../src/arithmeticMultiplication_Float.h" +#include "limits.h" + +void setUp(void) { + // set up code here +} + +void tearDown(void) { + // clean up code here +} + +void test_arithmeticMultiplication_floattimesfloatequalsfloat(void) { + float expectedResult = 10.0f; + float* result = multiplication_float(2.0f, 5.0f); + TEST_ASSERT_EQUAL_FLOAT(expectedResult, *result); + +} diff --git a/test/test_convert_C_to_F.c b/test/test_convert_C_to_F.c new file mode 100644 index 0000000..a657ecb --- /dev/null +++ b/test/test_convert_C_to_F.c @@ -0,0 +1,28 @@ +#include "../src/convert_C_to_F.h" +#include "unity.h" +#include "limits.h" + + +void setUp(void) { + +} + +void tearDown(void) { + // Clean up resources here if needed +} + +void test_convert_temperature(void) { + float temperature = 100.0; + char from_unit = 'c'; + char to_unit = 'f'; + + // Perform the conversion + float result = convert_temperature(temperature, from_unit, to_unit); + + // Define the expected result (100 degrees Celsius to Fahrenheit is 212) + float expectedResult = 212; + + // Assert the result + TEST_ASSERT_EQUAL_FLOAT(expectedResult, result); +} + diff --git a/test/test_convert_g_to_mg.c b/test/test_convert_g_to_mg.c new file mode 100644 index 0000000..46b6755 --- /dev/null +++ b/test/test_convert_g_to_mg.c @@ -0,0 +1,20 @@ +#include "unity.h" // Include the Unity header file +#include "../src/convert_g_to_mg.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) { + +} + +// Test case for g_to_mg function +void test_g_to_mg(void) { + // Test case + double input = 1.0; + double expected_output = 1000.0; + TEST_ASSERT_EQUAL_DOUBLE(expected_output, g_to_mg(input)); +} diff --git a/test/test_convert_kg_to_g.c b/test/test_convert_kg_to_g.c new file mode 100644 index 0000000..53d0fd8 --- /dev/null +++ b/test/test_convert_kg_to_g.c @@ -0,0 +1,21 @@ +#include "unity.h" +#include "../src/convert_kg_to_g.h" + + + +void setUp(void) { + +} + +// Test teardown function +void tearDown(void) { + // This function will be called after each test +} + +// Test case for kg_to_gram function +void test_kg_to_gram(void) { + // Test case + double input = 2.5; + double expected_output = 2500.0; + TEST_ASSERT_EQUAL_DOUBLE(expected_output, kg_to_gram(input)); +} diff --git a/test/test_convert_kg_to_ton.c b/test/test_convert_kg_to_ton.c new file mode 100644 index 0000000..d68b700 --- /dev/null +++ b/test/test_convert_kg_to_ton.c @@ -0,0 +1,20 @@ +#include "unity.h" // Include the Unity header file +#include "../src/convert_kg_to_ton.h" + +// Test setup function +void setUp(void) { + +} + +// Test teardown function +void tearDown(void) { + // This function will be called after each test +} + +// Test case for kg_to_tons function +void test_kg_to_tons(void) { + // Test case + double input = 2500.0; + double expected_output = 2.5; + TEST_ASSERT_EQUAL_DOUBLE(expected_output, kg_to_tons(input)); +} diff --git a/test/test_convert_ton_to_kg.c b/test/test_convert_ton_to_kg.c new file mode 100644 index 0000000..9d7ad2c --- /dev/null +++ b/test/test_convert_ton_to_kg.c @@ -0,0 +1,20 @@ +#include "unity.h" // Include the Unity header file +#include "../src/convert_ton_to_kg.h" +#include "limits.h" +// 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_kg function +void test_tons_to_kg(void) { + // Test case + double input = 2.5; + double expected_output = 2500.0; + TEST_ASSERT_EQUAL_DOUBLE(expected_output, tons_to_kg(input)); +} diff --git a/test/test_convert_ton_to_mt.c b/test/test_convert_ton_to_mt.c new file mode 100644 index 0000000..bce3793 --- /dev/null +++ b/test/test_convert_ton_to_mt.c @@ -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)); +}