Skip to content

Commit 5a117d1

Browse files
authored
Merge pull request #1349 from AtCoder-NoviSteps/#1348
✨ Add contests (#1335)
2 parents 17ac783 + c99c38a commit 5a117d1

File tree

2 files changed

+21
-28
lines changed

2 files changed

+21
-28
lines changed

src/lib/utils/contest.ts

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,18 +62,30 @@ export const classifyContest = (contest_id: string) => {
6262
return ContestType.ARC_LIKE;
6363
}
6464

65-
if (contest_id.startsWith('code-festival-2017-qual')) {
65+
// ・CODE FESTIVAL 2017 qual
66+
// ・CODE FESTIVAL 2017 Final
67+
const prefixForAgcLike = ['code-festival-2017-qual', 'cf17-final'];
68+
69+
if (prefixForAgcLike.some((prefix) => contest_id.startsWith(prefix))) {
6670
return ContestType.AGC_LIKE;
6771
}
6872

6973
// ・Chokudai SpeedRun
7074
// ・CODE FESTIVAL 2014 決勝
7175
// ・Donutsプロコンチャレンジ
76+
// ・MUJIN Programming Challenge 2016
7277
// ・COLOCON
7378
// ・GigaCode
74-
const prefixes = ['chokudai_S', 'code-festival-2014-final', 'donuts', 'colopl', 'gigacode'];
75-
76-
if (prefixes.some((prefix) => contest_id.startsWith(prefix))) {
79+
const prefixForOthers = [
80+
'chokudai_S',
81+
'code-festival-2014-final',
82+
'donuts',
83+
'mujin-pc-2016',
84+
'colopl',
85+
'gigacode',
86+
];
87+
88+
if (prefixForOthers.some((prefix) => contest_id.startsWith(prefix))) {
7789
return ContestType.OTHERS;
7890
}
7991

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

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -172,29 +172,22 @@ describe('Contest', () => {
172172
{ contestId: 'code-festival-2017-quala', expected: ContestType.AGC_LIKE },
173173
{ contestId: 'code-festival-2017-qualb', expected: ContestType.AGC_LIKE },
174174
{ contestId: 'code-festival-2017-qualc', expected: ContestType.AGC_LIKE },
175+
{ contestId: 'cf17-final', expected: ContestType.AGC_LIKE },
175176
];
176177

177178
runTests('classifyContest', testCases, ({ contestId, expected }: TestCaseForContestType) => {
178179
expect(classifyContest(contestId)).toEqual(expected);
179180
});
180181
});
181182

182-
describe('when contest_id contains chokudai_S', () => {
183+
describe('when contest_id means others', () => {
183184
const testCases = [
184185
{ contestId: 'chokudai_S001', expected: ContestType.OTHERS },
185186
{ contestId: 'chokudai_S002', expected: ContestType.OTHERS },
186-
];
187-
188-
runTests('classifyContest', testCases, ({ contestId, expected }: TestCaseForContestType) => {
189-
expect(classifyContest(contestId)).toEqual(expected);
190-
});
191-
});
192-
193-
describe('when contest_id contains code-festival-2014-final, donuts, colopl and gigacode', () => {
194-
const testCases = [
195187
{ contestId: 'code-festival-2014-final', expected: ContestType.OTHERS },
196188
{ contestId: 'donuts-live2014', expected: ContestType.OTHERS },
197189
{ contestId: 'donuts-2015', expected: ContestType.OTHERS },
190+
{ contestId: 'mujin-pc-2016', expected: ContestType.OTHERS },
198191
{ contestId: 'colopl2018-qual', expected: ContestType.OTHERS },
199192
{ contestId: 'colopl2018-final', expected: ContestType.OTHERS },
200193
{ contestId: 'gigacode-2019', expected: ContestType.OTHERS },
@@ -395,26 +388,14 @@ describe('Contest', () => {
395388
);
396389
});
397390

398-
describe('when contest_id contains chokudai_S', () => {
391+
describe('when contest_id means others', () => {
399392
const testCases = [
400393
{ contestId: 'chokudai_S001', expected: ContestType.OTHERS },
401394
{ contestId: 'chokudai_S002', expected: ContestType.OTHERS },
402-
];
403-
404-
runTests(
405-
'getContestPriority',
406-
testCases,
407-
({ contestId, expected }: TestCaseForContestType) => {
408-
expect(getContestPriority(contestId)).toEqual(contestTypePriorities.get(expected));
409-
},
410-
);
411-
});
412-
413-
describe('when contest_id contains code-festival-2014-final, donuts, colopl and gigacode', () => {
414-
const testCases = [
415395
{ contestId: 'code-festival-2014-final', expected: ContestType.OTHERS },
416396
{ contestId: 'donuts-live2014', expected: ContestType.OTHERS },
417397
{ contestId: 'donuts-2015', expected: ContestType.OTHERS },
398+
{ contestId: 'mujin-pc-2016', expected: ContestType.OTHERS },
418399
{ contestId: 'colopl2018-qual', expected: ContestType.OTHERS },
419400
{ contestId: 'colopl2018-final', expected: ContestType.OTHERS },
420401
{ contestId: 'gigacode-2019', expected: ContestType.OTHERS },

0 commit comments

Comments
 (0)