diff --git a/tests/lib/vfs/path_len.c b/tests/lib/vfs/path_len.c index 6bab6f551..b9a2717bb 100644 --- a/tests/lib/vfs/path_len.c +++ b/tests/lib/vfs/path_len.c @@ -74,25 +74,30 @@ teardown (void) static const struct test_path_length_ds { const char *input_path; - const size_t expected_length; + const size_t expected_length_element_encoding; + const size_t expected_length_terminal_encoding; } test_path_length_ds[] = { { /* 0. */ NULL, + 0, 0 }, { /* 1. */ "/", + 1, 1 }, { /* 2. */ "/тестовый/путь", + 26, 26 }, #ifdef HAVE_CHARSET { /* 3. */ "/#enc:KOI8-R/тестовый/путь", - 38 + 14, + 38, }, #endif /* HAVE_CHARSET */ }; @@ -105,15 +110,19 @@ START_PARAMETRIZED_TEST (test_path_length, test_path_length_ds) { /* given */ vfs_path_t *vpath; - size_t actual_length; + char *path; + size_t actual_length_terminal_encoding, actual_length_element_encoding; vpath = vfs_path_from_str (data->input_path); + path = vpath != NULL ? vfs_path_get_by_index (vpath, 0)->path : NULL; /* when */ - actual_length = vfs_path_len (vpath); + actual_length_terminal_encoding = vfs_path_len (vpath); + actual_length_element_encoding = path != NULL ? strlen (path) : 0; /* then */ - ck_assert_int_eq (actual_length, data->expected_length); + ck_assert_int_eq (actual_length_terminal_encoding, data->expected_length_terminal_encoding); + ck_assert_int_eq (actual_length_element_encoding, data->expected_length_element_encoding); vfs_path_free (vpath, TRUE); }