>>107799815
#define GREEN_MSG(s) "\x1b[32m" s "\x1b[0m\n"
#define RED_MSG(s) "\x1b[31m" s "\x1b[0m\n"
void test(char *input, int32_t result) {
int32_t r = my_atoi(input);
if (r == result) {
printf(GREEN_MSG("OK %s"), input);
} else {
printf(RED_MSG("XX %s (got %" PRId32 ", expected %" PRId32 ")"), input, r, result);
}
}
int main() {
test("-2147483648", -2147483648);
test("2147483647", 2147483647);
test("-200", -200);
test("0", 0);
test("0000", 0);
test("-00000", 0);
test("++1", 0);
test("9", 9);
test("123", 123);
test("0-1", 0);
test("-+-+-3", 0);
test(" + 0 123", 0);
test(" +0 123", 0);
test(" +004500", 4500);
test("2147483648", 2147483647);
test(" -42abc", -42);
test("00000-42a1234", 0);
test(" -115579378e25", -115579378);
test("-91283472332", -2147483648);
test("1+111", 1);
test("+-2", 0);
test(" ", 0);
test("9223372036854775808", 2147483647);
test("+1", 1);
test(".1", 0);
return 0;
}