From ce3da4affe9bad8edcf35c0d13f1ca153a1258b5 Mon Sep 17 00:00:00 2001 From: Vladislav Nepogodin Date: Fri, 9 Aug 2024 15:05:40 +0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=B7=20gucc:=20replace=20all=20require?= =?UTF-8?q?=20+=20=3D=3D=20with=20require=5Feq=20in=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gucc/tests/unit-btrfs.cpp | 24 +++++----- gucc/tests/unit-crypttab_gen.cpp | 12 ++--- gucc/tests/unit-fetch_file.cpp | 4 +- gucc/tests/unit-fstab_gen.cpp | 10 ++-- gucc/tests/unit-grub_config_gen.cpp | 4 +- gucc/tests/unit-kernel_params.cpp | 28 +++++------ gucc/tests/unit-mtab.cpp | 68 +++++++++++++-------------- gucc/tests/unit-package_profiles.cpp | 28 +++++------ gucc/tests/unit-refind_config_gen.cpp | 14 +++--- 9 files changed, 96 insertions(+), 96 deletions(-) diff --git a/gucc/tests/unit-btrfs.cpp b/gucc/tests/unit-btrfs.cpp index d737f45..e2345f9 100644 --- a/gucc/tests/unit-btrfs.cpp +++ b/gucc/tests/unit-btrfs.cpp @@ -42,8 +42,8 @@ TEST_CASE("BTRFS test") gucc::fs::Partition{.fstype = "fat32"s, .mountpoint = "/boot"s, .uuid_str = "8EFB-4B84"s, .device = "/dev/nvme0n1p2"s, .mount_opts = "defaults,noatime"s}, }; REQUIRE(gucc::fs::btrfs_append_subvolumes(partitions, subvolumes)); - REQUIRE(partitions.size() == 4); - REQUIRE(partitions == expected_partitions); + REQUIRE_EQ(partitions.size(), 4); + REQUIRE_EQ(partitions, expected_partitions); } SECTION("invalid btrfs with subvolumes") { @@ -58,8 +58,8 @@ TEST_CASE("BTRFS test") gucc::fs::Partition{.fstype = "fat32"s, .mountpoint = "/boot"s, .uuid_str = "8EFB-4B84"s, .device = "/dev/nvme0n1p2"s, .mount_opts = "defaults,noatime"s}, }; REQUIRE(!gucc::fs::btrfs_append_subvolumes(partitions, subvolumes)); - REQUIRE(partitions.size() == 3); - REQUIRE(partitions == expected_partitions); + REQUIRE_EQ(partitions.size(), 3); + REQUIRE_EQ(partitions, expected_partitions); } SECTION("invalid (without root part) btrfs with subvolumes") { @@ -74,8 +74,8 @@ TEST_CASE("BTRFS test") gucc::fs::Partition{.fstype = "fat32"s, .mountpoint = "/boot"s, .uuid_str = "8EFB-4B84"s, .device = "/dev/nvme0n1p2"s, .mount_opts = "defaults,noatime"s}, }; REQUIRE(!gucc::fs::btrfs_append_subvolumes(partitions, subvolumes)); - REQUIRE(partitions.size() == 3); - REQUIRE(partitions == expected_partitions); + REQUIRE_EQ(partitions.size(), 3); + REQUIRE_EQ(partitions, expected_partitions); } SECTION("btrfs without subvolumes") { @@ -88,8 +88,8 @@ TEST_CASE("BTRFS test") gucc::fs::Partition{.fstype = "fat32"s, .mountpoint = "/boot"s, .uuid_str = "8EFB-4B84"s, .device = "/dev/nvme0n1p2"s, .mount_opts = "defaults,noatime"s}, }; REQUIRE(gucc::fs::btrfs_append_subvolumes(partitions, {})); - REQUIRE(partitions.size() == 2); - REQUIRE(partitions == expected_partitions); + REQUIRE_EQ(partitions.size(), 2); + REQUIRE_EQ(partitions, expected_partitions); } SECTION("luks xfs") { @@ -104,7 +104,7 @@ TEST_CASE("BTRFS test") gucc::fs::Partition{.fstype = "vfat"s, .mountpoint = "/boot"s, .uuid_str = "8EFB-4B84"s, .device = "/dev/nvme0n1p2"s, .mount_opts = "defaults,noatime"s}, }; REQUIRE(!gucc::fs::btrfs_append_subvolumes(partitions, subvolumes)); - REQUIRE(partitions == expected_partitions); + REQUIRE_EQ(partitions, expected_partitions); } SECTION("valid zfs") { @@ -121,7 +121,7 @@ TEST_CASE("BTRFS test") gucc::fs::Partition{.fstype = "vfat"s, .mountpoint = "/boot"s, .uuid_str = "8EFB-4B84"s, .device = "/dev/nvme0n1p2"s, .mount_opts = "defaults,noatime"s}, }; REQUIRE(!gucc::fs::btrfs_append_subvolumes(partitions, subvolumes)); - REQUIRE(partitions == expected_partitions); + REQUIRE_EQ(partitions, expected_partitions); } SECTION("luks btrfs with subvolumes") { @@ -136,7 +136,7 @@ TEST_CASE("BTRFS test") gucc::fs::Partition{.fstype = "fat32"s, .mountpoint = "/boot"s, .uuid_str = "8EFB-4B84"s, .device = "/dev/nvme0n1p2"s, .mount_opts = "defaults,noatime"s}, }; REQUIRE(gucc::fs::btrfs_append_subvolumes(partitions, subvolumes)); - REQUIRE(partitions.size() == 4); - REQUIRE(partitions == expected_partitions); + REQUIRE_EQ(partitions.size(), 4); + REQUIRE_EQ(partitions, expected_partitions); } } diff --git a/gucc/tests/unit-crypttab_gen.cpp b/gucc/tests/unit-crypttab_gen.cpp index 86e2871..76bd331 100644 --- a/gucc/tests/unit-crypttab_gen.cpp +++ b/gucc/tests/unit-crypttab_gen.cpp @@ -61,7 +61,7 @@ TEST_CASE("crypttab gen test") gucc::fs::Partition{.fstype = "fat32"s, .mountpoint = "/boot"s, .uuid_str = "8EFB-4B84"s, .device = "/dev/nvme0n1p2"s, .mount_opts = "defaults,noatime"s, .luks_mapper_name = "", .luks_uuid = ""}, }; const auto& crypttab_content = gucc::fs::generate_crypttab_content(partitions, "luks"sv); - REQUIRE(crypttab_content == CRYPTTAB_EMPTY_TEST); + REQUIRE_EQ(crypttab_content, CRYPTTAB_EMPTY_TEST); } SECTION("basic xfs") { @@ -70,7 +70,7 @@ TEST_CASE("crypttab gen test") gucc::fs::Partition{.fstype = "fat16"s, .mountpoint = "/boot"s, .uuid_str = "8EFB-4B84"s, .device = "/dev/nvme0n1p2"s, .mount_opts = "defaults,noatime"s, .luks_uuid = ""}, }; const auto& crypttab_content = gucc::fs::generate_crypttab_content(partitions, "luks"sv); - REQUIRE(crypttab_content == CRYPTTAB_EMPTY_TEST); + REQUIRE_EQ(crypttab_content, CRYPTTAB_EMPTY_TEST); } SECTION("luks xfs") { @@ -80,7 +80,7 @@ TEST_CASE("crypttab gen test") gucc::fs::Partition{.fstype = "vfat"s, .mountpoint = "/boot"s, .uuid_str = "8EFB-4B84"s, .device = "/dev/nvme0n1p2"s, .mount_opts = "defaults,noatime"s}, }; const auto& crypttab_content = gucc::fs::generate_crypttab_content(partitions, "luks"sv); - REQUIRE(crypttab_content == CRYPTTAB_UNENCR_BOOT_TEST); + REQUIRE_EQ(crypttab_content, CRYPTTAB_UNENCR_BOOT_TEST); } SECTION("zfs") { @@ -91,7 +91,7 @@ TEST_CASE("crypttab gen test") gucc::fs::Partition{.fstype = "vfat"s, .mountpoint = "/boot"s, .uuid_str = "8EFB-4B84"s, .device = "/dev/nvme0n1p2"s, .mount_opts = "defaults,noatime"s}, }; const auto& crypttab_content = gucc::fs::generate_crypttab_content(partitions, "luks"sv); - REQUIRE(crypttab_content == CRYPTTAB_EMPTY_TEST); + REQUIRE_EQ(crypttab_content, CRYPTTAB_EMPTY_TEST); } SECTION("luks btrfs with subvolumes") { @@ -102,7 +102,7 @@ TEST_CASE("crypttab gen test") gucc::fs::Partition{.fstype = "fat32"s, .mountpoint = "/boot"s, .uuid_str = "8EFB-4B84"s, .device = "/dev/nvme0n1p2"s, .mount_opts = "defaults,noatime"s}, }; const auto& crypttab_content = gucc::fs::generate_crypttab_content(partitions, "luks"sv); - REQUIRE(crypttab_content == CRYPTTAB_UNENCR_BOOT_TEST); + REQUIRE_EQ(crypttab_content, CRYPTTAB_UNENCR_BOOT_TEST); } SECTION("luks btrfs with subvolumes {shuffled}") { @@ -113,7 +113,7 @@ TEST_CASE("crypttab gen test") gucc::fs::Partition{.fstype = "btrfs"s, .mountpoint = "/var/cache"s, .device = "/dev/nvme0n1p1"s, .mount_opts = btrfs_mountopts, .subvolume = "/@cache"s, .luks_mapper_name = "luks-6bdb3301-8efb-4b84-b0b7-4caeef26fd6f"s, .luks_uuid = "6bdb3301-8efb-4b84-b0b7-4caeef26fd6f"s}, }; const auto& crypttab_content = gucc::fs::generate_crypttab_content(partitions, "luks"sv); - REQUIRE(crypttab_content == CRYPTTAB_UNENCR_BOOT_TEST); + REQUIRE_EQ(crypttab_content, CRYPTTAB_UNENCR_BOOT_TEST); } /* diff --git a/gucc/tests/unit-fetch_file.cpp b/gucc/tests/unit-fetch_file.cpp index 8ceadad..4ee4726 100644 --- a/gucc/tests/unit-fetch_file.cpp +++ b/gucc/tests/unit-fetch_file.cpp @@ -24,7 +24,7 @@ TEST_CASE("fetch file test") REQUIRE(!file_content->empty()); const auto& expected_file_content = gucc::file_utils::read_whole_file(LICENSE_PATH); - REQUIRE(file_content == expected_file_content); + REQUIRE_EQ(file_content, expected_file_content); } SECTION("non existent remote url, existing fallback url") { @@ -35,7 +35,7 @@ TEST_CASE("fetch file test") REQUIRE(!file_content->empty()); const auto& expected_file_content = gucc::file_utils::read_whole_file(LICENSE_PATH); - REQUIRE(file_content == expected_file_content); + REQUIRE_EQ(file_content, expected_file_content); } SECTION("non existent remote url, non existent fallback url") { diff --git a/gucc/tests/unit-fstab_gen.cpp b/gucc/tests/unit-fstab_gen.cpp index bda03f3..693e6e3 100644 --- a/gucc/tests/unit-fstab_gen.cpp +++ b/gucc/tests/unit-fstab_gen.cpp @@ -100,7 +100,7 @@ TEST_CASE("fstab gen test") gucc::fs::Partition{.fstype = "fat32"s, .mountpoint = "/boot"s, .uuid_str = "8EFB-4B84"s, .device = "/dev/nvme0n1p2"s, .mount_opts = "defaults,noatime"s}, }; const auto& fstab_content = gucc::fs::generate_fstab_content(partitions); - REQUIRE(fstab_content == FSTAB_BTRFS_TEST); + REQUIRE_EQ(fstab_content, FSTAB_BTRFS_TEST); } SECTION("basic xfs") { @@ -109,7 +109,7 @@ TEST_CASE("fstab gen test") gucc::fs::Partition{.fstype = "fat16"s, .mountpoint = "/boot"s, .uuid_str = "8EFB-4B84"s, .device = "/dev/nvme0n1p2"s, .mount_opts = "defaults,noatime"s}, }; const auto& fstab_content = gucc::fs::generate_fstab_content(partitions); - REQUIRE(fstab_content == FSTAB_XFS_TEST); + REQUIRE_EQ(fstab_content, FSTAB_XFS_TEST); } SECTION("luks xfs") { @@ -119,7 +119,7 @@ TEST_CASE("fstab gen test") gucc::fs::Partition{.fstype = "vfat"s, .mountpoint = "/boot"s, .uuid_str = "8EFB-4B84"s, .device = "/dev/nvme0n1p2"s, .mount_opts = "defaults,noatime"s}, }; const auto& fstab_content = gucc::fs::generate_fstab_content(partitions); - REQUIRE(fstab_content == FSTAB_LUKS_XFS_TEST); + REQUIRE_EQ(fstab_content, FSTAB_LUKS_XFS_TEST); } SECTION("zfs") { @@ -130,7 +130,7 @@ TEST_CASE("fstab gen test") gucc::fs::Partition{.fstype = "vfat"s, .mountpoint = "/boot"s, .uuid_str = "8EFB-4B84"s, .device = "/dev/nvme0n1p2"s, .mount_opts = "defaults,noatime"s}, }; const auto& fstab_content = gucc::fs::generate_fstab_content(partitions); - REQUIRE(fstab_content == FSTAB_ZFS_TEST); + REQUIRE_EQ(fstab_content, FSTAB_ZFS_TEST); } SECTION("luks btrfs with subvolumes") { @@ -141,6 +141,6 @@ TEST_CASE("fstab gen test") gucc::fs::Partition{.fstype = "fat32"s, .mountpoint = "/boot"s, .uuid_str = "8EFB-4B84"s, .device = "/dev/nvme0n1p2"s, .mount_opts = "defaults,noatime"s}, }; const auto& fstab_content = gucc::fs::generate_fstab_content(partitions); - REQUIRE(fstab_content == FSTAB_LUKS_BTRFS_TEST); + REQUIRE_EQ(fstab_content, FSTAB_LUKS_BTRFS_TEST); } } diff --git a/gucc/tests/unit-grub_config_gen.cpp b/gucc/tests/unit-grub_config_gen.cpp index 854078f..4438752 100644 --- a/gucc/tests/unit-grub_config_gen.cpp +++ b/gucc/tests/unit-grub_config_gen.cpp @@ -127,7 +127,7 @@ TEST_CASE("grub config gen test") { const gucc::bootloader::GrubConfig grub_config{}; const auto& grub_config_content = gucc::bootloader::gen_grub_config(grub_config); - REQUIRE(grub_config_content == GRUB_DEFAULTS_TEST); + REQUIRE_EQ(grub_config_content, GRUB_DEFAULTS_TEST); } SECTION("optionals set") { @@ -156,6 +156,6 @@ TEST_CASE("grub config gen test") .disable_os_prober = false, }; const auto& grub_config_content = filtered_res(gucc::bootloader::gen_grub_config(grub_config)); - REQUIRE(grub_config_content == GRUB_OPTIONALS_TEST); + REQUIRE_EQ(grub_config_content, GRUB_OPTIONALS_TEST); } } diff --git a/gucc/tests/unit-kernel_params.cpp b/gucc/tests/unit-kernel_params.cpp index e3c2311..a917b9f 100644 --- a/gucc/tests/unit-kernel_params.cpp +++ b/gucc/tests/unit-kernel_params.cpp @@ -34,8 +34,8 @@ TEST_CASE("kernel params get test") }; const auto& kernel_params = gucc::fs::get_kernel_params(partitions, DEFAULT_KERNEL_PARAMS); REQUIRE(kernel_params.has_value()); - REQUIRE(kernel_params->size() == 5); - REQUIRE((*kernel_params == std::vector{"quiet", "splash", "rw", "rootflags=subvol=/@", "root=UUID=6bdb3301-8efb-4b84-b0b7-4caeef26fd6f"})); + REQUIRE_EQ(kernel_params->size(), 5); + REQUIRE_EQ(*kernel_params, std::vector{"quiet", "splash", "rw", "rootflags=subvol=/@", "root=UUID=6bdb3301-8efb-4b84-b0b7-4caeef26fd6f"}); } SECTION("invalid xfs (empty uuid)") { @@ -63,8 +63,8 @@ TEST_CASE("kernel params get test") }; const auto& kernel_params = gucc::fs::get_kernel_params(partitions, DEFAULT_KERNEL_PARAMS); REQUIRE(kernel_params.has_value()); - REQUIRE(kernel_params->size() == 4); - REQUIRE((*kernel_params == std::vector{"quiet", "splash", "rw", "root=UUID=6bdb3301-8efb-4b84-b0b7-4caeef26fd6f"})); + REQUIRE_EQ(kernel_params->size(), 4); + REQUIRE_EQ(*kernel_params, std::vector{"quiet", "splash", "rw", "root=UUID=6bdb3301-8efb-4b84-b0b7-4caeef26fd6f"}); } SECTION("swap xfs") { @@ -75,8 +75,8 @@ TEST_CASE("kernel params get test") }; const auto& kernel_params = gucc::fs::get_kernel_params(partitions, DEFAULT_KERNEL_PARAMS); REQUIRE(kernel_params.has_value()); - REQUIRE(kernel_params->size() == 5); - REQUIRE((*kernel_params == std::vector{"quiet", "splash", "rw", "root=UUID=6bdb3301-8efb-4b84-b0b7-4caeef26fd6f", "resume=UUID=59848b1b-c6be-48f4-b3e1-48179ea72dec"})); + REQUIRE_EQ(kernel_params->size(), 5); + REQUIRE_EQ(*kernel_params, std::vector{"quiet", "splash", "rw", "root=UUID=6bdb3301-8efb-4b84-b0b7-4caeef26fd6f", "resume=UUID=59848b1b-c6be-48f4-b3e1-48179ea72dec"}); } SECTION("luks xfs") { @@ -87,8 +87,8 @@ TEST_CASE("kernel params get test") }; const auto& kernel_params = gucc::fs::get_kernel_params(partitions, DEFAULT_KERNEL_PARAMS); REQUIRE(kernel_params.has_value()); - REQUIRE(kernel_params->size() == 5); - REQUIRE((*kernel_params == std::vector{"quiet", "splash", "rw", "cryptdevice=UUID=00e1b836-81b6-433f-83ca-0fd373e3cd50:luks_device", "root=/dev/mapper/luks_device"})); + REQUIRE_EQ(kernel_params->size(), 5); + REQUIRE_EQ(*kernel_params, std::vector{"quiet", "splash", "rw", "cryptdevice=UUID=00e1b836-81b6-433f-83ca-0fd373e3cd50:luks_device", "root=/dev/mapper/luks_device"}); } SECTION("luks swap xfs") { @@ -99,8 +99,8 @@ TEST_CASE("kernel params get test") }; const auto& kernel_params = gucc::fs::get_kernel_params(partitions, DEFAULT_KERNEL_PARAMS); REQUIRE(kernel_params.has_value()); - REQUIRE(kernel_params->size() == 6); - REQUIRE((*kernel_params == std::vector{"quiet", "splash", "rw", "cryptdevice=UUID=00e1b836-81b6-433f-83ca-0fd373e3cd50:luks_device", "root=/dev/mapper/luks_device", "resume=/dev/mapper/luks_swap_device"})); + REQUIRE_EQ(kernel_params->size(), 6); + REQUIRE_EQ(*kernel_params, std::vector{"quiet", "splash", "rw", "cryptdevice=UUID=00e1b836-81b6-433f-83ca-0fd373e3cd50:luks_device", "root=/dev/mapper/luks_device", "resume=/dev/mapper/luks_swap_device"}); } SECTION("invalid zfs") { @@ -123,8 +123,8 @@ TEST_CASE("kernel params get test") }; const auto& kernel_params = gucc::fs::get_kernel_params(partitions, DEFAULT_KERNEL_PARAMS, "zpcachyos/ROOT"); REQUIRE(kernel_params.has_value()); - REQUIRE(kernel_params->size() == 5); - REQUIRE((*kernel_params == std::vector{"quiet", "splash", "rw", "root=ZFS=zpcachyos/ROOT", "root=UUID=6bdb3301-8efb-4b84-b0b7-4caeef26fd6f"})); + REQUIRE_EQ(kernel_params->size(), 5); + REQUIRE_EQ(*kernel_params, std::vector{"quiet", "splash", "rw", "root=ZFS=zpcachyos/ROOT", "root=UUID=6bdb3301-8efb-4b84-b0b7-4caeef26fd6f"}); } SECTION("luks btrfs with subvolumes") { @@ -136,7 +136,7 @@ TEST_CASE("kernel params get test") }; const auto& kernel_params = gucc::fs::get_kernel_params(partitions, DEFAULT_KERNEL_PARAMS); REQUIRE(kernel_params.has_value()); - REQUIRE(kernel_params->size() == 6); - REQUIRE((*kernel_params == std::vector{"quiet", "splash", "rw", "rootflags=subvol=/@", "cryptdevice=UUID=6bdb3301-8efb-4b84-b0b7-4caeef26fd6f:luks-6bdb3301-8efb-4b84-b0b7-4caeef26fd6f", "root=/dev/mapper/luks-6bdb3301-8efb-4b84-b0b7-4caeef26fd6f"})); + REQUIRE_EQ(kernel_params->size(), 6); + REQUIRE_EQ(*kernel_params, std::vector{"quiet", "splash", "rw", "rootflags=subvol=/@", "cryptdevice=UUID=6bdb3301-8efb-4b84-b0b7-4caeef26fd6f:luks-6bdb3301-8efb-4b84-b0b7-4caeef26fd6f", "root=/dev/mapper/luks-6bdb3301-8efb-4b84-b0b7-4caeef26fd6f"}); } } diff --git a/gucc/tests/unit-mtab.cpp b/gucc/tests/unit-mtab.cpp index 96d70d2..1d1bc93 100644 --- a/gucc/tests/unit-mtab.cpp +++ b/gucc/tests/unit-mtab.cpp @@ -112,11 +112,11 @@ TEST_CASE("mtab test") SECTION("running system") { const auto& mtab_entries = gucc::mtab::parse_mtab_content(MTAB_RUNNING_SYSTEM_TEST, "/mnt"sv); - REQUIRE(mtab_entries.size() == 2); - REQUIRE(mtab_entries[0].device == "/dev/nvme0n1p3"); - REQUIRE(mtab_entries[0].mountpoint == "/mnt"); - REQUIRE(mtab_entries[1].device == "/dev/nvme0n1p1"); - REQUIRE(mtab_entries[1].mountpoint == "/mnt/boot"); + REQUIRE_EQ(mtab_entries.size(), 2); + REQUIRE_EQ(mtab_entries[0].device, "/dev/nvme0n1p3"); + REQUIRE_EQ(mtab_entries[0].mountpoint, "/mnt"); + REQUIRE_EQ(mtab_entries[1].device, "/dev/nvme0n1p1"); + REQUIRE_EQ(mtab_entries[1].mountpoint, "/mnt/boot"); } SECTION("live iso system") { @@ -136,36 +136,36 @@ TEST_CASE("mtab test") fs::remove(filename); const auto& entries = *mtab_entries; - REQUIRE(entries.size() == 14); - REQUIRE(entries[0].device == "/dev/sda2"); - REQUIRE(entries[0].mountpoint == "/tmp/calamares-root-q_z5rdlx"); - REQUIRE(entries[1].device == "/dev/sda2"); - REQUIRE(entries[1].mountpoint == "/tmp/calamares-root-q_z5rdlx/home"); - REQUIRE(entries[2].device == "/dev/sda2"); - REQUIRE(entries[2].mountpoint == "/tmp/calamares-root-q_z5rdlx/root"); - REQUIRE(entries[3].device == "/dev/sda2"); - REQUIRE(entries[3].mountpoint == "/tmp/calamares-root-q_z5rdlx/srv"); - REQUIRE(entries[4].device == "/dev/sda2"); - REQUIRE(entries[4].mountpoint == "/tmp/calamares-root-q_z5rdlx/var/cache"); - REQUIRE(entries[5].device == "/dev/sda2"); - REQUIRE(entries[5].mountpoint == "/tmp/calamares-root-q_z5rdlx/var/tmp"); - REQUIRE(entries[6].device == "/dev/sda2"); - REQUIRE(entries[6].mountpoint == "/tmp/calamares-root-q_z5rdlx/var/log"); - REQUIRE(entries[7].device == "/dev/sda1"); - REQUIRE(entries[7].mountpoint == "/tmp/calamares-root-q_z5rdlx/boot"); + REQUIRE_EQ(entries.size(), 14); + REQUIRE_EQ(entries[0].device, "/dev/sda2"); + REQUIRE_EQ(entries[0].mountpoint, "/tmp/calamares-root-q_z5rdlx"); + REQUIRE_EQ(entries[1].device, "/dev/sda2"); + REQUIRE_EQ(entries[1].mountpoint, "/tmp/calamares-root-q_z5rdlx/home"); + REQUIRE_EQ(entries[2].device, "/dev/sda2"); + REQUIRE_EQ(entries[2].mountpoint, "/tmp/calamares-root-q_z5rdlx/root"); + REQUIRE_EQ(entries[3].device, "/dev/sda2"); + REQUIRE_EQ(entries[3].mountpoint, "/tmp/calamares-root-q_z5rdlx/srv"); + REQUIRE_EQ(entries[4].device, "/dev/sda2"); + REQUIRE_EQ(entries[4].mountpoint, "/tmp/calamares-root-q_z5rdlx/var/cache"); + REQUIRE_EQ(entries[5].device, "/dev/sda2"); + REQUIRE_EQ(entries[5].mountpoint, "/tmp/calamares-root-q_z5rdlx/var/tmp"); + REQUIRE_EQ(entries[6].device, "/dev/sda2"); + REQUIRE_EQ(entries[6].mountpoint, "/tmp/calamares-root-q_z5rdlx/var/log"); + REQUIRE_EQ(entries[7].device, "/dev/sda1"); + REQUIRE_EQ(entries[7].mountpoint, "/tmp/calamares-root-q_z5rdlx/boot"); - REQUIRE(entries[8].device == "dev"); - REQUIRE(entries[8].mountpoint == "/tmp/calamares-root-q_z5rdlx/dev"); - REQUIRE(entries[9].device == "proc"); - REQUIRE(entries[9].mountpoint == "/tmp/calamares-root-q_z5rdlx/proc"); - REQUIRE(entries[10].device == "tmpfs"); - REQUIRE(entries[10].mountpoint == "/tmp/calamares-root-q_z5rdlx/run"); - REQUIRE(entries[11].device == "run"); - REQUIRE(entries[11].mountpoint == "/tmp/calamares-root-q_z5rdlx/run/udev"); - REQUIRE(entries[12].device == "sys"); - REQUIRE(entries[12].mountpoint == "/tmp/calamares-root-q_z5rdlx/sys"); - REQUIRE(entries[13].device == "efivarfs"); - REQUIRE(entries[13].mountpoint == "/tmp/calamares-root-q_z5rdlx/sys/firmware/efi/efivars"); + REQUIRE_EQ(entries[8].device, "dev"); + REQUIRE_EQ(entries[8].mountpoint, "/tmp/calamares-root-q_z5rdlx/dev"); + REQUIRE_EQ(entries[9].device, "proc"); + REQUIRE_EQ(entries[9].mountpoint, "/tmp/calamares-root-q_z5rdlx/proc"); + REQUIRE_EQ(entries[10].device, "tmpfs"); + REQUIRE_EQ(entries[10].mountpoint, "/tmp/calamares-root-q_z5rdlx/run"); + REQUIRE_EQ(entries[11].device, "run"); + REQUIRE_EQ(entries[11].mountpoint, "/tmp/calamares-root-q_z5rdlx/run/udev"); + REQUIRE_EQ(entries[12].device, "sys"); + REQUIRE_EQ(entries[12].mountpoint, "/tmp/calamares-root-q_z5rdlx/sys"); + REQUIRE_EQ(entries[13].device, "efivarfs"); + REQUIRE_EQ(entries[13].mountpoint, "/tmp/calamares-root-q_z5rdlx/sys/firmware/efi/efivars"); } SECTION("empty file") { diff --git a/gucc/tests/unit-package_profiles.cpp b/gucc/tests/unit-package_profiles.cpp index 43c5ef9..591d560 100644 --- a/gucc/tests/unit-package_profiles.cpp +++ b/gucc/tests/unit-package_profiles.cpp @@ -49,26 +49,26 @@ TEST_CASE("package profiles test") { auto base_profs = gucc::profile::parse_base_profiles(VALID_PROFILE_TEST); REQUIRE(base_profs); - REQUIRE((base_profs->base_packages == std::vector{"a", "b"})); - REQUIRE((base_profs->base_desktop_packages == std::vector{"c", "d", "f"})); + REQUIRE_EQ(base_profs->base_packages, std::vector{"a", "b"}); + REQUIRE_EQ(base_profs->base_desktop_packages, std::vector{"c", "d", "f"}); auto base_desktop_profs = gucc::profile::parse_desktop_profiles(VALID_PROFILE_TEST); REQUIRE(base_desktop_profs); - REQUIRE(base_desktop_profs->size() == 2); - REQUIRE(((*base_desktop_profs)[0].profile_name == "someprofile-1")); - REQUIRE(((*base_desktop_profs)[0].packages == std::vector{"ca", "da", "fa"})); - REQUIRE(((*base_desktop_profs)[1].profile_name == "someprofile-2")); - REQUIRE(((*base_desktop_profs)[1].packages == std::vector{"cb", "db", "fb"})); + REQUIRE_EQ(base_desktop_profs->size(), 2); + REQUIRE_EQ((*base_desktop_profs)[0].profile_name, "someprofile-1"); + REQUIRE_EQ((*base_desktop_profs)[0].packages, std::vector{"ca", "da", "fa"}); + REQUIRE_EQ((*base_desktop_profs)[1].profile_name, "someprofile-2"); + REQUIRE_EQ((*base_desktop_profs)[1].packages, std::vector{"cb", "db", "fb"}); auto net_profs = gucc::profile::parse_net_profiles(VALID_PROFILE_TEST); REQUIRE(net_profs); - REQUIRE((net_profs->base_profiles.base_packages == std::vector{"a", "b"})); - REQUIRE((net_profs->base_profiles.base_desktop_packages == std::vector{"c", "d", "f"})); - REQUIRE(net_profs->desktop_profiles.size() == 2); - REQUIRE((net_profs->desktop_profiles[0].profile_name == "someprofile-1")); - REQUIRE((net_profs->desktop_profiles[0].packages == std::vector{"ca", "da", "fa"})); - REQUIRE((net_profs->desktop_profiles[1].profile_name == "someprofile-2")); - REQUIRE((net_profs->desktop_profiles[1].packages == std::vector{"cb", "db", "fb"})); + REQUIRE_EQ(net_profs->base_profiles.base_packages, std::vector{"a", "b"}); + REQUIRE_EQ(net_profs->base_profiles.base_desktop_packages, std::vector{"c", "d", "f"}); + REQUIRE_EQ(net_profs->desktop_profiles.size(), 2); + REQUIRE_EQ(net_profs->desktop_profiles[0].profile_name, "someprofile-1"); + REQUIRE_EQ(net_profs->desktop_profiles[0].packages, std::vector{"ca", "da", "fa"}); + REQUIRE_EQ(net_profs->desktop_profiles[1].profile_name, "someprofile-2"); + REQUIRE_EQ(net_profs->desktop_profiles[1].packages, std::vector{"cb", "db", "fb"}); } SECTION("invalid profile") { diff --git a/gucc/tests/unit-refind_config_gen.cpp b/gucc/tests/unit-refind_config_gen.cpp index 8207e74..501b16f 100644 --- a/gucc/tests/unit-refind_config_gen.cpp +++ b/gucc/tests/unit-refind_config_gen.cpp @@ -57,48 +57,48 @@ TEST_CASE("refind config gen test") "quiet", "splash", "rw", "rootflags=subvol=/@", "root=UUID=6bdb3301-8efb-4b84-b0b7-4caeef26fd6f"}; const auto& refind_config_text = gucc::bootloader::gen_refind_config(kernel_params); - REQUIRE(refind_config_text == REFIND_CONFIG_SUBVOL_TEST); + REQUIRE_EQ(refind_config_text, REFIND_CONFIG_SUBVOL_TEST); } SECTION("basic xfs") { const std::vector kernel_params{ "quiet", "splash", "rw", "root=UUID=6bdb3301-8efb-4b84-b0b7-4caeef26fd6f"}; const auto& refind_config_text = gucc::bootloader::gen_refind_config(kernel_params); - REQUIRE(refind_config_text == REFIND_CONFIG_TEST); + REQUIRE_EQ(refind_config_text, REFIND_CONFIG_TEST); } SECTION("swap xfs") { const std::vector kernel_params{ "quiet", "splash", "rw", "root=UUID=6bdb3301-8efb-4b84-b0b7-4caeef26fd6f", "resume=UUID=59848b1b-c6be-48f4-b3e1-48179ea72dec"}; const auto& refind_config_text = gucc::bootloader::gen_refind_config(kernel_params); - REQUIRE(refind_config_text == REFIND_CONFIG_SWAP_TEST); + REQUIRE_EQ(refind_config_text, REFIND_CONFIG_SWAP_TEST); } SECTION("luks xfs") { const std::vector kernel_params{ "quiet", "splash", "rw", "cryptdevice=UUID=00e1b836-81b6-433f-83ca-0fd373e3cd50:luks_device", "root=/dev/mapper/luks_device"}; const auto& refind_config_text = gucc::bootloader::gen_refind_config(kernel_params); - REQUIRE(refind_config_text == REFIND_CONFIG_LUKS_TEST); + REQUIRE_EQ(refind_config_text, REFIND_CONFIG_LUKS_TEST); } SECTION("luks swap xfs") { const std::vector kernel_params{ "quiet", "splash", "rw", "cryptdevice=UUID=00e1b836-81b6-433f-83ca-0fd373e3cd50:luks_device", "root=/dev/mapper/luks_device", "resume=/dev/mapper/luks_swap_device"}; const auto& refind_config_text = gucc::bootloader::gen_refind_config(kernel_params); - REQUIRE(refind_config_text == REFIND_CONFIG_LUKS_SWAP_TEST); + REQUIRE_EQ(refind_config_text, REFIND_CONFIG_LUKS_SWAP_TEST); } SECTION("valid zfs") { const std::vector kernel_params{ "quiet", "splash", "rw", "root=ZFS=zpcachyos/ROOT", "root=UUID=6bdb3301-8efb-4b84-b0b7-4caeef26fd6f"}; const auto& refind_config_text = gucc::bootloader::gen_refind_config(kernel_params); - REQUIRE(refind_config_text == REFIND_CONFIG_ZFS_TEST); + REQUIRE_EQ(refind_config_text, REFIND_CONFIG_ZFS_TEST); } SECTION("luks btrfs with subvolumes") { const std::vector kernel_params{ "quiet", "splash", "rw", "rootflags=subvol=/@", "cryptdevice=UUID=6bdb3301-8efb-4b84-b0b7-4caeef26fd6f:luks-6bdb3301-8efb-4b84-b0b7-4caeef26fd6f", "root=/dev/mapper/luks-6bdb3301-8efb-4b84-b0b7-4caeef26fd6f"}; const auto& refind_config_text = gucc::bootloader::gen_refind_config(kernel_params); - REQUIRE(refind_config_text == REFIND_CONFIG_LUKS_SUBVOL_TEST); + REQUIRE_EQ(refind_config_text, REFIND_CONFIG_LUKS_SUBVOL_TEST); } }