少年修仙传客户端基础资源
hch
2024-04-11 4c71d74b77c9eb62a0323698c9a0db3b641a917e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#if ENABLE_UNIT_TESTS
 
#include "../../../external/Catch/catch.hpp"
 
#include <stdexcept>
#include "../../MSVC/MSVCSectionParser.h"
 
using namespace mapfileparser;
 
TEST_CASE("MSVCSectionParser_ThrowsAnExceptionOnEmptyInput")
{
    REQUIRE_THROWS_AS(MSVCSectionParser::Parse(""), std::runtime_error);
}
 
TEST_CASE("MSVCSectionParser_ParsesASection")
{
    Section section = MSVCSectionParser::Parse(" 0001:00000000 0096f9beH .text                   CODE");
    REQUIRE(0x00000000 == section.start);
    REQUIRE(0x0096f9be == section.length);
    REQUIRE(".text" == section.name);
    REQUIRE("1" == section.segmentName);
    REQUIRE(kSegmentTypeCode == section.segmentType);
}
 
TEST_CASE("MSVCSectionParser_ParsesADataSegment")
{
    Section section = MSVCSectionParser::Parse(" 0002:00000000 00000308H .idata$5                DATA");
    REQUIRE(0x00000000 == section.start);
    REQUIRE(0x00000308 == section.length);
    REQUIRE(".idata$5" == section.name);
    REQUIRE("2" == section.segmentName);
    REQUIRE(kSegmentTypeData == section.segmentType);
}
 
#endif // ENABLE_UNIT_TESTS