mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-01 23:13:40 +02:00
add array-test.c
* tests/Makefile.am: add array-test.c * tests/array-test.c: New module, tests array family * tests/hash-test.c, tests/list-test.c, tests/slist-test.c, tests/string-test.c, tests/node-test.c: Clean out cruft left over from testglib.
This commit is contained in:
@@ -47,7 +47,7 @@ typedef struct {
|
||||
gchar name[40];
|
||||
} GlibTestInfo;
|
||||
|
||||
gint
|
||||
static gint
|
||||
my_list_compare_one (gconstpointer a, gconstpointer b)
|
||||
{
|
||||
gint one = *((const gint*)a);
|
||||
@@ -55,7 +55,7 @@ my_list_compare_one (gconstpointer a, gconstpointer b)
|
||||
return one-two;
|
||||
}
|
||||
|
||||
gint
|
||||
static gint
|
||||
my_list_compare_two (gconstpointer a, gconstpointer b)
|
||||
{
|
||||
gint one = *((const gint*)a);
|
||||
@@ -63,97 +63,14 @@ my_list_compare_two (gconstpointer a, gconstpointer b)
|
||||
return two-one;
|
||||
}
|
||||
|
||||
/* void
|
||||
my_list_print (gpointer a, gpointer b)
|
||||
{
|
||||
gint three = *((gint*)a);
|
||||
g_print("%d", three);
|
||||
}; */
|
||||
|
||||
gint
|
||||
my_compare (gconstpointer a,
|
||||
gconstpointer b)
|
||||
{
|
||||
const char *cha = a;
|
||||
const char *chb = b;
|
||||
|
||||
return *cha - *chb;
|
||||
}
|
||||
|
||||
gint
|
||||
my_traverse (gpointer key,
|
||||
gpointer value,
|
||||
gpointer data)
|
||||
{
|
||||
char *ch = key;
|
||||
g_print ("%c ", *ch);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc,
|
||||
char *argv[])
|
||||
{
|
||||
GList *list, *t;
|
||||
GSList *slist, *st;
|
||||
GHashTable *hash_table;
|
||||
GMemChunk *mem_chunk;
|
||||
GStringChunk *string_chunk;
|
||||
GTimer *timer;
|
||||
gint nums[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
|
||||
gint morenums[10] = { 8, 9, 7, 0, 3, 2, 5, 1, 4, 6};
|
||||
gchar *string;
|
||||
|
||||
gchar *mem[10000], *tmp_string, *tmp_string_2;
|
||||
gint i, j;
|
||||
GArray *garray;
|
||||
GPtrArray *gparray;
|
||||
GByteArray *gbarray;
|
||||
GString *string1, *string2;
|
||||
GTree *tree;
|
||||
char chars[62];
|
||||
GRelation *relation;
|
||||
GTuples *tuples;
|
||||
gint data [1024];
|
||||
GlibTestInfo *gti;
|
||||
struct {
|
||||
gchar *filename;
|
||||
gchar *dirname;
|
||||
} dirname_checks[] = {
|
||||
#ifndef NATIVE_WIN32
|
||||
{ "/", "/" },
|
||||
{ "////", "/" },
|
||||
{ ".////", "." },
|
||||
{ ".", "." },
|
||||
{ "..", "." },
|
||||
{ "../", ".." },
|
||||
{ "..////", ".." },
|
||||
{ "", "." },
|
||||
{ "a/b", "a" },
|
||||
{ "a/b/", "a/b" },
|
||||
{ "c///", "c" },
|
||||
#else
|
||||
{ "\\", "\\" },
|
||||
{ ".\\\\\\\\", "." },
|
||||
{ ".", "." },
|
||||
{ "..", "." },
|
||||
{ "..\\", ".." },
|
||||
{ "..\\\\\\\\", ".." },
|
||||
{ "", "." },
|
||||
{ "a\\b", "a" },
|
||||
{ "a\\b\\", "a\\b" },
|
||||
{ "c\\\\\\", "c" },
|
||||
#endif
|
||||
};
|
||||
guint n_dirname_checks = sizeof (dirname_checks) / sizeof (dirname_checks[0]);
|
||||
guint16 gu16t1 = 0x44afU, gu16t2 = 0xaf44U;
|
||||
guint32 gu32t1 = 0x02a7f109U, gu32t2 = 0x09f1a702U;
|
||||
#ifdef G_HAVE_GINT64
|
||||
guint64 gu64t1 = G_GINT64_CONSTANT(0x1d636b02300a7aa7U),
|
||||
gu64t2 = G_GINT64_CONSTANT(0xa77a0a30026b631dU);
|
||||
#endif
|
||||
|
||||
|
||||
gint i;
|
||||
|
||||
slist = NULL;
|
||||
for (i = 0; i < 10; i++)
|
||||
|
Reference in New Issue
Block a user