Skip to content

Commit 671a15b

Browse files
committed
🚨 Add tests for TTPC (#1524)
1 parent 31a522e commit 671a15b

File tree

3 files changed

+44
-0
lines changed

3 files changed

+44
-0
lines changed

src/test/lib/utils/test_cases/contest_name_and_task_index.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,30 @@ const UTPC_TEST_DATA: UniversityContestsTestData = Object.fromEntries(
251251
]),
252252
) as UniversityContestsTestData;
253253

254+
type TtpcYear = '2015' | '2019' | '2022' | '2023';
255+
type TtpcTaskPatterns = {
256+
[K in TtpcYear]: string[];
257+
};
258+
259+
const TTPC_TASK_PATTERNS: TtpcTaskPatterns = {
260+
'2015': ['A', 'B', 'C', 'N', 'O', 'P'],
261+
'2019': ['A', 'B', 'C', 'M', 'N', 'O'],
262+
'2022': ['A', 'B', 'C', 'M', 'N', 'O'],
263+
'2023': ['A', 'B', 'C', 'N', 'O', 'P'],
264+
};
265+
266+
const TTPC_TEST_DATA: UniversityContestsTestData = Object.fromEntries(
267+
Array.from({ length: 9 }, (_, i) => 2015 + i)
268+
.filter((year) => year === 2015 || year === 2019 || year >= 2022)
269+
.map((year) => [
270+
`ttpc${year}`,
271+
{
272+
contestId: `ttpc${year}`,
273+
tasks: TTPC_TASK_PATTERNS[year.toString() as keyof TtpcTaskPatterns],
274+
},
275+
]),
276+
) as UniversityContestsTestData;
277+
254278
type TupcYear = '2022' | '2023';
255279
type TupcTaskPatterns = {
256280
[K in TupcYear]: string[];
@@ -290,6 +314,7 @@ const generateUniversityTestCases = (
290314

291315
const ALL_UNIVERSITY_TEST_DATA: UniversityContestsTestData = {
292316
...UTPC_TEST_DATA,
317+
...TTPC_TEST_DATA,
293318
...TUPC_TEST_DATA,
294319
};
295320

src/test/lib/utils/test_cases/contest_name_labels.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,18 @@ const generateUtpcTestCases = (
263263
return testCase;
264264
});
265265
};
266+
const generateTtpcTestCases = (
267+
years: number[],
268+
): { name: string; value: TestCaseForContestNameLabel }[] => {
269+
return years.map((year) => {
270+
const testCase = createTestCaseForContestNameLabel(`TTPC ${year}`)({
271+
contestId: `ttpc${year}`,
272+
expected: `TTPC${year}`,
273+
});
274+
275+
return testCase;
276+
});
277+
};
266278
const generateTupcTestCases = (
267279
years: number[],
268280
): { name: string; value: TestCaseForContestNameLabel }[] => {
@@ -278,12 +290,14 @@ const generateTupcTestCases = (
278290

279291
// Note:
280292
// UTPC contests on AtCoder: 2011-2014 and 2020-2023 (not held during 2015-2019)
293+
// TTPC contests on AtCoder: 2015, 2019, 2022-
281294
// TUPC contests on AtCoder: 2022-
282295
//
283296
// See:
284297
// https://kenkoooo.com/atcoder/resources/contests.json
285298
export const universities = [
286299
...generateUtpcTestCases([2011, 2012, 2013, 2014, 2020, 2021, 2022, 2023]),
300+
...generateTtpcTestCases([2015, 2019, 2022, 2023]),
287301
...generateTupcTestCases([2022, 2023]),
288302
];
289303

src/test/lib/utils/test_cases/contest_type.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ export const agcLike = [
213213

214214
// Note:
215215
// UTPC contests on AtCoder: 2011-2014 and 2020-2023 (not held during 2015-2019)
216+
// TTPC contests on AtCoder: 2015, 2019, 2022-
216217
// TUPC contests on AtCoder: 2022-
217218
//
218219
// See:
@@ -226,6 +227,10 @@ const universityContestIds = [
226227
'utpc2021',
227228
'utpc2022',
228229
'utpc2023',
230+
'ttpc2015',
231+
'ttpc2019',
232+
'ttpc2022',
233+
'ttpc2023',
229234
'tupc2022',
230235
'tupc2023',
231236
];

0 commit comments

Comments
 (0)