summaryrefslogtreecommitdiff
path: root/shared/nm-utils
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2019-05-30 08:33:14 +0200
committerThomas Haller <thaller@redhat.com>2019-06-11 08:25:10 +0200
commitd7932ee5f196690af87f32bf8a88cee7e91c4958 (patch)
tree6c2a9f12a80e3daac75d79573f58e15f22855d29 /shared/nm-utils
parent7440c0c5648bca01597d2d6a245b6a213416958c (diff)
downloadNetworkManager-d7932ee5f196690af87f32bf8a88cee7e91c4958.tar.gz
tests/trivial: rename nmtst_get_rand_int() to nmtst_get_rand_uint32()
nmtst_get_rand_int() was originally named that way, because it calls g_rand_int(). But I think if a function returns an uint32, it should also be named that way. Rename.
Diffstat (limited to 'shared/nm-utils')
-rw-r--r--shared/nm-utils/nm-test-utils.h8
-rw-r--r--shared/nm-utils/tests/test-shared-general.c8
2 files changed, 8 insertions, 8 deletions
diff --git a/shared/nm-utils/nm-test-utils.h b/shared/nm-utils/nm-test-utils.h
index a74633c0ae..9f7a000497 100644
--- a/shared/nm-utils/nm-test-utils.h
+++ b/shared/nm-utils/nm-test-utils.h
@@ -858,7 +858,7 @@ nmtst_get_rand (void)
}
static inline guint32
-nmtst_get_rand_int (void)
+nmtst_get_rand_uint32 (void)
{
return g_rand_int (nmtst_get_rand ());
}
@@ -866,7 +866,7 @@ nmtst_get_rand_int (void)
static inline gboolean
nmtst_get_rand_bool (void)
{
- return nmtst_get_rand_int () % 2;
+ return nmtst_get_rand_uint32 () % 2;
}
static inline gpointer
@@ -901,7 +901,7 @@ nmtst_rand_buf (GRand *rand, gpointer buffer, gsize buffer_length)
({ \
typeof (v0) NM_UNIQ_T (UNIQ, uniq)[1 + NM_NARG (__VA_ARGS__)] = { (v0), __VA_ARGS__ }; \
\
- NM_UNIQ_T (UNIQ, uniq)[nmtst_get_rand_int () % G_N_ELEMENTS (NM_UNIQ_T (UNIQ, uniq))]; \
+ NM_UNIQ_T (UNIQ, uniq)[nmtst_get_rand_uint32 () % G_N_ELEMENTS (NM_UNIQ_T (UNIQ, uniq))]; \
})
#define nmtst_rand_select(...) \
@@ -1933,7 +1933,7 @@ nmtst_assert_setting_is_equal (gconstpointer /* const NMSetting * */ a,
NMSettingCompareFlags flags)
{
gs_unref_hashtable GHashTable *hash = NULL;
- guint32 r = nmtst_get_rand_int ();
+ guint32 r = nmtst_get_rand_uint32 ();
g_assert (NM_IS_SETTING (a));
g_assert (NM_IS_SETTING (b));
diff --git a/shared/nm-utils/tests/test-shared-general.c b/shared/nm-utils/tests/test-shared-general.c
index ff0906fdf7..9582801eb1 100644
--- a/shared/nm-utils/tests/test-shared-general.c
+++ b/shared/nm-utils/tests/test-shared-general.c
@@ -149,10 +149,10 @@ test_nm_strndup_a (void)
char ch;
gsize i, l;
- input = g_strnfill (nmtst_get_rand_int () % 20, 'x');
+ input = g_strnfill (nmtst_get_rand_uint32 () % 20, 'x');
for (i = 0; input[i]; i++) {
- while ((ch = ((char) nmtst_get_rand_int ())) == '\0') {
+ while ((ch = ((char) nmtst_get_rand_uint32 ())) == '\0') {
/* repeat. */
}
input[i] = ch;
@@ -175,7 +175,7 @@ test_nm_strndup_a (void)
gs_free char *dup_free = NULL;
const char *dup;
- l = nmtst_get_rand_int () % 23;
+ l = nmtst_get_rand_uint32 () % 23;
dup = nm_strndup_a (10, input, l, &dup_free);
g_assert (strncmp (dup, input, l) == 0);
g_assert (strlen (dup) <= l);
@@ -214,7 +214,7 @@ test_unaligned (void)
guint8 val = 0;
while (val == 0)
- val = nmtst_get_rand_int () % 256;
+ val = nmtst_get_rand_uint32 () % 256;
buf[shift] = val;