diff options
| author | Michael Biebl <biebl@debian.org> | 2017-11-07 00:14:39 +0100 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2017-11-07 00:14:39 +0100 |
| commit | 90e8691111889a7b5f3c812f5a41f15a8a058913 (patch) | |
| tree | f101a879eca27c34a9bfa5f3da52266b22539a36 /src/devices/wifi/tests/test-general.c | |
| parent | bdb6eeb0670658255c2a4c3c501c0a27fa8cfe55 (diff) | |
New upstream version 1.9.90 upstream/1.9.90
Diffstat (limited to 'src/devices/wifi/tests/test-general.c')
| -rw-r--r-- | src/devices/wifi/tests/test-general.c | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/src/devices/wifi/tests/test-general.c b/src/devices/wifi/tests/test-general.c index 3e61c5f0..89eebb22 100644 --- a/src/devices/wifi/tests/test-general.c +++ b/src/devices/wifi/tests/test-general.c @@ -44,16 +44,16 @@ \ success = nm_connection_compare (src, expected, NM_SETTING_COMPARE_FLAG_EXACT); \ if (success == FALSE && DEBUG) { \ - g_message ("\n- COMPLETED ---------------------------------\n"); \ + g_print ("\n- COMPLETED ---------------------------------\n"); \ nm_connection_dump (src); \ - g_message ("+ EXPECTED ++++++++++++++++++++++++++++++++++++\n"); \ + g_print ("+ EXPECTED ++++++++++++++++++++++++++++++++++++\n"); \ nm_connection_dump (expected); \ - g_message ("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n"); \ + g_print ("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n"); \ } \ g_assert (success == TRUE); \ } else { \ if (success) { \ - g_message ("\n- COMPLETED ---------------------------------\n"); \ + g_print ("\n- COMPLETED ---------------------------------\n"); \ nm_connection_dump (src); \ } \ g_assert (success == FALSE); \ @@ -1334,6 +1334,28 @@ test_strength_wext (void) g_assert_cmpint (nm_wifi_utils_level_to_quality (215), ==, 99); } +#define _assert_strength_in_range(x) \ + ({ \ + guint32 _x = (x); \ + g_assert_cmpint (_x, >=, 0); \ + g_assert_cmpint (_x, <=, 100); \ + }) + +static void +test_strength_all (void) +{ + int val; + + for (val = -200; val < 300; val++) + _assert_strength_in_range (nm_wifi_utils_level_to_quality (val)); + _assert_strength_in_range (nm_wifi_utils_level_to_quality (G_MININT)); + _assert_strength_in_range (nm_wifi_utils_level_to_quality (G_MAXINT)); + _assert_strength_in_range (nm_wifi_utils_level_to_quality (G_MININT32)); + _assert_strength_in_range (nm_wifi_utils_level_to_quality (G_MAXINT32)); + _assert_strength_in_range (nm_wifi_utils_level_to_quality (G_MININT16)); + _assert_strength_in_range (nm_wifi_utils_level_to_quality (G_MAXINT16)); +} + /*****************************************************************************/ NMTST_DEFINE (); @@ -1497,6 +1519,8 @@ main (int argc, char **argv) test_strength_percent); g_test_add_func ("/wifi/strength/wext", test_strength_wext); + g_test_add_func ("/wifi/strength/all", + test_strength_all); return g_test_run (); } |