Browse Source

Merge branch 'testing' into 'main'

Testing in Main

See merge request fdai7812/theadmirals!11
main
fdai7728 11 months ago
parent
commit
27df8b6ddd
  1. 18
      test/test_arithmeticMultiplication_Double.c
  2. 18
      test/test_arithmeticMultiplication_Float.c
  3. 28
      test/test_convert_C_to_F.c
  4. 20
      test/test_convert_g_to_mg.c
  5. 21
      test/test_convert_kg_to_g.c
  6. 20
      test/test_convert_kg_to_ton.c
  7. 20
      test/test_convert_ton_to_kg.c
  8. 20
      test/test_convert_ton_to_mt.c

18
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);
}

18
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);
}

28
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);
}

20
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));
}

21
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));
}

20
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));
}

20
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));
}

20
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));
}
Loading…
Cancel
Save