prefux gettokens/getfields with uc_
This commit is contained in:
+12
-12
@@ -11,7 +11,7 @@ START_TEST (test_getfields)
|
||||
char str[] = "a;b;c";
|
||||
char *letters[5] = {NULL};
|
||||
|
||||
int rc = getfields(str, letters, 5, 0, ";");
|
||||
int rc = uc_getfields(str, letters, 5, 0, ";");
|
||||
ck_assert_int_eq(rc, 3);
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ START_TEST (test_getfields_consecutive)
|
||||
char str[] = "a;;b;c;;;";
|
||||
char *letters[7] = {NULL};
|
||||
|
||||
int rc = getfields(str, letters, 5, 0, ";");
|
||||
int rc = uc_getfields(str, letters, 5, 0, ";");
|
||||
ck_assert_int_eq(rc, 5);
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ START_TEST (test_getfields_mflag)
|
||||
char str[] = "a;b;c";
|
||||
char *letters[5] = {NULL};
|
||||
|
||||
int rc = getfields(str, letters, 5, 1, ";");
|
||||
int rc = uc_getfields(str, letters, 5, 1, ";");
|
||||
ck_assert_int_eq(rc, 3);
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ START_TEST (test_getfields_consecutive_mflag)
|
||||
char str[] = "a;;b;c;;;";
|
||||
char *letters[7] = {NULL};
|
||||
|
||||
int rc = getfields(str, letters, 7, 1, ";");
|
||||
int rc = uc_getfields(str, letters, 7, 1, ";");
|
||||
ck_assert_int_eq(rc, 3);
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ START_TEST (test_getfields_too_many)
|
||||
char str[] = "a\r\nb\r\nc\r\nd\r\ne";
|
||||
char *letters[4] = {NULL};
|
||||
|
||||
int rc = getfields(str, letters, 4, 0, "\r\n");
|
||||
int rc = uc_getfields(str, letters, 4, 0, "\r\n");
|
||||
ck_assert_int_eq(rc, 4);
|
||||
|
||||
// This result is rather silly, but it's
|
||||
@@ -93,7 +93,7 @@ START_TEST (test_getfields_too_many_mflag)
|
||||
char str[] = "a\r\nb\r\nc\r\nd\r\ne";
|
||||
char *letters[4] = {NULL};
|
||||
|
||||
int rc = getfields(str, letters, 4, 1, "\r\n");
|
||||
int rc = uc_getfields(str, letters, 4, 1, "\r\n");
|
||||
ck_assert_int_eq(rc, 4);
|
||||
|
||||
ck_assert_str_eq("a", letters[0]);
|
||||
@@ -108,11 +108,11 @@ START_TEST (test_getfields_empty)
|
||||
char str[] = "";
|
||||
char *letters[4] = {NULL};
|
||||
|
||||
int rc = getfields(str, letters, 4, 0, ";\r\n");
|
||||
int rc = uc_getfields(str, letters, 4, 0, ";\r\n");
|
||||
ck_assert_int_eq(rc, 1);
|
||||
ck_assert_str_eq("", letters[0]);
|
||||
|
||||
rc = getfields(str, letters, 4, 1, ";\r\n");
|
||||
rc = uc_getfields(str, letters, 4, 1, ";\r\n");
|
||||
ck_assert_int_eq(rc, 0);
|
||||
|
||||
|
||||
@@ -123,7 +123,7 @@ START_TEST (test_gettokens)
|
||||
char str[] = "a;b;c";
|
||||
char *letters[5] = {NULL};
|
||||
|
||||
int rc = gettokens(str, letters, 5,";");
|
||||
int rc = uc_gettokens(str, letters, 5,";");
|
||||
ck_assert_int_eq(rc, 3);
|
||||
|
||||
|
||||
@@ -138,7 +138,7 @@ START_TEST (test_gettokens_consecutive)
|
||||
char str[] = "a;;;b;;c;";
|
||||
char *letters[5] = {NULL};
|
||||
|
||||
int rc = gettokens(str, letters, 5,";");
|
||||
int rc = uc_gettokens(str, letters, 5,";");
|
||||
ck_assert_int_eq(rc, 3);
|
||||
|
||||
|
||||
@@ -153,7 +153,7 @@ START_TEST (test_gettokens_empty)
|
||||
char str[] = "";
|
||||
char *letters[5] = {NULL};
|
||||
|
||||
int rc = gettokens(str, letters, 5,";");
|
||||
int rc = uc_gettokens(str, letters, 5,";");
|
||||
ck_assert_int_eq(rc, 0);
|
||||
|
||||
END_TEST
|
||||
@@ -163,7 +163,7 @@ START_TEST (test_gettokens_quotes)
|
||||
char str[] = "\"abc\";d;\"e \"";
|
||||
char *letters[5] = {NULL};
|
||||
|
||||
int rc = gettokens(str, letters, 5,";");
|
||||
int rc = uc_gettokens(str, letters, 5,";");
|
||||
ck_assert_int_eq(rc, 3);
|
||||
|
||||
ck_assert_str_eq("abc", letters[0]);
|
||||
|
||||
Reference in New Issue
Block a user