MCPcopy Create free account
hub / github.com/AngusJohnson/Clipper2 / LoadTestNum

Function LoadTestNum

CPP/Utils/ClipFileLoad.cpp:59–121  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

57}
58
59bool LoadTestNum(ifstream &source, int test_num,
60 Paths64 &subj, Paths64 &subj_open, Paths64 &clip,
61 int64_t& area, int64_t& count, ClipType &ct, FillRule &fr)
62{
63 string line;
64 area = 0; count = 0;
65 if (test_num <= 0) test_num = 1;
66 source.seekg(0, ios_base::beg);
67 subj.clear(); subj_open.clear(); clip.clear();
68
69 while (getline(source, line))
70 {
71 if (test_num)
72 {
73 if (line.find("CAPTION:") != string::npos) --test_num;
74 continue;
75 }
76
77 if (line.find("CAPTION:") != string::npos) break; // ie don't go beyond current test
78
79 else if (line.find("INTERSECTION") != string::npos)
80 ct = ClipType::Intersection;
81 else if (line.find("UNION") != string::npos)
82 ct = ClipType::Union;
83 else if (line.find("DIFFERENCE") != string::npos)
84 ct = ClipType::Difference;
85 else if (line.find("XOR") != string::npos)
86 ct = ClipType::Xor;
87 else if (line.find("EVENODD") != string::npos)
88 fr = FillRule::EvenOdd;
89 else if (line.find("NONZERO") != string::npos)
90 fr = FillRule::NonZero ;
91 else if (line.find("POSITIVE") != string::npos)
92 fr = FillRule::Positive;
93 else if (line.find("NEGATIVE") != string::npos)
94 fr = FillRule::Negative;
95 else if (line.find("SOL_AREA") != string::npos)
96 {
97 string::const_iterator s_it, s_end = line.cend();
98 s_it = (line.cbegin() + 10);
99 GetInt(s_it, s_end, area);
100 }
101 else if (line.find("SOL_COUNT") != string::npos)
102 {
103 string::const_iterator s_it, s_end = line.cend();
104 s_it = (line.cbegin() + 11);
105 GetInt(s_it, s_end, count);
106 }
107 else if (line.find("SUBJECTS_OPEN") != string::npos)
108 {
109 GetPaths(source, subj_open);
110 }
111 else if (line.find("SUBJECTS") != string::npos)
112 {
113 GetPaths(source, subj);
114 }
115 else if (line.find("CLIPS") != string::npos)
116 {

Callers 8

LoadTestFunction · 0.85
TESTFunction · 0.85
TESTFunction · 0.85
TESTFunction · 0.85
TESTFunction · 0.85
RecheckLastBenchmarkFunction · 0.85
DoLoopThruPolygonsFunction · 0.85
mainFunction · 0.85

Calls 2

GetPathsFunction · 0.85
GetIntFunction · 0.70

Tested by 4

TESTFunction · 0.68
TESTFunction · 0.68
TESTFunction · 0.68
TESTFunction · 0.68