Enlightenment CVS committal Author : mej Project : eterm Module : libast
Dir : eterm/libast/test Modified Files: perf.c test.c Log Message: Fri Dec 12 22:01:42 2003 Michael Jennings (mej) Finished up namespace cleanups. =================================================================== RCS file: /cvsroot/enlightenment/eterm/libast/test/perf.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -3 -r1.9 -r1.10 --- perf.c 27 Nov 2003 02:08:06 -0000 1.9 +++ perf.c 13 Dec 2003 03:02:19 -0000 1.10 @@ -21,7 +21,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -static const char cvs_ident[] = "$Id: perf.c,v 1.9 2003/11/27 02:08:06 mej Exp $"; +static const char cvs_ident[] = "$Id: perf.c,v 1.10 2003/12/13 03:02:19 mej Exp $"; #if defined(HAVE_CONFIG_H) && (HAVE_CONFIG_H != 0) # include <config.h> @@ -95,49 +95,35 @@ PERF_SET_REPS(1000); - PERF_BEGIN("left_str() function"); - PERF_TEST(s1 = left_str("bugger all", 3); FREE(s1);); - PERF_TEST(s2 = left_str("testing 1-2-3", 7); FREE(s2);); - PERF_TEST(s3 = left_str(NULL, 0); FREE(s3);); - PERF_TEST(s4 = left_str("eat me", 0); FREE(s4);); - PERF_END(); - - PERF_BEGIN("mid_str() function"); - PERF_TEST(s1 = mid_str("pneumonoultramicroscopicsilicovolcanoconiosis", 8, 16); FREE(s1);); - PERF_TEST(s2 = mid_str("abc", 7, 5); FREE(s2);); - PERF_TEST(s3 = mid_str(NULL, 0, 0); FREE(s3);); - PERF_TEST(s4 = mid_str("what the heck", -5, 42); FREE(s4);); - PERF_END(); - - PERF_BEGIN("right_str() function"); - PERF_TEST(s1 = right_str("bugger all", 3); FREE(s1);); - PERF_TEST(s2 = right_str("testing 1-2-3", 5); FREE(s2);); - PERF_TEST(s3 = right_str(NULL, 0); FREE(s3);); - PERF_TEST(s4 = right_str("eat me", 0); FREE(s4);); + PERF_BEGIN("spiftool_substr() function"); + PERF_TEST(s1 = spiftool_substr("pneumonoultramicroscopicsilicovolcanoconiosis", 8, 16); FREE(s1);); + PERF_TEST(s2 = spiftool_substr("abc", 7, 5); FREE(s2);); + PERF_TEST(s3 = spiftool_substr(NULL, 0, 0); FREE(s3);); + PERF_TEST(s4 = spiftool_substr("what the heck", -5, 42); FREE(s4);); PERF_END(); PERF_SET_REPS(10); #if HAVE_REGEX_H - PERF_BEGIN("regexp_match() function"); - PERF_TEST(regexp_match("One particular string", "part");); - PERF_TEST(regexp_match("Some other strange string", "^[A-Za-z]+$");); - PERF_TEST(regexp_match("some-rpm-package-1.0.1-4.src.rpm", "^(.*)-([^-]+)-([^-])\\.([a-z0-9]+)\\.rpm$");); - PERF_TEST(regexp_match("/the/path/to/some/odd/file.txt", "/this/should/not/match");); - PERF_TEST(regexp_match("1600x1200", "[[:digit:]]+x[[:digit:]]+");); - PERF_TEST(regexp_match("xxx", NULL);); - PERF_TEST(regexp_match_r("AbCdEfGhIjKlMnOpQrStUvWxYz", "[[:upper:]]", &r);); - PERF_TEST(regexp_match_r("abcdefjhijklmnopqrstuvwxyz", NULL, &r);); - PERF_TEST(regexp_match_r("aaaaa", "[[:lower:]]", &r);); + PERF_BEGIN("spiftool_regexp_match() function"); + PERF_TEST(spiftool_regexp_match("One particular string", "part");); + PERF_TEST(spiftool_regexp_match("Some other strange string", "^[A-Za-z]+$");); + PERF_TEST(spiftool_regexp_match("some-rpm-package-1.0.1-4.src.rpm", "^(.*)-([^-]+)-([^-])\\.([a-z0-9]+)\\.rpm$");); + PERF_TEST(spiftool_regexp_match("/the/path/to/some/odd/file.txt", "/this/should/not/match");); + PERF_TEST(spiftool_regexp_match("1600x1200", "[[:digit:]]+x[[:digit:]]+");); + PERF_TEST(spiftool_regexp_match("xxx", NULL);); + PERF_TEST(spiftool_regexp_match_r("AbCdEfGhIjKlMnOpQrStUvWxYz", "[[:upper:]]", &r);); + PERF_TEST(spiftool_regexp_match_r("abcdefjhijklmnopqrstuvwxyz", NULL, &r);); + PERF_TEST(spiftool_regexp_match_r("aaaaa", "[[:lower:]]", &r);); PERF_END(); #endif PERF_BEGIN("split() function"); - PERF_TEST(slist = split(" ", "Splitting a string on spaces"); spiftool_free_array(slist, -1);); - PERF_TEST(slist = split(NULL, " a\t \ta a a a a a "); spiftool_free_array(slist, -1);); - PERF_TEST(slist = split(NULL, " first \"just the second\" third \'fourth and \'\"fifth to\"gether last"); spiftool_free_array(slist, -1);); - PERF_TEST(slist = split(NULL, "\'don\\\'t\' try this at home \"\" "); spiftool_free_array(slist, -1);); - PERF_TEST(slist = split(":", "A:B:C:D:::E"); spiftool_free_array(slist, -1);); + PERF_TEST(slist = spiftool_split(" ", "Splitting a string on spaces"); spiftool_free_array(slist, -1);); + PERF_TEST(slist = spiftool_split(NULL, " a\t \ta a a a a a "); spiftool_free_array(slist, -1);); + PERF_TEST(slist = spiftool_split(NULL, " first \"just the second\" third \'fourth and \'\"fifth to\"gether last"); spiftool_free_array(slist, -1);); + PERF_TEST(slist = spiftool_split(NULL, "\'don\\\'t\' try this at home \"\" "); spiftool_free_array(slist, -1);); + PERF_TEST(slist = spiftool_split(":", "A:B:C:D:::E"); spiftool_free_array(slist, -1);); PERF_END(); PERF_ENDED("string"); =================================================================== RCS file: /cvsroot/enlightenment/eterm/libast/test/test.c,v retrieving revision 1.29 retrieving revision 1.30 diff -u -3 -r1.29 -r1.30 --- test.c 27 Nov 2003 02:08:07 -0000 1.29 +++ test.c 13 Dec 2003 03:02:19 -0000 1.30 @@ -21,7 +21,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -static const char cvs_ident[] = "$Id: test.c,v 1.29 2003/11/27 02:08:07 mej Exp $"; +static const char cvs_ident[] = "$Id: test.c,v 1.30 2003/12/13 03:02:19 mej Exp $"; #if defined(HAVE_CONFIG_H) && (HAVE_CONFIG_H != 0) # include <config.h> @@ -108,45 +108,15 @@ #endif char **slist; - TEST_BEGIN("left_str() function"); - s1 = left_str("bugger all", 3); - s2 = left_str("testing 1-2-3", 7); - s3 = left_str(NULL, 0); - s4 = left_str("eat me", 0); - TEST_FAIL_IF(strcmp(s1, "bug")); - TEST_FAIL_IF(strcmp(s2, "testing")); - TEST_FAIL_IF(s3 != NULL); - TEST_FAIL_IF(s4 != NULL); - FREE(s1); - FREE(s2); - FREE(s3); - FREE(s4); - TEST_PASS(); - - TEST_BEGIN("mid_str() function"); - s1 = mid_str("pneumonoultramicroscopicsilicovolcanoconiosis", 8, 16); - s2 = mid_str("abc", 7, 5); - s3 = mid_str(NULL, 0, 0); - s4 = mid_str("what the heck", -5, 42); + TEST_BEGIN("spiftool_substr() function"); + s1 = spiftool_substr("pneumonoultramicroscopicsilicovolcanoconiosis", 8, 16); + s2 = spiftool_substr("abc", 7, 5); + s3 = spiftool_substr(NULL, 0, 0); + s4 = spiftool_substr("what the heck", -5, 42); TEST_FAIL_IF(strcmp(s1, "ultramicroscopic")); TEST_FAIL_IF(s2 != NULL); TEST_FAIL_IF(s3 != NULL); - TEST_FAIL_IF(s4 != NULL); - FREE(s1); - FREE(s2); - FREE(s3); - FREE(s4); - TEST_PASS(); - - TEST_BEGIN("right_str() function"); - s1 = right_str("bugger all", 3); - s2 = right_str("testing 1-2-3", 5); - s3 = right_str(NULL, 0); - s4 = right_str("eat me", 0); - TEST_FAIL_IF(strcmp(s1, "all")); - TEST_FAIL_IF(strcmp(s2, "1-2-3")); - TEST_FAIL_IF(s3 != NULL); - TEST_FAIL_IF(s4 != NULL); + TEST_FAIL_IF(strcmp(s4, " heck")); FREE(s1); FREE(s2); FREE(s3); @@ -154,23 +124,23 @@ TEST_PASS(); #if HAVE_REGEX_H - TEST_BEGIN("regexp_match() function"); - TEST_FAIL_IF(!regexp_match("One particular string", "part")); - TEST_FAIL_IF(regexp_match("Some other strange string", "^[A-Za-z]+$")); - TEST_FAIL_IF(!regexp_match("some-rpm-package-1.0.1-4.src.rpm", "^(.*)-([^-]+)-([^-])\\.([a-z0-9]+)\\.rpm$")); - TEST_FAIL_IF(regexp_match("/the/path/to/some/odd/file.txt", "/this/should/not/match")); - TEST_FAIL_IF(!regexp_match("1600x1200", "[[:digit:]]+x[[:digit:]]+")); - TEST_FAIL_IF(regexp_match("xxx", NULL)); - regexp_match(NULL, NULL); - TEST_FAIL_IF(!regexp_match_r("AbCdEfGhIjKlMnOpQrStUvWxYz", "[[:upper:]]", &r)); - TEST_FAIL_IF(regexp_match_r("abcdefjhijklmnopqrstuvwxyz", NULL, &r)); - TEST_FAIL_IF(!regexp_match_r("aaaaa", "[[:lower:]]", &r)); + TEST_BEGIN("spiftool_regexp_match() function"); + TEST_FAIL_IF(!spiftool_regexp_match("One particular string", "part")); + TEST_FAIL_IF(spiftool_regexp_match("Some other strange string", "^[A-Za-z]+$")); + TEST_FAIL_IF(!spiftool_regexp_match("some-rpm-package-1.0.1-4.src.rpm", "^(.*)-([^-]+)-([^-])\\.([a-z0-9]+)\\.rpm$")); + TEST_FAIL_IF(spiftool_regexp_match("/the/path/to/some/odd/file.txt", "/this/should/not/match")); + TEST_FAIL_IF(!spiftool_regexp_match("1600x1200", "[[:digit:]]+x[[:digit:]]+")); + TEST_FAIL_IF(spiftool_regexp_match("xxx", NULL)); + spiftool_regexp_match(NULL, NULL); + TEST_FAIL_IF(!spiftool_regexp_match_r("AbCdEfGhIjKlMnOpQrStUvWxYz", "[[:upper:]]", &r)); + TEST_FAIL_IF(spiftool_regexp_match_r("abcdefjhijklmnopqrstuvwxyz", NULL, &r)); + TEST_FAIL_IF(!spiftool_regexp_match_r("aaaaa", "[[:lower:]]", &r)); FREE(r); TEST_PASS(); #endif - TEST_BEGIN("split() function"); - slist = split(" ", "Splitting a string on spaces"); + TEST_BEGIN("spiftool_split() function"); + slist = spiftool_split(" ", "Splitting a string on spaces"); TEST_FAIL_IF(!slist); TEST_FAIL_IF(!slist[0] || !slist[1] || !slist[2] || !slist[3] || !slist[4] || slist[5]); TEST_FAIL_IF(strcmp(slist[0], "Splitting")); @@ -180,7 +150,7 @@ TEST_FAIL_IF(strcmp(slist[4], "spaces")); spiftool_free_array(SPIF_CAST(ptr) slist, 5); - slist = split(NULL, " a\t \ta a a a a a "); + slist = spiftool_split(NULL, " a\t \ta a a a a a "); TEST_FAIL_IF(!slist); TEST_FAIL_IF(!slist[0] || !slist[1] || !slist[2] || !slist[3] || !slist[4] || !slist[5] || !slist[6] || slist[7]); TEST_FAIL_IF(strcmp(slist[0], "a")); @@ -192,7 +162,7 @@ TEST_FAIL_IF(strcmp(slist[6], "a")); spiftool_free_array(SPIF_CAST(ptr) slist, 7); - slist = split(NULL, " first \"just the second\" third \'fourth and \'\"fifth to\"gether last"); + slist = spiftool_split(NULL, " first \"just the second\" third \'fourth and \'\"fifth to\"gether last"); TEST_FAIL_IF(!slist); TEST_FAIL_IF(!slist[0] || !slist[1] || !slist[2] || !slist[3] || !slist[4] || slist[5]); TEST_FAIL_IF(strcmp(slist[0], "first")); @@ -202,7 +172,7 @@ TEST_FAIL_IF(strcmp(slist[4], "last")); spiftool_free_array(SPIF_CAST(ptr) slist, 5); - slist = split(NULL, "\'don\\\'t\' try this at home \"\" "); + slist = spiftool_split(NULL, "\'don\\\'t\' try this at home \"\" "); TEST_FAIL_IF(!slist); TEST_FAIL_IF(!slist[0] || !slist[1] || !slist[2] || !slist[3] || !slist[4] || !slist[5] || slist[6]); TEST_FAIL_IF(strcmp(slist[0], "don\'t")); @@ -213,7 +183,7 @@ TEST_FAIL_IF(slist[5][0]); spiftool_free_array(SPIF_CAST(ptr) slist, 6); - slist = split(":", "A:B:C:D:::E"); + slist = spiftool_split(":", "A:B:C:D:::E"); TEST_FAIL_IF(!slist); TEST_FAIL_IF(!slist[0] || !slist[1] || !slist[2] || !slist[3] || !slist[4] || slist[5]); TEST_FAIL_IF(strcmp(slist[0], "A")); @@ -224,23 +194,23 @@ spiftool_free_array(SPIF_CAST(ptr) slist, 5); TEST_PASS(); - TEST_BEGIN("version_compare() function"); - TEST_FAIL_IF(!SPIF_CMP_IS_LESS(version_compare("1.0", "1.0.1"))); - TEST_FAIL_IF(!SPIF_CMP_IS_LESS(version_compare("2.9.99", "3.0"))); - TEST_FAIL_IF(!SPIF_CMP_IS_LESS(version_compare("3.0", "29.9.9"))); - TEST_FAIL_IF(!SPIF_CMP_IS_LESS(version_compare("1.0pre2", "1.0"))); - TEST_FAIL_IF(!SPIF_CMP_IS_LESS(version_compare("9.9", "9.9rc1"))); - TEST_FAIL_IF(!SPIF_CMP_IS_GREATER(version_compare("0.5.3", "0.5.3snap4"))); - TEST_FAIL_IF(!SPIF_CMP_IS_GREATER(version_compare("2.2.4", "2.2.4beta3"))); - TEST_FAIL_IF(!SPIF_CMP_IS_GREATER(version_compare("2.2.4beta3", "2.2.4alpha7"))); - TEST_FAIL_IF(!SPIF_CMP_IS_GREATER(version_compare("1.27.3", "1.13.1"))); - TEST_FAIL_IF(!SPIF_CMP_IS_GREATER(version_compare("0.10", "0.9.2"))); - TEST_FAIL_IF(!SPIF_CMP_IS_GREATER(version_compare("2.3.2a", "2.3.2"))); - TEST_FAIL_IF(!SPIF_CMP_IS_GREATER(version_compare("4.0p1", "4.0"))); - TEST_FAIL_IF(!SPIF_CMP_IS_EQUAL(version_compare("3.4.5", "3.4.5"))); - TEST_FAIL_IF(!SPIF_CMP_IS_EQUAL(version_compare("1.2.0b3", "1.2.0b3"))); - TEST_FAIL_IF(!SPIF_CMP_IS_EQUAL(version_compare("2.0alpha", "2.0alpha"))); - TEST_FAIL_IF(!SPIF_CMP_IS_EQUAL(version_compare("5.4pre1", "5.4pre1"))); + TEST_BEGIN("spiftool_version_compare() function"); + TEST_FAIL_IF(!SPIF_CMP_IS_LESS(spiftool_version_compare("1.0", "1.0.1"))); + TEST_FAIL_IF(!SPIF_CMP_IS_LESS(spiftool_version_compare("2.9.99", "3.0"))); + TEST_FAIL_IF(!SPIF_CMP_IS_LESS(spiftool_version_compare("3.0", "29.9.9"))); + TEST_FAIL_IF(!SPIF_CMP_IS_LESS(spiftool_version_compare("1.0pre2", "1.0"))); + TEST_FAIL_IF(!SPIF_CMP_IS_LESS(spiftool_version_compare("9.9", "9.9rc1"))); + TEST_FAIL_IF(!SPIF_CMP_IS_GREATER(spiftool_version_compare("0.5.3", "0.5.3snap4"))); + TEST_FAIL_IF(!SPIF_CMP_IS_GREATER(spiftool_version_compare("2.2.4", "2.2.4beta3"))); + TEST_FAIL_IF(!SPIF_CMP_IS_GREATER(spiftool_version_compare("2.2.4beta3", "2.2.4alpha7"))); + TEST_FAIL_IF(!SPIF_CMP_IS_GREATER(spiftool_version_compare("1.27.3", "1.13.1"))); + TEST_FAIL_IF(!SPIF_CMP_IS_GREATER(spiftool_version_compare("0.10", "0.9.2"))); + TEST_FAIL_IF(!SPIF_CMP_IS_GREATER(spiftool_version_compare("2.3.2a", "2.3.2"))); + TEST_FAIL_IF(!SPIF_CMP_IS_GREATER(spiftool_version_compare("4.0p1", "4.0"))); + TEST_FAIL_IF(!SPIF_CMP_IS_EQUAL(spiftool_version_compare("3.4.5", "3.4.5"))); + TEST_FAIL_IF(!SPIF_CMP_IS_EQUAL(spiftool_version_compare("1.2.0b3", "1.2.0b3"))); + TEST_FAIL_IF(!SPIF_CMP_IS_EQUAL(spiftool_version_compare("2.0alpha", "2.0alpha"))); + TEST_FAIL_IF(!SPIF_CMP_IS_EQUAL(spiftool_version_compare("5.4pre1", "5.4pre1"))); TEST_PASS(); TEST_PASSED("string"); ------------------------------------------------------- This SF.net email is sponsored by: IBM Linux Tutorials. Become an expert in LINUX or just sharpen your skills. Sign up for IBM's Free Linux Tutorials. Learn everything from the bash shell to sys admin. Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click _______________________________________________ enlightenment-cvs mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs