-static void check_p_g_m_n(const char *path, int code, const char *result) {
- _cleanup_free_ char *m = NULL;
-
- assert_se(cg_path_get_machine_name(path, &m) == code);
- assert_se(streq_ptr(m, result));
-}
-
-static void test_path_get_machine_name(void) {
- check_p_g_m_n("/user.slice/machine-foobar.scope", 0, "foobar");
- check_p_g_m_n("/machine-foobar.scope", 0, "foobar");
- check_p_g_m_n("/user.slice/user-kuux.slice/machine-foobar.scope", 0, "foobar");
- check_p_g_m_n("/user.slice/user-kuux.slice/machine-foobar.scope/asjhdkj", 0, "foobar");
- check_p_g_m_n("", -ENOENT, NULL);
-}
-