- improved globals and expected initializatian and testing
This commit is contained in:
@@ -63,13 +63,25 @@ STATIC void createVariableSpecificInit(const char* aVariableTemplate, FILE *aFil
|
||||
return;
|
||||
}
|
||||
|
||||
if (NULL != strstr(aVariable->dataType, "*"))
|
||||
if (NULL != strstr(aVariable->dataType, "*") || aVariable->array)
|
||||
{
|
||||
fprintf(aFile, aVariableTemplate, aVariable->name);
|
||||
fprintf(aFile, " = NULL;" NEWLINES);
|
||||
if (aVariable->array)
|
||||
{
|
||||
fprintf(aFile, "\t(void) memset(");
|
||||
fprintf(aFile, aVariableTemplate, aVariable->name);
|
||||
fprintf(aFile, ", 0x55, sizeof(%s)); /* %s */" NEWLINES, aVariable->name, aVariable->dataType);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(aFile, "\t");
|
||||
fprintf(aFile, aVariableTemplate, aVariable->name);
|
||||
fprintf(aFile, " = NULL;" NEWLINES);
|
||||
}
|
||||
|
||||
}
|
||||
else if (isDatatypeStandard(aVariable))
|
||||
{
|
||||
fprintf(aFile, "\t");
|
||||
fprintf(aFile, aVariableTemplate, aVariable->name);
|
||||
fprintf(aFile, " = 0x55;" NEWLINES);
|
||||
}
|
||||
@@ -77,7 +89,7 @@ STATIC void createVariableSpecificInit(const char* aVariableTemplate, FILE *aFil
|
||||
{
|
||||
fprintf(aFile, "\t(void) memset(&");
|
||||
fprintf(aFile, aVariableTemplate, aVariable->name);
|
||||
fprintf(aFile, ",0x55,sizeof(%s)); /* %s */" NEWLINES, aVariable->name, aVariable->dataType);
|
||||
fprintf(aFile, ", 0x55, sizeof(%s)); /* %s */" NEWLINES, aVariable->name, aVariable->dataType);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,9 +100,18 @@ STATIC void createVariableSpecificCheck(FILE *aFile, cfile_variable_t *aVariable
|
||||
return;
|
||||
}
|
||||
|
||||
if (NULL != strstr(aVariable->dataType, "*"))
|
||||
if (NULL != strstr(aVariable->dataType, "*") || aVariable->array)
|
||||
{
|
||||
fprintf(aFile, "\tCU_ASSERT_PTR_EQUAL(%s, "STUBVARIABLE_EXTENDED_S1");"NEWLINES, aVariable->name, aVariable->name);
|
||||
if (aVariable->array)
|
||||
{
|
||||
fprintf(aFile, "\tCU_ASSERT_MEMORY_CHECK(\"%s\", %s, "STUBVARIABLE_EXTENDED_S1", sizeof(%s));"NEWLINES, aVariable->name, aVariable->name,
|
||||
aVariable->name, aVariable->name);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(aFile, "\tCU_ASSERT_PTR_EQUAL(%s, "STUBVARIABLE_EXTENDED_S1");"NEWLINES, aVariable->name, aVariable->name);
|
||||
}
|
||||
|
||||
}
|
||||
else if (isDatatypeStandard(aVariable))
|
||||
{
|
||||
@@ -98,8 +119,8 @@ STATIC void createVariableSpecificCheck(FILE *aFile, cfile_variable_t *aVariable
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(aFile, "\tCU_ASSERT_MEMORY_CHECK(\"%s\", &%s, &"STUBVARIABLE_EXTENDED_S1", sizeof(%s));"NEWLINES, aVariable->name, aVariable->name, aVariable->name,
|
||||
aVariable->name);
|
||||
fprintf(aFile, "\tCU_ASSERT_MEMORY_CHECK(\"%s\", &%s, &"STUBVARIABLE_EXTENDED_S1", sizeof(%s));"NEWLINES, aVariable->name, aVariable->name,
|
||||
aVariable->name, aVariable->name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,13 +140,13 @@ STATIC int8_t createStubExpected(char *aNoSuffix, FILE *aFile, FILE *aHeader, cf
|
||||
work = aList->head;
|
||||
while (work)
|
||||
{
|
||||
if (CVARIABLE_TYPE_REGULAR != work->type)
|
||||
if (CVARIABLE_TYPE_REGULAR != work->type || NULL != strstr(work->dataType, "const"))
|
||||
{
|
||||
work = work->next;
|
||||
continue;
|
||||
}
|
||||
fprintf(aFile, "%s "STUBVARIABLE_EXTENDED_S1";"NEWLINES, work->dataType, work->name);
|
||||
fprintf(aHeader, "extern %s "STUBVARIABLE_EXTENDED_S1";"NEWLINES, work->dataType, work->name);
|
||||
fprintf(aFile, "%s "STUBVARIABLE_EXTENDED_S1"%s;"NEWLINES, work->dataType, work->name, (work->array ? work->array : ""));
|
||||
fprintf(aHeader, "extern %s "STUBVARIABLE_EXTENDED_S1"%s;"NEWLINES, work->dataType, work->name, (work->array ? work->array : ""));
|
||||
work = work->next;
|
||||
}
|
||||
|
||||
@@ -140,7 +161,7 @@ STATIC int8_t createStubExpected(char *aNoSuffix, FILE *aFile, FILE *aHeader, cf
|
||||
work = work->next;
|
||||
continue;
|
||||
}
|
||||
createVariableSpecificInit("\t"STUBVARIABLE_EXTENDED_S1, aFile, work);
|
||||
createVariableSpecificInit(STUBVARIABLE_EXTENDED_S1, aFile, work);
|
||||
work = work->next;
|
||||
}
|
||||
|
||||
@@ -170,8 +191,8 @@ STATIC int8_t createStubGlobals(char *aNoSuffix, FILE *aFile, FILE *aHeader, cfi
|
||||
work = work->next;
|
||||
continue;
|
||||
}
|
||||
fprintf(aFile, "%s %s;"NEWLINES, work->dataType, work->name);
|
||||
fprintf(aHeader, "extern %s %s;"NEWLINES, work->dataType, work->name);
|
||||
fprintf(aFile, "%s %s%s;"NEWLINES, work->dataType, work->name, (work->array ? work->array : ""));
|
||||
fprintf(aHeader, "extern %s %s%s;"NEWLINES, work->dataType, work->name, (work->array ? work->array : ""));
|
||||
work = work->next;
|
||||
}
|
||||
|
||||
@@ -185,7 +206,7 @@ STATIC int8_t createStubGlobals(char *aNoSuffix, FILE *aFile, FILE *aHeader, cfi
|
||||
work = work->next;
|
||||
continue;
|
||||
}
|
||||
createVariableSpecificInit("\t%s", aFile, work);
|
||||
createVariableSpecificInit("%s", aFile, work);
|
||||
work = work->next;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user