* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
+
+/*
+ * Modified by the GLib Team and others 1997-1999. See the AUTHORS
+ * file for a list of people on the GLib Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
#undef G_LOG_DOMAIN
#include <stdio.h>
#define GLIB_TEST_STRING "el dorado "
#define GLIB_TEST_STRING_5 "el do"
-typedef struct {
- guint age;
- gchar name[40];
-} GlibTestInfo;
-
static gboolean
node_build_string (GNode *node,
gpointer data)
gint morenums[10] = { 8, 9, 7, 0, 3, 2, 5, 1, 4, 6};
gchar *string;
- gchar *mem[10000], *tmp_string, *tmp_string_2;
+ gchar *mem[10000], *tmp_string = NULL, *tmp_string_2;
gint i, j;
GArray *garray;
GPtrArray *gparray;
GRelation *relation;
GTuples *tuples;
gint data [1024];
- GlibTestInfo *gti;
struct {
gchar *filename;
gchar *dirname;
} dirname_checks[] = {
-#ifndef NATIVE_WIN32
+#ifndef G_OS_WIN32
{ "/", "/" },
{ "////", "/" },
{ ".////", "." },
string = g_get_current_dir ();
g_print ("cwd: %s\n", string);
g_free (string);
+ g_print ("user: %s\n", g_get_user_name ());
+ g_print ("real: %s\n", g_get_real_name ());
+ g_print ("home: %s\n", g_get_home_dir ());
+ g_print ("tmp-dir: %s\n", g_get_tmp_dir ());
/* type sizes */
g_print ("checking size of gint8: %d", (int)sizeof (gint8));
for (i = 0; i < 10000; i++)
g_string_append_c (string1, 'a'+(i%26));
-#if !(defined (_MSC_VER) || defined (__LCC__))
- /* MSVC and LCC use the same run-time C library, which doesn't like
+#ifndef G_OS_WIN32
+ /* MSVC, mingw32 and LCC use the same run-time C library, which doesn't like
the %10000.10000f format... */
g_string_sprintf (string2, "%s|%0100d|%s|%s|%0*d|%*.*f|%10000.10000f",
"this pete guy sure is a wuss, like he's the number ",
#ifdef G_HAVE_GINT64
g_assert (GUINT64_SWAP_LE_BE (gu64t1) == gu64t2);
#endif
- g_print ("ok\n");
-
-#ifdef G_HAVE_ALLOCA
- g_print ("checking alloca()-based allocation routines...");
-
- string = g_alloca(80);
- g_assert(string != NULL);
- for (i = 0; i < 80; i++)
- string[i] = 'x';
- string[79] = 0;
- g_assert(strlen(string) == 79);
-
- gti = g_new_a(GlibTestInfo, 2);
- string = g_alloca(2);
- strcpy(string, "x");
- for (i = 0; i < 2; i++) {
- for (j = 0; j < 40; j++)
- gti[i].name[j] = 'x';
- gti[i].name[39] = 0;
- g_assert(strlen(gti[i].name) == 39);
- gti[i].age = 42;
- }
- g_assert(strcmp(string, "x") == 0);
-
- string = g_new0_a(char, 40);
- for (i = 0; i < 39; i++)
- string[i] = 'x';
- g_assert(strlen(string) == 39);
g_print ("ok\n");
- g_print ("checking alloca()-based string duplication routines...");
-
- g_strdup_a(string, GLIB_TEST_STRING);
- g_assert(string != NULL);
- g_assert(strcmp(string, GLIB_TEST_STRING) == 0);
- g_strdup_a(string, NULL);
- g_assert(string == NULL);
-
- g_strndup_a(string, GLIB_TEST_STRING, 5);
- g_assert(string != NULL);
- g_assert(strlen(string) == 5);
- g_assert(strcmp(string, GLIB_TEST_STRING_5) == 0);
- g_strndup_a(string, NULL, 20);
- g_assert(string == NULL);
-
- g_strconcat3_a(string, GLIB_TEST_STRING, GLIB_TEST_STRING, GLIB_TEST_STRING);
- g_assert(string != NULL);
- g_assert(strcmp(string, GLIB_TEST_STRING GLIB_TEST_STRING
- GLIB_TEST_STRING) == 0);
-
- g_print ("ok\n");
+#ifdef G_OS_WIN32
+ g_print ("current locale: %s\n", g_win32_getlocale ());
#endif
return 0;