Browse Source

test Case false for sendmoney_NeedToIMplement

remotes/origin/feature/send-money
fdai6618 2 years ago
parent
commit
1e9f443da9
  1. 78
      build/test/cache/test_sendmoney.c
  2. BIN
      build/test/out/c/sendmoney.o
  3. BIN
      build/test/out/c/test_sendmoney.o
  4. BIN
      build/test/out/c/test_sendmoney_runner.o
  5. BIN
      build/test/out/test_sendmoney.out
  6. 78
      build/test/preprocess/files/test_sendmoney.c
  7. 27
      build/test/results/test_sendmoney.fail
  8. 18
      build/test/results/test_sendmoney.pass
  9. 4
      build/test/runners/test_sendmoney_runner.c
  10. BIN
      src/a.exe
  11. 2
      src/sendmoney.c
  12. 14
      test/test_sendmoney.c

78
build/test/cache/test_sendmoney.c

@ -32,8 +32,14 @@ void test_sendmoney_NeedToImplement(void)
int accountNumber2 = 5555557; int accountNumber2 = 5555557;
int accountNumber3 = 53323; int accountNumber3 = 53323;
int accountNumber4 = 34342;
_Bool _Bool
@ -54,86 +60,34 @@ void test_sendmoney_NeedToImplement(void)
_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);
} }

BIN
build/test/out/c/sendmoney.o

BIN
build/test/out/c/test_sendmoney.o

BIN
build/test/out/c/test_sendmoney_runner.o

BIN
build/test/out/test_sendmoney.out

78
build/test/preprocess/files/test_sendmoney.c

@ -32,8 +32,14 @@ void test_sendmoney_NeedToImplement(void)
int accountNumber2 = 5555557; int accountNumber2 = 5555557;
int accountNumber3 = 53323; int accountNumber3 = 53323;
int accountNumber4 = 34342;
_Bool _Bool
@ -54,86 +60,34 @@ void test_sendmoney_NeedToImplement(void)
_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);
} }

27
build/test/results/test_sendmoney.fail

@ -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

18
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

4
build/test/runners/test_sendmoney_runner.c

@ -11,8 +11,6 @@ char* GlobalOrderError;
extern void setUp(void); extern void setUp(void);
extern void tearDown(void); extern void tearDown(void);
extern void test_sendmoney_NeedToImplement(void); extern void test_sendmoney_NeedToImplement(void);
extern void test_getAvailableAccountBalance(void);
extern void test_getAmount(void);
/*=======Mock Management=====*/ /*=======Mock Management=====*/
@ -78,8 +76,6 @@ int main(void)
{ {
UnityBegin("test_sendmoney.c"); UnityBegin("test_sendmoney.c");
run_test(test_sendmoney_NeedToImplement, "test_sendmoney_NeedToImplement", 13); 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(); return UnityEnd();
} }

BIN
src/a.exe

2
src/sendmoney.c

@ -5,7 +5,7 @@ double getAvailableAccountBalance(int length)
double availableBalance; double availableBalance;
FILE *fp; FILE *fp;
fp = fopen("src/CustomerData.txt", "r");
fp = fopen("CustomerData.txt", "r");
if (fp == 0) if (fp == 0)
{ {

14
test/test_sendmoney.c

@ -16,25 +16,31 @@ void test_sendmoney_NeedToImplement(void)
int accountNumber = 1234567; int accountNumber = 1234567;
int accountNumber2 = 5555557; int accountNumber2 = 5555557;
int accountNumber3 = 5332323;
// hier soll false sein
int accountNumber3 = 53323;
int accountNumber4 = 34342;
bool expected; bool expected;
bool expected2; bool expected2;
bool expected3; bool expected3;
bool expected4;
// Act // Act
expected = checkAccount(accountNumber); expected = checkAccount(accountNumber);
expected2 = checkAccount(accountNumber2); expected2 = checkAccount(accountNumber2);
expected3 = checkAccount(accountNumber3); expected3 = checkAccount(accountNumber3);
expected4 = checkAccount(accountNumber4);
// Assert // Assert
TEST_ASSERT_TRUE(expected); TEST_ASSERT_TRUE(expected);
TEST_ASSERT_TRUE(expected2); TEST_ASSERT_TRUE(expected2);
TEST_ASSERT_TRUE(expected3);
TEST_ASSERT_FALSE(expected3);
TEST_ASSERT_FALSE(expected4);
} }
// hier wird die Methode getAvailableAccountBalance()getestet // hier wird die Methode getAvailableAccountBalance()getestet
void test_getAvailableAccountBalance(void)
/*void test_getAvailableAccountBalance(void)
{ {
// Arrage // Arrage
@ -58,6 +64,6 @@ void test_getAmount(void)
float result = getAmount(expected); float result = getAmount(expected);
TEST_ASSERT_EQUAL(expected, result); TEST_ASSERT_EQUAL(expected, result);
}
}*/
#endif // TEST #endif // TEST
Loading…
Cancel
Save