verify errno in test_atoip

This commit is contained in:
Enno Rehling 2016-11-14 22:21:32 +01:00
parent c512d180f8
commit b48b80a1e9
1 changed files with 8 additions and 6 deletions

View File

@ -2,8 +2,16 @@
#include "parser.h"
#include <string.h>
#include <errno.h>
#include <CuTest.h>
static void test_atoip(CuTest *tc) {
CuAssertIntEquals(tc, 0, atoip("ALLES"));
CuAssertIntEquals(tc, 0, errno);
CuAssertIntEquals(tc, 42, atoip("42"));
CuAssertIntEquals(tc, 0, atoip("-1"));
}
static void test_parse_token(CuTest *tc) {
char lbuf[8];
const char *tok;
@ -103,12 +111,6 @@ static void test_getstrtoken(CuTest *tc) {
CuAssertPtrEquals(tc, NULL, (void *)getstrtoken());
}
static void test_atoip(CuTest *tc) {
CuAssertIntEquals(tc, 42, atoip("42"));
CuAssertIntEquals(tc, 0, atoip("-42"));
CuAssertIntEquals(tc, 0, atoip("NOPE"));
}
CuSuite *get_parser_suite(void)
{
CuSuite *suite = CuSuiteNew();