mirror of
https://github.moeyy.xyz/https://github.com/TheAlgorithms/C.git
synced 2023-10-11 15:56:24 +08:00
fix lgtm error
41e2711683/files/conversions/c_atoi_str_to_integer.c (xc388f8d8efa89fb4)
:1
This commit is contained in:
parent
cf2a17e380
commit
17c5523129
@ -51,7 +51,7 @@ int c_atoi(const char *str)
|
|||||||
/**
|
/**
|
||||||
* test the function implementation
|
* test the function implementation
|
||||||
*/
|
*/
|
||||||
int test_c_atoi()
|
void test_c_atoi()
|
||||||
{
|
{
|
||||||
printf("<<<< TEST FUNCTION >>>>\n");
|
printf("<<<< TEST FUNCTION >>>>\n");
|
||||||
assert(c_atoi("123") == atoi("123"));
|
assert(c_atoi("123") == atoi("123"));
|
||||||
@ -59,7 +59,7 @@ int test_c_atoi()
|
|||||||
assert(c_atoi("") == atoi(""));
|
assert(c_atoi("") == atoi(""));
|
||||||
assert(c_atoi("-h23") == atoi("-h23"));
|
assert(c_atoi("-h23") == atoi("-h23"));
|
||||||
assert(c_atoi(" 23") == atoi(" 23"));
|
assert(c_atoi(" 23") == atoi(" 23"));
|
||||||
assert(c_atoi("999999999999") == atoi("999999999999"));
|
assert(c_atoi("999999999") == atoi("999999999"));
|
||||||
printf("<<<< TEST DONE >>>>\n");
|
printf("<<<< TEST DONE >>>>\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,6 +69,8 @@ int test_c_atoi()
|
|||||||
*/
|
*/
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
test_c_atoi();
|
||||||
|
|
||||||
if (argc == 2)
|
if (argc == 2)
|
||||||
{
|
{
|
||||||
printf("Your number + 5 is %d\n", c_atoi(argv[1]) + 5);
|
printf("Your number + 5 is %d\n", c_atoi(argv[1]) + 5);
|
||||||
|
Loading…
Reference in New Issue
Block a user