From afc2feefa975a27a0a829ed36075f7b023b50786 Mon Sep 17 00:00:00 2001 From: Sandro Welte Date: Fri, 9 Feb 2024 17:15:12 +0100 Subject: [PATCH 1/8] Comitted Unit Test --- test/test_arithmeticMultiplication_Double.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 test/test_arithmeticMultiplication_Double.c 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); + +} From c6476962229037c18f16cdaa2b4ea2b3e06804ca Mon Sep 17 00:00:00 2001 From: Sandro Welte Date: Fri, 9 Feb 2024 17:15:34 +0100 Subject: [PATCH 2/8] Comitted Unit Test --- test/test_arithmeticMultiplication_Float.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 test/test_arithmeticMultiplication_Float.c 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); + +} From 31ec07eea79504dc6860b2eb42c28bcc3bc5f5f6 Mon Sep 17 00:00:00 2001 From: Sandro Welte Date: Fri, 9 Feb 2024 17:16:00 +0100 Subject: [PATCH 3/8] Comitted Unit Test --- test/test_convert_C_to_F.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 test/test_convert_C_to_F.c 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); +} + From 745dc02d3c751450a2aca7d74a984f04567062a2 Mon Sep 17 00:00:00 2001 From: Sandro Welte Date: Fri, 9 Feb 2024 17:16:21 +0100 Subject: [PATCH 4/8] Comitted Unit Test --- test/test_convert_g_to_mg.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 test/test_convert_g_to_mg.c 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)); +} From 0add8b13362058e253ebf5c3a60497205fd5c93a Mon Sep 17 00:00:00 2001 From: Sandro Welte Date: Fri, 9 Feb 2024 17:16:41 +0100 Subject: [PATCH 5/8] Comitted Unit Test --- test/test_convert_kg_to_g.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 test/test_convert_kg_to_g.c 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)); +} From eb8a6c1cf79c44dca9dd261114a691c32308056a Mon Sep 17 00:00:00 2001 From: Sandro Welte Date: Fri, 9 Feb 2024 17:17:04 +0100 Subject: [PATCH 6/8] Comitted Unit Test --- test/test_convert_kg_to_ton.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 test/test_convert_kg_to_ton.c 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)); +} From 339ea4e1afc93724f28db4f8f8af95ae403c8a6a Mon Sep 17 00:00:00 2001 From: Sandro Welte Date: Fri, 9 Feb 2024 17:17:28 +0100 Subject: [PATCH 7/8] Comitted Unit Test --- test/test_convert_ton_to_kg.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 test/test_convert_ton_to_kg.c 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)); +} From a7c91d523628a2770d25699d9905db47c8c2d55a Mon Sep 17 00:00:00 2001 From: Sandro Welte Date: Fri, 9 Feb 2024 17:17:45 +0100 Subject: [PATCH 8/8] Comitted Unit Test --- test/test_convert_ton_to_mt.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 test/test_convert_ton_to_mt.c 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)); +}