diff --git a/build/test/cache/test_sendmoney.c b/build/test/cache/test_sendmoney.c index e5b7922..f3b798b 100644 --- a/build/test/cache/test_sendmoney.c +++ b/build/test/cache/test_sendmoney.c @@ -32,8 +32,14 @@ void test_sendmoney_NeedToImplement(void) int accountNumber2 = 5555557; + + + + int accountNumber3 = 53323; + int accountNumber4 = 34342; + _Bool @@ -52,88 +58,36 @@ void test_sendmoney_NeedToImplement(void) expected3; + + _Bool + expected4; - expected = checkAccount(accountNumber); - - expected2 = checkAccount(accountNumber2); - - expected3 = checkAccount(accountNumber3); - - - - - - - - do {if ((expected)) {} else {UnityFail( ((" Expected TRUE Was FALSE")), (UNITY_UINT)((UNITY_UINT)(31)));}} while(0); - - do {if ((expected2)) {} else {UnityFail( ((" Expected TRUE Was FALSE")), (UNITY_UINT)((UNITY_UINT)(32)));}} while(0); - - do {if ((expected3)) {} else {UnityFail( ((" Expected TRUE Was FALSE")), (UNITY_UINT)((UNITY_UINT)(33)));}} while(0); - -} - - - - - -void test_getAvailableAccountBalance(void) - -{ - - - - - - - - double expected1 = 24.0; - - int leng = 2; - - - - - - - - double result = getAvailableAccountBalance(leng); - - - - - - UnityAssertEqualNumber((UNITY_INT)((expected1)), (UNITY_INT)((result)), ( - - ((void *)0) - - ), (UNITY_UINT)(50), UNITY_DISPLAY_STYLE_INT); -} + expected = checkAccount(accountNumber); -void test_getAmount(void) + expected2 = checkAccount(accountNumber2); -{ + expected3 = checkAccount(accountNumber3); + expected4 = checkAccount(accountNumber4); - float expected = 500.1; - float result = getAmount(expected); + do {if ((expected)) {} else {UnityFail( ((" Expected TRUE Was FALSE")), (UNITY_UINT)((UNITY_UINT)(36)));}} while(0); - UnityAssertEqualNumber((UNITY_INT)((expected)), (UNITY_INT)((result)), ( + do {if ((expected2)) {} else {UnityFail( ((" Expected TRUE Was FALSE")), (UNITY_UINT)((UNITY_UINT)(37)));}} while(0); - ((void *)0) + do {if (!(expected3)) {} else {UnityFail( ((" Expected FALSE Was TRUE")), (UNITY_UINT)((UNITY_UINT)(38)));}} while(0); - ), (UNITY_UINT)(60), UNITY_DISPLAY_STYLE_INT); + do {if (!(expected4)) {} else {UnityFail( ((" Expected FALSE Was TRUE")), (UNITY_UINT)((UNITY_UINT)(39)));}} while(0); } diff --git a/build/test/out/c/sendmoney.o b/build/test/out/c/sendmoney.o index 954e668..50c315a 100644 Binary files a/build/test/out/c/sendmoney.o and b/build/test/out/c/sendmoney.o differ diff --git a/build/test/out/c/test_sendmoney.o b/build/test/out/c/test_sendmoney.o index b1265af..02c6fbd 100644 Binary files a/build/test/out/c/test_sendmoney.o and b/build/test/out/c/test_sendmoney.o differ diff --git a/build/test/out/c/test_sendmoney_runner.o b/build/test/out/c/test_sendmoney_runner.o index 4f50a88..83b78e3 100644 Binary files a/build/test/out/c/test_sendmoney_runner.o and b/build/test/out/c/test_sendmoney_runner.o differ diff --git a/build/test/out/test_sendmoney.out b/build/test/out/test_sendmoney.out index 9a1ae36..af4b838 100644 Binary files a/build/test/out/test_sendmoney.out and b/build/test/out/test_sendmoney.out differ diff --git a/build/test/preprocess/files/test_sendmoney.c b/build/test/preprocess/files/test_sendmoney.c index e5b7922..f3b798b 100644 --- a/build/test/preprocess/files/test_sendmoney.c +++ b/build/test/preprocess/files/test_sendmoney.c @@ -32,8 +32,14 @@ void test_sendmoney_NeedToImplement(void) int accountNumber2 = 5555557; + + + + int accountNumber3 = 53323; + int accountNumber4 = 34342; + _Bool @@ -52,88 +58,36 @@ void test_sendmoney_NeedToImplement(void) expected3; + + _Bool + expected4; - expected = checkAccount(accountNumber); - - expected2 = checkAccount(accountNumber2); - - expected3 = checkAccount(accountNumber3); - - - - - - - - do {if ((expected)) {} else {UnityFail( ((" Expected TRUE Was FALSE")), (UNITY_UINT)((UNITY_UINT)(31)));}} while(0); - - do {if ((expected2)) {} else {UnityFail( ((" Expected TRUE Was FALSE")), (UNITY_UINT)((UNITY_UINT)(32)));}} while(0); - - do {if ((expected3)) {} else {UnityFail( ((" Expected TRUE Was FALSE")), (UNITY_UINT)((UNITY_UINT)(33)));}} while(0); - -} - - - - - -void test_getAvailableAccountBalance(void) - -{ - - - - - - - - double expected1 = 24.0; - - int leng = 2; - - - - - - - - double result = getAvailableAccountBalance(leng); - - - - - - UnityAssertEqualNumber((UNITY_INT)((expected1)), (UNITY_INT)((result)), ( - - ((void *)0) - - ), (UNITY_UINT)(50), UNITY_DISPLAY_STYLE_INT); -} + expected = checkAccount(accountNumber); -void test_getAmount(void) + expected2 = checkAccount(accountNumber2); -{ + expected3 = checkAccount(accountNumber3); + expected4 = checkAccount(accountNumber4); - float expected = 500.1; - float result = getAmount(expected); + do {if ((expected)) {} else {UnityFail( ((" Expected TRUE Was FALSE")), (UNITY_UINT)((UNITY_UINT)(36)));}} while(0); - UnityAssertEqualNumber((UNITY_INT)((expected)), (UNITY_INT)((result)), ( + do {if ((expected2)) {} else {UnityFail( ((" Expected TRUE Was FALSE")), (UNITY_UINT)((UNITY_UINT)(37)));}} while(0); - ((void *)0) + do {if (!(expected3)) {} else {UnityFail( ((" Expected FALSE Was TRUE")), (UNITY_UINT)((UNITY_UINT)(38)));}} while(0); - ), (UNITY_UINT)(60), UNITY_DISPLAY_STYLE_INT); + do {if (!(expected4)) {} else {UnityFail( ((" Expected FALSE Was TRUE")), (UNITY_UINT)((UNITY_UINT)(39)));}} while(0); } diff --git a/build/test/results/test_sendmoney.fail b/build/test/results/test_sendmoney.fail deleted file mode 100644 index 564d36f..0000000 --- a/build/test/results/test_sendmoney.fail +++ /dev/null @@ -1,27 +0,0 @@ ---- -:source: - :path: test - :file: test_sendmoney.c -:successes: -- :test: test_getAmount - :line: 53 - :message: '' - :unity_test_time: 0 -:failures: -- :test: test_sendmoney_NeedToImplement - :line: 33 - :message: Expected TRUE Was FALSE - :unity_test_time: 0 -- :test: test_getAvailableAccountBalance - :line: 50 - :message: Expected 24 Was 0 - :unity_test_time: 0 -:ignores: [] -:counts: - :total: 3 - :passed: 1 - :failed: 2 - :ignored: 0 -:stdout: -- 'your balance is : 0.000000' -:time: 0.06836329999896407 diff --git a/build/test/results/test_sendmoney.pass b/build/test/results/test_sendmoney.pass new file mode 100644 index 0000000..3182902 --- /dev/null +++ b/build/test/results/test_sendmoney.pass @@ -0,0 +1,18 @@ +--- +:source: + :path: test + :file: test_sendmoney.c +:successes: +- :test: test_sendmoney_NeedToImplement + :line: 13 + :message: '' + :unity_test_time: 0 +:failures: [] +:ignores: [] +:counts: + :total: 1 + :passed: 1 + :failed: 0 + :ignored: 0 +:stdout: [] +:time: 0.06175900000016554 diff --git a/build/test/runners/test_sendmoney_runner.c b/build/test/runners/test_sendmoney_runner.c index 8f4a533..63fa0b9 100644 --- a/build/test/runners/test_sendmoney_runner.c +++ b/build/test/runners/test_sendmoney_runner.c @@ -11,8 +11,6 @@ char* GlobalOrderError; extern void setUp(void); extern void tearDown(void); extern void test_sendmoney_NeedToImplement(void); -extern void test_getAvailableAccountBalance(void); -extern void test_getAmount(void); /*=======Mock Management=====*/ @@ -78,8 +76,6 @@ int main(void) { UnityBegin("test_sendmoney.c"); run_test(test_sendmoney_NeedToImplement, "test_sendmoney_NeedToImplement", 13); - run_test(test_getAvailableAccountBalance, "test_getAvailableAccountBalance", 37); - run_test(test_getAmount, "test_getAmount", 53); return UnityEnd(); } diff --git a/src/a.exe b/src/a.exe index c9adfa1..202db17 100644 Binary files a/src/a.exe and b/src/a.exe differ diff --git a/src/sendmoney.c b/src/sendmoney.c index 62e66c0..99efee9 100644 --- a/src/sendmoney.c +++ b/src/sendmoney.c @@ -5,7 +5,7 @@ double getAvailableAccountBalance(int length) double availableBalance; FILE *fp; - fp = fopen("src/CustomerData.txt", "r"); + fp = fopen("CustomerData.txt", "r"); if (fp == 0) { diff --git a/test/test_sendmoney.c b/test/test_sendmoney.c index 28e0d3b..8130bc7 100644 --- a/test/test_sendmoney.c +++ b/test/test_sendmoney.c @@ -16,25 +16,31 @@ void test_sendmoney_NeedToImplement(void) int accountNumber = 1234567; int accountNumber2 = 5555557; - int accountNumber3 = 5332323; + + // hier soll false sein + int accountNumber3 = 53323; + int accountNumber4 = 34342; bool expected; bool expected2; bool expected3; + bool expected4; // Act expected = checkAccount(accountNumber); expected2 = checkAccount(accountNumber2); expected3 = checkAccount(accountNumber3); + expected4 = checkAccount(accountNumber4); // Assert TEST_ASSERT_TRUE(expected); TEST_ASSERT_TRUE(expected2); - TEST_ASSERT_TRUE(expected3); + TEST_ASSERT_FALSE(expected3); + TEST_ASSERT_FALSE(expected4); } // hier wird die Methode getAvailableAccountBalance()getestet -void test_getAvailableAccountBalance(void) +/*void test_getAvailableAccountBalance(void) { // Arrage @@ -58,6 +64,6 @@ void test_getAmount(void) float result = getAmount(expected); TEST_ASSERT_EQUAL(expected, result); -} +}*/ #endif // TEST