mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-26 15:36:14 +01:00
added new sample test to prepare for extended range random tests.
2008-07-25 15:47:08 Tim Janik <timj@imendio.com> * glib/tests/testing.c (test_random_conversions): added new sample test to prepare for extended range random tests. svn path=/trunk/; revision=7253
This commit is contained in:
parent
64c1eba197
commit
8017661f6d
@ -1,3 +1,8 @@
|
||||
2008-07-25 15:47:08 Tim Janik <timj@imendio.com>
|
||||
|
||||
* glib/tests/testing.c (test_random_conversions): added new sample
|
||||
test to prepare for extended range random tests.
|
||||
|
||||
2008-07-24 Tor Lillqvist <tml@novell.com>
|
||||
|
||||
* glib/gdir.c: Include <stdio.h> for FILENAME_MAX on newer mingw
|
||||
|
@ -179,6 +179,18 @@ test_data_test (gconstpointer test_data)
|
||||
g_assert (test_data == (void*) 0xc0c0baba);
|
||||
}
|
||||
|
||||
static void
|
||||
test_random_conversions (void)
|
||||
{
|
||||
/* very simple conversion test using random numbers */
|
||||
int vint = g_test_rand_int();
|
||||
char *err, *str = g_strdup_printf ("%d", vint);
|
||||
gint64 vint64 = g_ascii_strtoll (str, &err, 10);
|
||||
g_assert_cmphex (vint, ==, vint64);
|
||||
g_assert (!err || *err == 0);
|
||||
g_free (str);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc,
|
||||
char *argv[])
|
||||
@ -187,6 +199,7 @@ main (int argc,
|
||||
|
||||
g_test_add_func ("/random-generator/rand-1", test_rand1);
|
||||
g_test_add_func ("/random-generator/rand-2", test_rand2);
|
||||
g_test_add_func ("/random-generator/random-conversions", test_random_conversions);
|
||||
g_test_add_func ("/misc/assertions", test_assertions);
|
||||
g_test_add_data_func ("/misc/test-data", (void*) 0xc0c0baba, test_data_test);
|
||||
g_test_add ("/misc/primetoul", Fixturetest, (void*) 0xc0cac01a, fixturetest_setup, fixturetest_test, fixturetest_teardown);
|
||||
|
Loading…
Reference in New Issue
Block a user