From ef307cac167198a4efcf5272df7b8df056807015 Mon Sep 17 00:00:00 2001 From: fdai7514 Date: Sun, 5 Feb 2023 00:13:48 +0100 Subject: [PATCH] refactoring: change variable names in test_calculatorAdd.c --- tests/test_calculatorAdd.c | 127 +++++++++++++++++++------------------ 1 file changed, 67 insertions(+), 60 deletions(-) diff --git a/tests/test_calculatorAdd.c b/tests/test_calculatorAdd.c index 0c55e52..3e22349 100644 --- a/tests/test_calculatorAdd.c +++ b/tests/test_calculatorAdd.c @@ -4,6 +4,13 @@ #include "calculatorAdd.c" + + +// Note: +/* This Function may or may not be implemented in actual program, even if it is merged to the main branch. + If it is temporarily not included in the main Program, then this has a role in future Development of the Project */ + + void setUp(void) { } @@ -14,102 +21,102 @@ void tearDown(void) void test1_calculatorAdd(void) { - float x, y, a ,e; - x = 26.24; - y = 23.22; - a = calculatorAdd(x, y); - e = x + y; - TEST_ASSERT_EQUAL_FLOAT(e, a); + float num1, num2, actual ,expected; //Arrange + num1 = 26.24; + num2 = 23.22; + actual = calculatorAdd(num1, num2); //Act + expected = num1 + num2; + TEST_ASSERT_EQUAL_FLOAT(expected, actual); //Assert } void test2_calculatorAdd(void) { - float x, y, a ,e; - x = 56.24; - y = 233.22; - a = calculatorAdd(x, y); - e = x + y; - TEST_ASSERT_EQUAL_FLOAT(e, a); + float num1, num2, actual ,expected; //Arrange + num1 = 56.24; + num2 = 233.22; + actual = calculatorAdd(num1, num2); //Act + expected = num1 + num2; + TEST_ASSERT_EQUAL_FLOAT(expected, actual); //Assert } void test3_calculatorAdd(void) { - float x, y, a ,e; - x = 1226.24; - y = 323.22; - a = calculatorAdd(x, y); - e = x + y; - TEST_ASSERT_EQUAL_FLOAT(e, a); + float num1, num2, actual ,expected; //Arrange + num1 = 1226.24; + num2 = 323.22; + actual = calculatorAdd(num1, num2); //Act + expected = num1 + num2; + TEST_ASSERT_EQUAL_FLOAT(expected, actual); //Assert } void test4_calculatorAdd(void) { - float x, y, a ,e; - x = 2623.24; - y = 2323.22; - a = calculatorAdd(x, y); - e = x + y; - TEST_ASSERT_EQUAL_FLOAT(e, a); + float num1, num2, actual ,expected; //Arrange + num1 = 2623.24; + num2 = 2323.22; + actual = calculatorAdd(num1, num2); //Act + expected = num1 + num2; + TEST_ASSERT_EQUAL_FLOAT(expected, actual); //Assert } void test5_calculatorAdd(void) { - float x, y, a ,e; - x = 2435.24; - y = 23423.22; - a = calculatorAdd(x, y); - e = x + y; - TEST_ASSERT_EQUAL_FLOAT(e, a); + float num1, num2, actual ,expected; //Arrange + num1 = 2435.24; + num2 = 23423.22; + actual = calculatorAdd(num1, num2); //Act + expected = num1 + num2; + TEST_ASSERT_EQUAL_FLOAT(expected, actual); //Assert } void test6_calculatorAdd(void) { - float x, y, a ,e; - x = 4534.24; - y = 2221.22; - a = calculatorAdd(x, y); - e = x + y; - TEST_ASSERT_EQUAL_FLOAT(e, a); + float num1, num2, actual ,expected; //Arrange + num1 = 4534.24; + num2 = 2221.22; + actual = calculatorAdd(num1, num2); //Act + expected = num1 + num2; + TEST_ASSERT_EQUAL_FLOAT(expected, actual); //Assert } void test7_calculatorAdd(void) { - float x, y, a ,e; - x = 26322.24; - y = 2332.222; - a = calculatorAdd(x, y); - e = x + y; - TEST_ASSERT_EQUAL_FLOAT(e, a); + float num1, num2, actual ,expected; //Arrange + num1 = 26322.24; + num2 = 2332.222; + actual = calculatorAdd(num1, num2); //Act + expected = num1 + num2; + TEST_ASSERT_EQUAL_FLOAT(expected, actual); //Assert } void test8_calculatorAdd(void) { - float x, y, a ,e; - x = 26132.24; - y = 2331122.222; - a = calculatorAdd(x, y); - e = x + y; - TEST_ASSERT_EQUAL_FLOAT(e, a); + float num1, num2, actual ,expected; //Arrange + num1 = 26132.24; + num2 = 2331122.222; + actual = calculatorAdd(num1, num2); //Act + expected = num1 + num2; + TEST_ASSERT_EQUAL_FLOAT(expected, actual); //Assert } void test9_calculatorAdd(void) { - float x, y, a ,e; - x = 6322.24; - y = 21232.2322; - a = calculatorAdd(x, y); - e = x + y; - TEST_ASSERT_EQUAL_FLOAT(e, a); + float num1, num2, actual ,expected; //Arrange + num1 = 6322.24; + num2 = 21232.2322; + actual = calculatorAdd(num1, num2); //Act + expected = num1 + num2; + TEST_ASSERT_EQUAL_FLOAT(expected, actual); //Assert } void test10_calculatorAdd(void) { - float x, y, a ,e; - x = 1234.456; - y = 654.4321; - a = calculatorAdd(x, y); - e = x + y; - TEST_ASSERT_EQUAL_FLOAT(e, a); + float num1, num2, actual ,expected; //Arrange + num1 = 1234.456; + num2 = 654.4321; + actual = calculatorAdd(num1, num2); //Act + expected = num1 + num2; + TEST_ASSERT_EQUAL_FLOAT(expected, actual); //Assert } #endif // TEST