(SOC - Test) Storage Only Commit

This commit is contained in:
William
2024-05-16 06:53:55 +08:00
parent ce09981e05
commit e73f3af436
12 changed files with 189 additions and 86 deletions

View File

@@ -45,8 +45,10 @@ typedef struct {
Status Var_Create(Var *inst, void *addr, size_t size, char *identity);
Status Var_CopyOf(Var *inst, Var *other);
Status Var_Literalise(Var *inst, char *buff);
bool Var_Equal(Var *a, Var *b);
void Var_Delete(Var *inst);
Status VarUtils_Literalise(Var *inst, char *buff);
void VarUtils_Swap(Var *v1, Var *v2);
bool VarUtils_IsIdentityLegal(char *identity);

View File

@@ -50,7 +50,7 @@ void VarUtils_Swap(Var *v1, Var *v2)
*v2 = v3;
}
Status VarUtils_Literalise(Var *inst, char *buff)
Status Var_Literalise(Var *inst, char *buff)
{
/* Skip when inst is unavailable. */
state(inst == NULL, UnavailableInstance);
@@ -63,6 +63,16 @@ Status VarUtils_Literalise(Var *inst, char *buff)
return NormalStatus;
}
bool Var_Equal(Var *a, Var *b)
{
/* Skip unavailable inst and invalid param. */
state((a == NULL || b == NULL), false);
return (a->addr == b->addr &&
a->size == b->size &&
(!strcmp(a->identity, b->identity)));
}
bool VarUtils_IsIdentityLegal(char *identity)
{
/* Skip when identity is unavailable. */