add: itoa && create test_int func to test func return int and test_str to ...
This commit is contained in:
38
tests/test.🗿
38
tests/test.🗿
@ -3,7 +3,7 @@ global name;
|
||||
test_str(value, reach_value, description)
|
||||
{
|
||||
putstr(name);
|
||||
if (value != reach_value)
|
||||
if (strcmp(value, reach_value))
|
||||
{
|
||||
putstr(": ERROR: ");
|
||||
putstr(", ");
|
||||
@ -21,3 +21,39 @@ test_str(value, reach_value, description)
|
||||
}
|
||||
wrt '\n';
|
||||
}
|
||||
|
||||
test_int(value, reach_value, description)
|
||||
{
|
||||
local value_str;
|
||||
local reach_value_str;
|
||||
|
||||
putstr(name);
|
||||
if (value != reach_value)
|
||||
{
|
||||
value_str = itoa(value);
|
||||
if (value_str == 0)
|
||||
return (0);
|
||||
reach_value_str = itoa(value);
|
||||
if (reach_value_str == 0)
|
||||
{
|
||||
free(value_str);
|
||||
return (0);
|
||||
}
|
||||
putstr(": ERROR: ");
|
||||
putstr(", ");
|
||||
putstr(description);
|
||||
putstr(" [");
|
||||
putstr(reach_value_str);
|
||||
putstr(" != ");
|
||||
putstr(value_str);
|
||||
putstr("]");
|
||||
free(value_str);
|
||||
free(reach_value_str);
|
||||
}
|
||||
else
|
||||
{
|
||||
putstr(": OK: ");
|
||||
putstr(description);
|
||||
}
|
||||
wrt '\n';
|
||||
}
|
||||
|
Reference in New Issue
Block a user