MCPcopy Create free account
hub / github.com/Project-LemonLime/Project_LemonLime / testReadCdf

Method testReadCdf

tests/test1/main.cpp:167–198  ·  view source on GitHub ↗

------------------------------------------------------------------ Test 1: read CDF file ------------------------------------------------------------------

Source from the content-addressed store, hash-verified

165 // Test 1: read CDF file
166 // ------------------------------------------------------------------
167 void testReadCdf() {
168 Settings settings;
169 // Do not call loadSettings() in tests
170
171 Contest *contest = loadContest(m_contestDir, &settings, this);
172 QVERIFY2(contest != nullptr, "Failed to load TestContest1.cdf");
173
174 // Verify contest title
175 QCOMPARE(contest->getContestTitle(), QString("TestContest1"));
176
177 // Verify task count and names
178 const QList<Task *> &tasks = contest->getTaskList();
179 QCOMPARE(tasks.size(), 2);
180
181 QStringList taskNames;
182 for (const Task *t : tasks)
183 taskNames << t->getProblemTitle();
184 QVERIFY2(taskNames.contains("aplusb"), "Task 'aplusb' not found");
185 QVERIFY2(taskNames.contains("helloworld"), "Task 'helloworld' not found");
186
187 // Verify contestant count and names
188 const QList<Contestant *> contestants = contest->getContestantList();
189 QCOMPARE(contestants.size(), 2);
190
191 QStringList names;
192 for (const Contestant *c : contestants)
193 names << c->getContestantName();
194 QVERIFY2(names.contains("user1"), "Contestant 'user1' not found");
195 QVERIFY2(names.contains("user2"), "Contestant 'user2' not found");
196
197 delete contest;
198 }
199
200 // ------------------------------------------------------------------
201 // Test 2: get compiler path

Callers

nothing calls this directly

Calls 6

loadContestFunction · 0.85
getTaskListMethod · 0.80
getProblemTitleMethod · 0.80
getContestantListMethod · 0.80
getContestantNameMethod · 0.80
getContestTitleMethod · 0.45

Tested by

no test coverage detected