Skip to content

Commit cdb05b5

Browse files
authored
Merge pull request #1299 from AtCoder-NoviSteps/#1287
✨ Add tasks for stack (#1287)
2 parents 4e24c00 + 9385373 commit cdb05b5

File tree

2 files changed

+37
-2
lines changed

2 files changed

+37
-2
lines changed

src/lib/utils/contest.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,13 @@ export const classifyContest = (contest_id: string) => {
5656
return ContestType.MATH_AND_ALGORITHM;
5757
}
5858

59-
// HACK: 2024年9月上旬時点では、「Chokudai SpeedRun 001」と「Chokudai SpeedRun 002」のみ該当。
59+
// HACK: 2024年9月下旬時点では、「Chokudai SpeedRun」と「Donutsプロコンチャレンジ」「COLOCON」のみ該当。
6060
// 対象コンテストが増えた場合は、判定条件を見直す必要がある。
61-
if (contest_id.startsWith('chokudai_S')) {
61+
if (
62+
contest_id.startsWith('chokudai_S') ||
63+
contest_id.startsWith('donuts') ||
64+
contest_id.startsWith('colopl')
65+
) {
6266
return ContestType.OTHERS;
6367
}
6468

src/test/lib/utils/contest.test.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ describe('Contest', () => {
158158
expect(classifyContest(contestId)).toEqual(expected);
159159
});
160160
});
161+
161162
describe('when contest_id contains chokudai_S', () => {
162163
const testCases = [
163164
{ contestId: 'chokudai_S001', expected: ContestType.OTHERS },
@@ -169,6 +170,19 @@ describe('Contest', () => {
169170
});
170171
});
171172

173+
describe('when contest_id contains donuts or colopl', () => {
174+
const testCases = [
175+
{ contestId: 'donuts-live2014', expected: ContestType.OTHERS },
176+
{ contestId: 'donuts-2015', expected: ContestType.OTHERS },
177+
{ contestId: 'colopl2018-qual', expected: ContestType.OTHERS },
178+
{ contestId: 'colopl2018-final', expected: ContestType.OTHERS },
179+
];
180+
181+
runTests('classifyContest', testCases, ({ contestId, expected }: TestCaseForContestType) => {
182+
expect(classifyContest(contestId)).toEqual(expected);
183+
});
184+
});
185+
172186
function runTests(
173187
testName: string,
174188
testCases: TestCasesForContestType,
@@ -346,6 +360,23 @@ describe('Contest', () => {
346360
);
347361
});
348362

363+
describe('when contest_id contains donuts or colopl', () => {
364+
const testCases = [
365+
{ contestId: 'donuts-live2014', expected: ContestType.OTHERS },
366+
{ contestId: 'donuts-2015', expected: ContestType.OTHERS },
367+
{ contestId: 'colopl2018-qual', expected: ContestType.OTHERS },
368+
{ contestId: 'colopl2018-final', expected: ContestType.OTHERS },
369+
];
370+
371+
runTests(
372+
'getContestPriority',
373+
testCases,
374+
({ contestId, expected }: TestCaseForContestType) => {
375+
expect(getContestPriority(contestId)).toEqual(contestTypePriorities.get(expected));
376+
},
377+
);
378+
});
379+
349380
function runTests(
350381
testName: string,
351382
testCases: TestCasesForContestType,

0 commit comments

Comments
 (0)