Luna/tests/libc/stdlib.c

24 lines
319 B
C
Raw Normal View History

2022-10-22 10:03:10 +00:00
#include "Test.h"
#include <stdlib.h>
DEFINE_TEST(atoi)
{
START_TEST(atoi);
const char* str = "42";
int num = atoi(str);
EXPECT_EQ(num, 42);
str = "-56";
num = atoi(str);
EXPECT_EQ(num, -56);
str = "Not a number";
num = atoi(str);
EXPECT_EQ(num, 0);
TEST_SUCCESS();
}