MCPcopy Create free account
hub / github.com/FreesmTeam/FreesmLauncher / test_flexVerTestVector_data

Method test_flexVerTestVector_data

tests/Version_test.cpp:101–163  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

99 }
100
101 void test_flexVerTestVector_data()
102 {
103 addDataColumns();
104
105 QDir test_vector_dir(QFINDTESTDATA("testdata/Version"));
106
107 QFile vector_file{ test_vector_dir.absoluteFilePath("test_vectors.txt") };
108
109 vector_file.open(QFile::OpenModeFlag::ReadOnly);
110
111 int test_number = 0;
112 const QString test_name_template{ "FlexVer test #%1 (%2)" };
113 for (auto line = vector_file.readLine(); !vector_file.atEnd(); line = vector_file.readLine()) {
114 line = line.simplified();
115 if (line.startsWith('#') || line.isEmpty())
116 continue;
117
118 test_number += 1;
119
120 auto split_line = line.split('<');
121 if (split_line.size() == 2) {
122 QString first{ split_line.first().simplified() };
123 QString second{ split_line.last().simplified() };
124
125 auto new_test_name = test_name_template.arg(QString::number(test_number), "lessThan");
126 m_flex_test_names.append(new_test_name);
127 QTest::newRow(m_flex_test_names.last().toLatin1().data()) << first << second << true << false;
128
129 continue;
130 }
131
132 split_line = line.split('=');
133 if (split_line.size() == 2) {
134 QString first{ split_line.first().simplified() };
135 QString second{ split_line.last().simplified() };
136
137 auto new_test_name = test_name_template.arg(QString::number(test_number), "equals");
138 m_flex_test_names.append(new_test_name);
139 QTest::newRow(m_flex_test_names.last().toLatin1().data()) << first << second << false << true;
140
141 continue;
142 }
143
144 split_line = line.split('>');
145 if (split_line.size() == 2) {
146 QString first{ split_line.first().simplified() };
147 QString second{ split_line.last().simplified() };
148
149 auto new_test_name = test_name_template.arg(QString::number(test_number), "greaterThan");
150 m_flex_test_names.append(new_test_name);
151 QTest::newRow(m_flex_test_names.last().toLatin1().data()) << first << second << false << false;
152
153 continue;
154 }
155
156 qCritical() << "Unexpected separator in the test vector: ";
157 qCritical() << line;
158

Callers

nothing calls this directly

Calls 6

openMethod · 0.80
appendMethod · 0.80
closeMethod · 0.80
isEmptyMethod · 0.45
sizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected