MCPcopy Create free account
hub / github.com/ElyPrismLauncher/Launcher / test_flexVerTestVector_data

Method test_flexVerTestVector_data

tests/Version_test.cpp:101–166  ·  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 if (!vector_file.open(QFile::OpenModeFlag::ReadOnly)) {
110 qCritical() << "Failed to open file" << vector_file.fileName() << "for reading:" << vector_file.errorString();
111 return;
112 }
113
114 int test_number = 0;
115 const QString test_name_template{ "FlexVer test #%1 (%2)" };
116 for (auto line = vector_file.readLine(); !vector_file.atEnd(); line = vector_file.readLine()) {
117 line = line.simplified();
118 if (line.startsWith('#') || line.isEmpty())
119 continue;
120
121 test_number += 1;
122
123 auto split_line = line.split('<');
124 if (split_line.size() == 2) {
125 QString first{ split_line.first().simplified() };
126 QString second{ split_line.last().simplified() };
127
128 auto new_test_name = test_name_template.arg(QString::number(test_number), "lessThan");
129 m_flex_test_names.append(new_test_name);
130 QTest::newRow(m_flex_test_names.last().toLatin1().data()) << first << second << true << false;
131
132 continue;
133 }
134
135 split_line = line.split('=');
136 if (split_line.size() == 2) {
137 QString first{ split_line.first().simplified() };
138 QString second{ split_line.last().simplified() };
139
140 auto new_test_name = test_name_template.arg(QString::number(test_number), "equals");
141 m_flex_test_names.append(new_test_name);
142 QTest::newRow(m_flex_test_names.last().toLatin1().data()) << first << second << false << true;
143
144 continue;
145 }
146
147 split_line = line.split('>');
148 if (split_line.size() == 2) {
149 QString first{ split_line.first().simplified() };
150 QString second{ split_line.last().simplified() };
151
152 auto new_test_name = test_name_template.arg(QString::number(test_number), "greaterThan");
153 m_flex_test_names.append(new_test_name);
154 QTest::newRow(m_flex_test_names.last().toLatin1().data()) << first << second << false << false;
155
156 continue;
157 }
158

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected