forked from starnakin/IronGOLEM
add: putnum
This commit is contained in:
parent
889006903b
commit
3e51e2f661
8
src/putnum.🗿
Normal file
8
src/putnum.🗿
Normal file
@ -0,0 +1,8 @@
|
||||
putnum(number)
|
||||
{
|
||||
local str = itoa(number);
|
||||
if (str == 0)
|
||||
return;
|
||||
print_str(str);
|
||||
free(str);
|
||||
}
|
16
tests/test.🗿
16
tests/test.🗿
@ -24,28 +24,16 @@ test_str(value, reach_value, description)
|
||||
|
||||
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(reach_value);
|
||||
if (reach_value_str == 0)
|
||||
{
|
||||
free(value_str);
|
||||
return (0);
|
||||
}
|
||||
putstr(": ERROR: ");
|
||||
putstr(", ");
|
||||
putstr(description);
|
||||
putstr(" [");
|
||||
putstr(reach_value_str);
|
||||
putnum(reach_value);
|
||||
putstr(" != ");
|
||||
putstr(value_str);
|
||||
putnum(value);
|
||||
putstr("]");
|
||||
free(value_str);
|
||||
free(reach_value_str);
|
||||
|
Loading…
Reference in New Issue
Block a user