diff --git a/build/test/cache/test_add.c b/build/test/cache/test_add.c index 6d44467..fe4db9b 100644 --- a/build/test/cache/test_add.c +++ b/build/test/cache/test_add.c @@ -20,7 +20,7 @@ void tearDown(void){ -void test_adding_whole_numbers(void){ +void test_pow_N_N(void){ @@ -28,7 +28,7 @@ void test_adding_whole_numbers(void){ double b = 3; - double a = 3.5; + double a = 3; @@ -40,10 +40,40 @@ void test_adding_whole_numbers(void){ - UnityAssertEqualNumber((UNITY_INT)((42.875)), (UNITY_INT)((result)), ( + UnityAssertEqualNumber((UNITY_INT)((27)), (UNITY_INT)((result)), ( ((void *)0) ), (UNITY_UINT)(23), UNITY_DISPLAY_STYLE_INT); } + + + +void test_pow_Z_N(void){ + + + + double result; + + double b = 3; + + double a = -3; + + + + + + result = pow(a, b); + + + + + + UnityAssertEqualNumber((UNITY_INT)((-27)), (UNITY_INT)((result)), ( + + ((void *)0) + + ), (UNITY_UINT)(36), UNITY_DISPLAY_STYLE_INT); + +} diff --git a/build/test/out/c/test_add.o b/build/test/out/c/test_add.o index fbad07a..463b836 100644 Binary files a/build/test/out/c/test_add.o and b/build/test/out/c/test_add.o differ diff --git a/build/test/out/c/test_add_runner.o b/build/test/out/c/test_add_runner.o index b71ce1f..2d20162 100644 Binary files a/build/test/out/c/test_add_runner.o and b/build/test/out/c/test_add_runner.o differ diff --git a/build/test/out/test_add.out b/build/test/out/test_add.out index 6fb35d3..f62e043 100755 Binary files a/build/test/out/test_add.out and b/build/test/out/test_add.out differ diff --git a/build/test/preprocess/files/test_add.c b/build/test/preprocess/files/test_add.c index 6d44467..fe4db9b 100644 --- a/build/test/preprocess/files/test_add.c +++ b/build/test/preprocess/files/test_add.c @@ -20,7 +20,7 @@ void tearDown(void){ -void test_adding_whole_numbers(void){ +void test_pow_N_N(void){ @@ -28,7 +28,7 @@ void test_adding_whole_numbers(void){ double b = 3; - double a = 3.5; + double a = 3; @@ -40,10 +40,40 @@ void test_adding_whole_numbers(void){ - UnityAssertEqualNumber((UNITY_INT)((42.875)), (UNITY_INT)((result)), ( + UnityAssertEqualNumber((UNITY_INT)((27)), (UNITY_INT)((result)), ( ((void *)0) ), (UNITY_UINT)(23), UNITY_DISPLAY_STYLE_INT); } + + + +void test_pow_Z_N(void){ + + + + double result; + + double b = 3; + + double a = -3; + + + + + + result = pow(a, b); + + + + + + UnityAssertEqualNumber((UNITY_INT)((-27)), (UNITY_INT)((result)), ( + + ((void *)0) + + ), (UNITY_UINT)(36), UNITY_DISPLAY_STYLE_INT); + +} diff --git a/build/test/results/test_add.pass b/build/test/results/test_add.pass index 534e901..4deef9a 100644 --- a/build/test/results/test_add.pass +++ b/build/test/results/test_add.pass @@ -3,16 +3,20 @@ :path: test/Calculator :file: test_add.c :successes: -- :test: test_adding_whole_numbers +- :test: test_pow_N_N :line: 13 :message: '' :unity_test_time: 0 +- :test: test_pow_Z_N + :line: 26 + :message: '' + :unity_test_time: 0 :failures: [] :ignores: [] :counts: - :total: 1 - :passed: 1 + :total: 2 + :passed: 2 :failed: 0 :ignored: 0 :stdout: [] -:time: 0.006848459015600383 +:time: 0.007150935009121895 diff --git a/build/test/results/test_template.pass b/build/test/results/test_template.pass index 6bdd5e9..493caaa 100644 --- a/build/test/results/test_template.pass +++ b/build/test/results/test_template.pass @@ -19,4 +19,4 @@ :failed: 0 :ignored: 0 :stdout: [] -:time: 0.00312035801471211 +:time: 0.004427945998031646 diff --git a/build/test/runners/test_add_runner.c b/build/test/runners/test_add_runner.c index b5d375c..6897488 100644 --- a/build/test/runners/test_add_runner.c +++ b/build/test/runners/test_add_runner.c @@ -10,7 +10,8 @@ char* GlobalOrderError; /*=======External Functions This Runner Calls=====*/ extern void setUp(void); extern void tearDown(void); -extern void test_adding_whole_numbers(void); +extern void test_pow_N_N(void); +extern void test_pow_Z_N(void); /*=======Mock Management=====*/ @@ -75,7 +76,8 @@ static void run_test(UnityTestFunction func, const char* name, UNITY_LINE_TYPE l int main(void) { UnityBegin("test_add.c"); - run_test(test_adding_whole_numbers, "test_adding_whole_numbers", 13); + run_test(test_pow_N_N, "test_pow_N_N", 13); + run_test(test_pow_Z_N, "test_pow_Z_N", 26); return UnityEnd(); } diff --git a/test/Calculator/test_add.c b/test/Calculator/test_add.c index 8eee0b1..e6d3a56 100644 --- a/test/Calculator/test_add.c +++ b/test/Calculator/test_add.c @@ -10,17 +10,31 @@ void tearDown(void){ } -void test_adding_whole_numbers(void){ +void test_pow_N_N(void){ /* arrange */ double result; double b = 3; - double a = 3.5; + double a = 3; /* act */ result = pow(a, b); /* assert */ - TEST_ASSERT_EQUAL_INT(42.875, result);//3 * 3 * 3 = 27 + TEST_ASSERT_EQUAL_INT(27, result);//3 * 3 * 3 = 27 } +void test_pow_Z_N(void){ + /* arrange */ + double result; + double b = 3; + double a = -3; + + /* act */ + result = pow(a, b); + + /* assert */ + TEST_ASSERT_EQUAL_INT(-27, result);//3 * 3 * 3 = 27 +} + + #endif // TEST