diff options
author | Thomas Haller <thaller@redhat.com> | 2019-03-20 10:43:54 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2019-03-25 09:12:33 +0100 |
commit | 5b8305c27c4b657c333f127373156591601d541b (patch) | |
tree | ca38087221ceb63ffc975d44ae2b2863fcc624cc /libnm-core | |
parent | 70bad5c74d079d365abbdad916f8cee4dad223ec (diff) | |
download | NetworkManager-5b8305c27c4b657c333f127373156591601d541b.tar.gz |
shared: add NM_ASCII_SPACES macro
Diffstat (limited to 'libnm-core')
-rw-r--r-- | libnm-core/tests/test-general.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/libnm-core/tests/test-general.c b/libnm-core/tests/test-general.c index 876e48388a..6d5eeb2810 100644 --- a/libnm-core/tests/test-general.c +++ b/libnm-core/tests/test-general.c @@ -80,6 +80,29 @@ G_STATIC_ASSERT (sizeof (bool) <= sizeof (int)); /*****************************************************************************/ +static void +test_nm_ascii_spaces (void) +{ + int i; + const char *const S = NM_ASCII_SPACES; + + for (i = 0; S[i]; i++) + g_assert (!strchr (&S[i + 1], S[i])); + + for (i = 0; S[i] != '\0'; i++) + g_assert (g_ascii_isspace (S[i])); + + g_assert (!g_ascii_isspace ((char) 0)); + for (i = 1; i < 0x100; i++) { + if (g_ascii_isspace ((char) i)) + g_assert (strchr (S, (char) i)); + else + g_assert (!strchr (S, (char) i)); + } +} + +/*****************************************************************************/ + typedef struct _nm_packed { int v0; char v1; @@ -7810,6 +7833,7 @@ int main (int argc, char **argv) { nmtst_init (&argc, &argv, TRUE); + g_test_add_func ("/core/general/test_nm_ascii_spaces", test_nm_ascii_spaces); g_test_add_func ("/core/general/test_nm_hash", test_nm_hash); g_test_add_func ("/core/general/test_nm_g_slice_free_fcn", test_nm_g_slice_free_fcn); g_test_add_func ("/core/general/test_c_list_sort", test_c_list_sort); |