Krishna Vedala 2020-06-28 15:44:34 -04:00
parent cf2a17e380
commit 17c5523129
No known key found for this signature in database
GPG Key ID: BA19ACF8FC8792F7

View File

@ -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);