update the struct test so that field c of the test struct is of type double
This commit is contained in:
@@ -35,11 +35,11 @@ int struct_testExpected(char *name, long expected, long result)
|
||||
|
||||
int testStructCreation() {
|
||||
printf("\nStruct creation tests\n");
|
||||
struct testStruct* result = getTestStruct(1, false, 20);
|
||||
struct testStruct* result = getTestStruct(1, false, 23.3);
|
||||
|
||||
struct_testExpected("init field a", 1, result->a);
|
||||
struct_testExpected("init field b", false, result->b);
|
||||
struct_testExpected("init field c", 20, result->c);
|
||||
struct_testExpected("init field c", 23.3, result->c);
|
||||
|
||||
free(result);
|
||||
|
||||
@@ -58,11 +58,11 @@ int testStructCreation() {
|
||||
|
||||
int testStructGet() {
|
||||
printf("\nStruct getter tests\n");
|
||||
struct testStruct* result = getTestStruct(1, false, 20);
|
||||
struct testStruct* result = getTestStruct(1, false, 23.3);
|
||||
|
||||
struct_testExpected("get field a", 1, getStructFieldA(result));
|
||||
struct_testExpected("get field b", false, getStructFieldB(result));
|
||||
struct_testExpected("get field c", 20, getStructFieldC(result));
|
||||
struct_testExpected("get field c", 23.3, getStructFieldC(result));
|
||||
|
||||
free(result);
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ struct testStruct
|
||||
{
|
||||
long a;
|
||||
bool b;
|
||||
long c;
|
||||
double c;
|
||||
};
|
||||
|
||||
struct testStructRec
|
||||
@@ -13,16 +13,16 @@ struct testStructRec
|
||||
struct testStructRec *b;
|
||||
};
|
||||
|
||||
struct testStruct* getTestStruct(long a, bool b, long c);
|
||||
struct testStruct* getTestStruct(long a, bool b, double c);
|
||||
struct testStructRec* getTestStructRec(long a, struct testStructRec* b);
|
||||
|
||||
long getStructFieldA(struct testStruct *);
|
||||
bool getStructFieldB(struct testStruct *);
|
||||
long getStructFieldC(struct testStruct *);
|
||||
double getStructFieldC(struct testStruct *);
|
||||
|
||||
struct testStruct *setStructFieldA(struct testStruct *t, long a);
|
||||
struct testStruct *setStructFieldB(struct testStruct *t, bool b);
|
||||
struct testStruct *setStructFieldC(struct testStruct *t, long c);
|
||||
struct testStruct *setStructFieldC(struct testStruct *t, double c);
|
||||
|
||||
long getStructFieldRecA(struct testStructRec *t);
|
||||
struct testStructRec *getStructFieldRecB(struct testStructRec *t);
|
||||
|
||||
Reference in New Issue
Block a user