-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
growlight: fix build with doctest 2.4.6
- Loading branch information
Showing
2 changed files
with
75 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
Index: growlight-1.2.31/tests/gpt.cpp | ||
=================================================================== | ||
--- growlight-1.2.31.orig/tests/gpt.cpp | ||
+++ growlight-1.2.31/tests/gpt.cpp | ||
@@ -6,6 +6,9 @@ | ||
|
||
#define UUID "\x5E\x86\x90\xEF\xD0\x30\x03\x46\x99\x3D\x54\x6E\xB0\xE7\x1B\x0D" | ||
|
||
+template <typename T> | ||
+T xnormalise(T value) { return value; } | ||
+ | ||
TEST_CASE("GPT") { | ||
|
||
// First eight bytes must be "EFI PART" | ||
@@ -19,14 +22,14 @@ TEST_CASE("GPT") { | ||
SUBCASE("Revision") { | ||
gpt_header head; | ||
CHECK(0 == initialize_gpt(&head, 512, 4194287, 34, nullptr)); | ||
- CHECK(0x00010000 == head.revision); | ||
+ CHECK(0x00010000 == xnormalise(head.revision)); | ||
} | ||
|
||
// Bytes 0xc--0xf must be >= 92, should be the logical block size | ||
SUBCASE("HeaderSize") { | ||
gpt_header head; | ||
CHECK(0 == initialize_gpt(&head, 512, 4194287, 34, nullptr)); | ||
- CHECK(92 == head.headsize); | ||
+ CHECK(92 == xnormalise(head.headsize)); | ||
} | ||
|
||
// Bytes 0x18--0x1f are the sector of the GPT primary, usually 1 | ||
@@ -34,8 +37,8 @@ TEST_CASE("GPT") { | ||
SUBCASE("GPTLBAs") { | ||
gpt_header head; | ||
CHECK(0 == initialize_gpt(&head, 512, 100000, 34, nullptr)); | ||
- CHECK(1 == head.lba); | ||
- CHECK(100000 == head.backuplba); | ||
+ CHECK(1 == xnormalise(head.lba)); | ||
+ CHECK(100000 == xnormalise(head.backuplba)); | ||
} | ||
|
||
// Verify the 16-byte UUID is as specified | ||
@@ -61,17 +64,17 @@ TEST_CASE("GPT") { | ||
gpt_header head; | ||
CHECK(0 == initialize_gpt(&head, 512, 4194287, 34, UUID)); | ||
// partition entry size must be a positive multiple of 128 (usually 128) | ||
- CHECK(0 < head.partsize); | ||
+ CHECK(0 < xnormalise(head.partsize)); | ||
CHECK(0 == (head.partsize % 128)); | ||
// number of partition entries, usually 128 (MINIMUM_GPT_ENTRIES) | ||
- CHECK(128 <= head.partcount); | ||
+ CHECK(128 <= xnormalise(head.partcount)); | ||
auto entries = new gpt_entry[head.partcount]; | ||
memset(entries, 0, sizeof(*entries) * head.partcount); | ||
CHECK(0 == update_crc(&head, entries)); | ||
// FIXME fix on big-endian! | ||
- WARN(2006165414 == head.crc); | ||
- CHECK(0 == head.reserved); | ||
- CHECK(2874462854 == head.partcrc); | ||
+ WARN(2006165414 == xnormalise(head.crc)); | ||
+ CHECK(0 == xnormalise(head.reserved)); | ||
+ CHECK(2874462854 == xnormalise(head.partcrc)); | ||
delete[] entries; | ||
} | ||
|
||
@@ -85,7 +88,7 @@ TEST_CASE("GPT") { | ||
memset(sector, 0xff, sizeof(sector)); | ||
gpt_header* head = reinterpret_cast<gpt_header*>(sector); | ||
CHECK(0 == initialize_gpt(head, sizeof(sector), 4194287, 34, nullptr)); | ||
- CHECK(92 == head->headsize); | ||
+ CHECK(92 == xnormalise(head->headsize)); | ||
for(size_t idx = 92 ; idx < sizeof(sector) ; ++idx){ | ||
CHECK(0 == sector[idx]); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters