SFDP: unit tests: Move unshared test data into case

Some test data in test_sfdp.cpp is used by one test case only, so
we turn it into a local variable.
pull/14989/head
Lingkai Dong 2021-08-09 11:06:36 +01:00
parent b5e7dd9d32
commit 50183d2ee4
1 changed files with 20 additions and 20 deletions

View File

@ -39,26 +39,6 @@ static const uint8_t sector_map_single_descriptor[] {
0xF4, 0xFF, 0xFB, 0x03 // region 2 0xF4, 0xFF, 0xFB, 0x03 // region 2
}; };
/**
* Based on Cypress S25FS512S, modified to have one descriptor,
* twelve regions for test purpose.
*/
static const uint8_t sector_map_single_descriptor_twelve_regions[] {
0xFF, 0x01, 0x0B, 0xFF, // header, highest region = 0x0B
0xF1, 0x7F, 0x00, 0x00, // region 0
0xF4, 0x7F, 0x03, 0x00, // region 1
0xF4, 0xFF, 0xFB, 0x03, // region 2
0xF1, 0x7F, 0x00, 0x00, // region 3
0xF4, 0x7F, 0x03, 0x00, // region 4
0xF4, 0xFF, 0xFB, 0x03, // region 5
0xF1, 0x7F, 0x00, 0x00, // region 6
0xF4, 0x7F, 0x03, 0x00, // region 7
0xF4, 0xFF, 0xFB, 0x03, // region 8
0xF1, 0x7F, 0x00, 0x00, // region 9
0xF4, 0x7F, 0x03, 0x00, // region 10
0xF4, 0xFF, 0xFB, 0x03, // region 11
};
class TestSFDP : public testing::Test { class TestSFDP : public testing::Test {
public: public:
@ -270,6 +250,26 @@ TEST_F(TestSFDP, TestSFDPReadFailure)
*/ */
TEST_F(TestSFDP, TestMoreRegionsThanSupported) TEST_F(TestSFDP, TestMoreRegionsThanSupported)
{ {
/**
* Based on Cypress S25FS512S, modified to have one descriptor,
* twelve regions for test purpose.
*/
const uint8_t sector_map_single_descriptor_twelve_regions[] {
0xFF, 0x01, 0x0B, 0xFF, // header, highest region = 0x0B
0xF1, 0x7F, 0x00, 0x00, // region 0
0xF4, 0x7F, 0x03, 0x00, // region 1
0xF4, 0xFF, 0xFB, 0x03, // region 2
0xF1, 0x7F, 0x00, 0x00, // region 3
0xF4, 0x7F, 0x03, 0x00, // region 4
0xF4, 0xFF, 0xFB, 0x03, // region 5
0xF1, 0x7F, 0x00, 0x00, // region 6
0xF4, 0x7F, 0x03, 0x00, // region 7
0xF4, 0xFF, 0xFB, 0x03, // region 8
0xF1, 0x7F, 0x00, 0x00, // region 9
0xF4, 0x7F, 0x03, 0x00, // region 10
0xF4, 0xFF, 0xFB, 0x03, // region 11
};
mbed::sfdp_hdr_info header_info; mbed::sfdp_hdr_info header_info;
set_sector_map_param_table( set_sector_map_param_table(
header_info.smptbl, header_info.smptbl,