From 0c2d88cd36876df5eeb4ada2f9d339ce45b575be Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Thu, 9 Jul 2026 14:09:57 +0200 Subject: chore: rename test source files --- libs/acpi/CMakeLists.txt | 10 ++--- libs/acpi/acpi/common/table_header.test.cpp | 60 ---------------------------- libs/acpi/acpi/common/table_header.tests.cpp | 60 ++++++++++++++++++++++++++++ libs/acpi/acpi/data/madt.test.cpp | 57 -------------------------- libs/acpi/acpi/data/madt.tests.cpp | 57 ++++++++++++++++++++++++++ libs/acpi/acpi/data/rsdt.test.cpp | 48 ---------------------- libs/acpi/acpi/data/rsdt.tests.cpp | 48 ++++++++++++++++++++++ libs/acpi/acpi/data/xsdt.test.cpp | 48 ---------------------- libs/acpi/acpi/data/xsdt.tests.cpp | 48 ++++++++++++++++++++++ libs/acpi/acpi/pointers.test.cpp | 30 -------------- libs/acpi/acpi/pointers.tests.cpp | 30 ++++++++++++++ 11 files changed, 248 insertions(+), 248 deletions(-) delete mode 100644 libs/acpi/acpi/common/table_header.test.cpp create mode 100644 libs/acpi/acpi/common/table_header.tests.cpp delete mode 100644 libs/acpi/acpi/data/madt.test.cpp create mode 100644 libs/acpi/acpi/data/madt.tests.cpp delete mode 100644 libs/acpi/acpi/data/rsdt.test.cpp create mode 100644 libs/acpi/acpi/data/rsdt.tests.cpp delete mode 100644 libs/acpi/acpi/data/xsdt.test.cpp create mode 100644 libs/acpi/acpi/data/xsdt.tests.cpp delete mode 100644 libs/acpi/acpi/pointers.test.cpp create mode 100644 libs/acpi/acpi/pointers.tests.cpp (limited to 'libs/acpi') diff --git a/libs/acpi/CMakeLists.txt b/libs/acpi/CMakeLists.txt index 58661c5e..76941dcf 100644 --- a/libs/acpi/CMakeLists.txt +++ b/libs/acpi/CMakeLists.txt @@ -92,11 +92,11 @@ if(BUILD_TESTING) add_executable("acpi::tests" ALIAS "acpi_tests") target_sources("acpi_tests" PRIVATE - "acpi/common/table_header.test.cpp" - "acpi/data/madt.test.cpp" - "acpi/data/rsdt.test.cpp" - "acpi/data/xsdt.test.cpp" - "acpi/pointers.test.cpp" + "acpi/common/table_header.tests.cpp" + "acpi/data/madt.tests.cpp" + "acpi/data/rsdt.tests.cpp" + "acpi/data/xsdt.tests.cpp" + "acpi/pointers.tests.cpp" "acpi/test_data/tables.S" ) diff --git a/libs/acpi/acpi/common/table_header.test.cpp b/libs/acpi/acpi/common/table_header.test.cpp deleted file mode 100644 index bbd42bd6..00000000 --- a/libs/acpi/acpi/common/table_header.test.cpp +++ /dev/null @@ -1,60 +0,0 @@ -#include - -#include - -#include - -#include - -SCENARIO("Common table header parsing", "[common_table_header]") -{ - GIVEN("A valid compiled table header") - { - auto data = acpi::test_data::tables::table_header(); - - WHEN("parsing the header") - { - auto header = reinterpret_cast(data.data()); - - THEN("the signature is correct") - { - REQUIRE(header->signature() == "TEST"); - } - - THEN("the revision is correct") - { - REQUIRE(header->revision() == 1); - } - - THEN("the length is correct") - { - REQUIRE(header->length() == kstd::type_size); - } - - THEN("the oem id is correct") - { - REQUIRE(header->oem_id() == "FEMO "); - } - - THEN("the oem table id is correct") - { - REQUIRE(header->oem_table_id() == "HDRTEST "); - } - - THEN("the oem revision is correct") - { - REQUIRE(header->oem_revision() == 1); - } - - THEN("the creator id is correct") - { - REQUIRE(header->creator_id() == "INTL"); - } - - THEN("the creator revision is non-zero") - { - REQUIRE(header->creator_revision() != 0); - } - } - } -} diff --git a/libs/acpi/acpi/common/table_header.tests.cpp b/libs/acpi/acpi/common/table_header.tests.cpp new file mode 100644 index 00000000..bbd42bd6 --- /dev/null +++ b/libs/acpi/acpi/common/table_header.tests.cpp @@ -0,0 +1,60 @@ +#include + +#include + +#include + +#include + +SCENARIO("Common table header parsing", "[common_table_header]") +{ + GIVEN("A valid compiled table header") + { + auto data = acpi::test_data::tables::table_header(); + + WHEN("parsing the header") + { + auto header = reinterpret_cast(data.data()); + + THEN("the signature is correct") + { + REQUIRE(header->signature() == "TEST"); + } + + THEN("the revision is correct") + { + REQUIRE(header->revision() == 1); + } + + THEN("the length is correct") + { + REQUIRE(header->length() == kstd::type_size); + } + + THEN("the oem id is correct") + { + REQUIRE(header->oem_id() == "FEMO "); + } + + THEN("the oem table id is correct") + { + REQUIRE(header->oem_table_id() == "HDRTEST "); + } + + THEN("the oem revision is correct") + { + REQUIRE(header->oem_revision() == 1); + } + + THEN("the creator id is correct") + { + REQUIRE(header->creator_id() == "INTL"); + } + + THEN("the creator revision is non-zero") + { + REQUIRE(header->creator_revision() != 0); + } + } + } +} diff --git a/libs/acpi/acpi/data/madt.test.cpp b/libs/acpi/acpi/data/madt.test.cpp deleted file mode 100644 index 9ec0180a..00000000 --- a/libs/acpi/acpi/data/madt.test.cpp +++ /dev/null @@ -1,57 +0,0 @@ -#include - -#include - -#include - -#include - -#include - -SCENARIO("MADT parsing", "[madt]") -{ - GIVEN("The basic compiled MADT containing a single LAPIC entry and the default x86 LAPIC address") - { - auto data = acpi::test_data::tables::basic_madt(); - - WHEN("parsing the table") - { - auto madt = reinterpret_cast(data.data()); - - THEN("the signature is correct") - { - REQUIRE(madt->signature() == "APIC"); - } - - THEN("validate returns true") - { - REQUIRE(madt->validate()); - } - - THEN("there is a single entry in the table") - { - REQUIRE(std::distance(madt->begin(), madt->end()) == 1); - } - - THEN("the LAPIC address is 0xfee00000") - { - REQUIRE(madt->local_interrupt_controller_address() == 0xfee0'0000); - } - - THEN("the length is sizeof(madt) + sizeof(processor_local_apic)") - { - REQUIRE(madt->length().value == sizeof(acpi::madt) + sizeof(acpi::processor_local_apic_entry)); - } - - THEN("the first entry has type processor_local_apic") - { - REQUIRE(madt->cbegin()->type() == acpi::madt_entry::type::processor_local_apic); - } - - THEN("`only` can be used to get a view of all processor_local_apic entries") - { - REQUIRE(std::ranges::distance(madt->only()) == 1); - } - } - } -} diff --git a/libs/acpi/acpi/data/madt.tests.cpp b/libs/acpi/acpi/data/madt.tests.cpp new file mode 100644 index 00000000..9ec0180a --- /dev/null +++ b/libs/acpi/acpi/data/madt.tests.cpp @@ -0,0 +1,57 @@ +#include + +#include + +#include + +#include + +#include + +SCENARIO("MADT parsing", "[madt]") +{ + GIVEN("The basic compiled MADT containing a single LAPIC entry and the default x86 LAPIC address") + { + auto data = acpi::test_data::tables::basic_madt(); + + WHEN("parsing the table") + { + auto madt = reinterpret_cast(data.data()); + + THEN("the signature is correct") + { + REQUIRE(madt->signature() == "APIC"); + } + + THEN("validate returns true") + { + REQUIRE(madt->validate()); + } + + THEN("there is a single entry in the table") + { + REQUIRE(std::distance(madt->begin(), madt->end()) == 1); + } + + THEN("the LAPIC address is 0xfee00000") + { + REQUIRE(madt->local_interrupt_controller_address() == 0xfee0'0000); + } + + THEN("the length is sizeof(madt) + sizeof(processor_local_apic)") + { + REQUIRE(madt->length().value == sizeof(acpi::madt) + sizeof(acpi::processor_local_apic_entry)); + } + + THEN("the first entry has type processor_local_apic") + { + REQUIRE(madt->cbegin()->type() == acpi::madt_entry::type::processor_local_apic); + } + + THEN("`only` can be used to get a view of all processor_local_apic entries") + { + REQUIRE(std::ranges::distance(madt->only()) == 1); + } + } + } +} diff --git a/libs/acpi/acpi/data/rsdt.test.cpp b/libs/acpi/acpi/data/rsdt.test.cpp deleted file mode 100644 index 826d0b4f..00000000 --- a/libs/acpi/acpi/data/rsdt.test.cpp +++ /dev/null @@ -1,48 +0,0 @@ -#include - -#include -#include - -#include - -#include - -#include - -SCENARIO("RSDT parsing", "[rsdt]") -{ - GIVEN("The basic compiled RSDT containing 8 table pointers") - { - auto data = acpi::test_data::tables::basic_rsdt(); - - WHEN("parsing the table") - { - auto rsdt = reinterpret_cast(data.data()); - - THEN("the signature is correct") - { - REQUIRE(rsdt->signature() == "RSDT"); - } - - THEN("validate returns true") - { - REQUIRE(rsdt->validate()); - } - - THEN("there are 8 entries in the table") - { - REQUIRE(std::distance(rsdt->begin(), rsdt->end()) == 8); - } - - THEN("the first entry has address 0x10") - { - REQUIRE(rsdt->cbegin()->address() == reinterpret_cast(0x10)); - } - - THEN("the length is sizeof(rsdt) + 8 * sizeof(rsdt_entry)") - { - REQUIRE(rsdt->length().value == sizeof(acpi::rsdt) + 8 * sizeof(acpi::rsdt_entry)); - } - } - } -} diff --git a/libs/acpi/acpi/data/rsdt.tests.cpp b/libs/acpi/acpi/data/rsdt.tests.cpp new file mode 100644 index 00000000..826d0b4f --- /dev/null +++ b/libs/acpi/acpi/data/rsdt.tests.cpp @@ -0,0 +1,48 @@ +#include + +#include +#include + +#include + +#include + +#include + +SCENARIO("RSDT parsing", "[rsdt]") +{ + GIVEN("The basic compiled RSDT containing 8 table pointers") + { + auto data = acpi::test_data::tables::basic_rsdt(); + + WHEN("parsing the table") + { + auto rsdt = reinterpret_cast(data.data()); + + THEN("the signature is correct") + { + REQUIRE(rsdt->signature() == "RSDT"); + } + + THEN("validate returns true") + { + REQUIRE(rsdt->validate()); + } + + THEN("there are 8 entries in the table") + { + REQUIRE(std::distance(rsdt->begin(), rsdt->end()) == 8); + } + + THEN("the first entry has address 0x10") + { + REQUIRE(rsdt->cbegin()->address() == reinterpret_cast(0x10)); + } + + THEN("the length is sizeof(rsdt) + 8 * sizeof(rsdt_entry)") + { + REQUIRE(rsdt->length().value == sizeof(acpi::rsdt) + 8 * sizeof(acpi::rsdt_entry)); + } + } + } +} diff --git a/libs/acpi/acpi/data/xsdt.test.cpp b/libs/acpi/acpi/data/xsdt.test.cpp deleted file mode 100644 index 19d9bcdb..00000000 --- a/libs/acpi/acpi/data/xsdt.test.cpp +++ /dev/null @@ -1,48 +0,0 @@ -#include - -#include -#include - -#include - -#include - -#include - -SCENARIO("XSDT parsing", "[xsdt]") -{ - GIVEN("The basic compiled XSDT containing 8 table pointers") - { - auto data = acpi::test_data::tables::basic_xsdt(); - - WHEN("parsing the table") - { - auto xsdt = reinterpret_cast(data.data()); - - THEN("the signature is correct") - { - REQUIRE(xsdt->signature() == "XSDT"); - } - - THEN("validate returns true") - { - REQUIRE(xsdt->validate()); - } - - THEN("there are 8 entries in the table") - { - REQUIRE(std::distance(xsdt->begin(), xsdt->end()) == 8); - } - - THEN("the first entry has address 0x10") - { - REQUIRE(xsdt->cbegin()->address() == reinterpret_cast(0x10)); - } - - THEN("the length is sizeof(xsdt) + 8 * sizeof(xsdt_entry)") - { - REQUIRE(xsdt->length().value == sizeof(acpi::xsdt) + 8 * sizeof(acpi::xsdt_entry)); - } - } - } -} diff --git a/libs/acpi/acpi/data/xsdt.tests.cpp b/libs/acpi/acpi/data/xsdt.tests.cpp new file mode 100644 index 00000000..19d9bcdb --- /dev/null +++ b/libs/acpi/acpi/data/xsdt.tests.cpp @@ -0,0 +1,48 @@ +#include + +#include +#include + +#include + +#include + +#include + +SCENARIO("XSDT parsing", "[xsdt]") +{ + GIVEN("The basic compiled XSDT containing 8 table pointers") + { + auto data = acpi::test_data::tables::basic_xsdt(); + + WHEN("parsing the table") + { + auto xsdt = reinterpret_cast(data.data()); + + THEN("the signature is correct") + { + REQUIRE(xsdt->signature() == "XSDT"); + } + + THEN("validate returns true") + { + REQUIRE(xsdt->validate()); + } + + THEN("there are 8 entries in the table") + { + REQUIRE(std::distance(xsdt->begin(), xsdt->end()) == 8); + } + + THEN("the first entry has address 0x10") + { + REQUIRE(xsdt->cbegin()->address() == reinterpret_cast(0x10)); + } + + THEN("the length is sizeof(xsdt) + 8 * sizeof(xsdt_entry)") + { + REQUIRE(xsdt->length().value == sizeof(acpi::xsdt) + 8 * sizeof(acpi::xsdt_entry)); + } + } + } +} diff --git a/libs/acpi/acpi/pointers.test.cpp b/libs/acpi/acpi/pointers.test.cpp deleted file mode 100644 index d7b700d6..00000000 --- a/libs/acpi/acpi/pointers.test.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#include - -#include - -#include -#include -#include - -SCENARIO("ACPI root pointer parsing", "[acpi]") -{ - GIVEN("A null-filled pointer") - { - auto data = std::array{}; - - WHEN("parsing the data") - { - auto rsdp = std::bit_cast(data); - - THEN("the signature is invalid") - { - REQUIRE(rsdp.signature() != "RSD PTR "); - } - - THEN("validate returns false") - { - REQUIRE_FALSE(rsdp.validate()); - } - } - } -} diff --git a/libs/acpi/acpi/pointers.tests.cpp b/libs/acpi/acpi/pointers.tests.cpp new file mode 100644 index 00000000..d7b700d6 --- /dev/null +++ b/libs/acpi/acpi/pointers.tests.cpp @@ -0,0 +1,30 @@ +#include + +#include + +#include +#include +#include + +SCENARIO("ACPI root pointer parsing", "[acpi]") +{ + GIVEN("A null-filled pointer") + { + auto data = std::array{}; + + WHEN("parsing the data") + { + auto rsdp = std::bit_cast(data); + + THEN("the signature is invalid") + { + REQUIRE(rsdp.signature() != "RSD PTR "); + } + + THEN("validate returns false") + { + REQUIRE_FALSE(rsdp.validate()); + } + } + } +} -- cgit v1.2.3