summaryrefslogtreecommitdiff
path: root/tests/string-test.c
diff options
context:
space:
mode:
authorEST 1999 Jeff Garzik <jgarzik@pobox.com>1999-01-21 18:07:20 +0000
committerJeff Garzik <jgarzik@src.gnome.org>1999-01-21 18:07:20 +0000
commitdc22ea7760edff67a0b293078eee16bf191c95a5 (patch)
treef0db4bc57a1e59ba000eacfe4b0f11906053bc8b /tests/string-test.c
parent55fa3d11125e9ceec62750d0508cc494e124edba (diff)
Add braces to eliminate an ambiguous else warning.
Thu Jan 21 12:40:11 EST 1999 Jeff Garzik <jgarzik@pobox.com> * gmodule/gmodule-dl.c (_g_module_build_path): Add braces to eliminate an ambiguous else warning. * tests/{Makefile.am, string-test.c, strfunc-test.c}: Separate string and strfunc tests, working towards goal of having separate test for each of the GLib modules. Add a couple GString length tests.
Diffstat (limited to 'tests/string-test.c')
-rw-r--r--tests/string-test.c42
1 files changed, 3 insertions, 39 deletions
diff --git a/tests/string-test.c b/tests/string-test.c
index 99a7c4094..228e96417 100644
--- a/tests/string-test.c
+++ b/tests/string-test.c
@@ -52,7 +52,6 @@ main (int argc,
char *argv[])
{
GStringChunk *string_chunk;
- gchar *string;
gchar *tmp_string, *tmp_string_2;
gint i;
@@ -84,6 +83,9 @@ main (int argc,
g_assert (string1 != NULL);
g_assert (string2 != NULL);
+ g_assert (strlen (string1->str) == string1->len);
+ g_assert (strlen (string2->str) == string2->len);
+ g_assert (string2->len == 0);
g_assert (strcmp ("hi pete!", string1->str) == 0);
g_assert (strcmp ("", string2->str) == 0);
@@ -111,44 +113,6 @@ main (int argc,
10, 666, 15, 15, 666.666666666, 666.666666666);
#endif
- g_assert (g_strcasecmp ("FroboZZ", "frobozz") == 0);
- g_assert (g_strcasecmp ("frobozz", "frobozz") == 0);
- g_assert (g_strcasecmp ("frobozz", "FROBOZZ") == 0);
- g_assert (g_strcasecmp ("FROBOZZ", "froboz") != 0);
- g_assert (g_strcasecmp ("", "") == 0);
- g_assert (g_strcasecmp ("!#%&/()", "!#%&/()") == 0);
- g_assert (g_strcasecmp ("a", "b") < 0);
- g_assert (g_strcasecmp ("a", "B") < 0);
- g_assert (g_strcasecmp ("A", "b") < 0);
- g_assert (g_strcasecmp ("A", "B") < 0);
- g_assert (g_strcasecmp ("b", "a") > 0);
- g_assert (g_strcasecmp ("b", "A") > 0);
- g_assert (g_strcasecmp ("B", "a") > 0);
- g_assert (g_strcasecmp ("B", "A") > 0);
-
- g_assert(g_strdup(NULL) == NULL);
- string = g_strdup(GLIB_TEST_STRING);
- g_assert(string != NULL);
- g_assert(strcmp(string, GLIB_TEST_STRING) == 0);
- g_free(string);
-
- string = g_strconcat(GLIB_TEST_STRING, NULL);
- g_assert(string != NULL);
- g_assert(strcmp(string, GLIB_TEST_STRING) == 0);
- g_free(string);
-
- string = g_strconcat(GLIB_TEST_STRING, GLIB_TEST_STRING,
- GLIB_TEST_STRING, NULL);
- g_assert(string != NULL);
- g_assert(strcmp(string, GLIB_TEST_STRING GLIB_TEST_STRING
- GLIB_TEST_STRING) == 0);
- g_free(string);
-
- string = g_strdup_printf ("%05d %-5s", 21, "test");
- g_assert (string != NULL);
- g_assert (strcmp(string, "00021 test ") == 0);
- g_free (string);
-
return 0;
}