1 /* SPDX-License-Identifier: LGPL-2.1-or-later */ 2 3 #include "tests.h" 4 #include "udev-builtin.h" 5 TEST(udev_builtin_cmd_to_ptr)6TEST(udev_builtin_cmd_to_ptr) { 7 /* Those could have been static asserts, but ({}) is not allowed there. */ 8 #if HAVE_BLKID 9 assert_se(UDEV_BUILTIN_CMD_TO_PTR(UDEV_BUILTIN_BLKID)); 10 assert_se(PTR_TO_UDEV_BUILTIN_CMD(UDEV_BUILTIN_CMD_TO_PTR(UDEV_BUILTIN_BLKID)) == UDEV_BUILTIN_BLKID); 11 #endif 12 assert_se(UDEV_BUILTIN_CMD_TO_PTR(UDEV_BUILTIN_BTRFS)); 13 assert_se(PTR_TO_UDEV_BUILTIN_CMD(UDEV_BUILTIN_CMD_TO_PTR(UDEV_BUILTIN_BTRFS)) == UDEV_BUILTIN_BTRFS); 14 assert_se(PTR_TO_UDEV_BUILTIN_CMD(UDEV_BUILTIN_CMD_TO_PTR(_UDEV_BUILTIN_INVALID)) == _UDEV_BUILTIN_INVALID); 15 16 assert_se(PTR_TO_UDEV_BUILTIN_CMD(NULL) == _UDEV_BUILTIN_INVALID); 17 assert_se(PTR_TO_UDEV_BUILTIN_CMD((void*) 10000) == _UDEV_BUILTIN_INVALID); 18 } 19 20 DEFINE_TEST_MAIN(LOG_DEBUG); 21