-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
352 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
import { GradeBands } from '../../GradeBands' | ||
import { Brazilian } from '../../scales' | ||
|
||
describe('Brazilian', () => { | ||
describe('Get Score', () => { | ||
[ | ||
['III', 'I'], | ||
['IXb', 'VIsup'], | ||
['VIsup', 'III'], | ||
['VIsup', 'VI'] | ||
].forEach((t) => { | ||
test(`${t[0]} > ${t[1]}`, () => { | ||
const lowGrade = Brazilian.getScore(t[1]) | ||
const highGrade = Brazilian.getScore(t[0]) | ||
expect(highGrade[0]).toBeGreaterThan(lowGrade[1]) | ||
}) | ||
}) | ||
|
||
test('Slash grade provided', () => { | ||
expect(Brazilian.getScore('VI/VIsup')).toStrictEqual([65, 66]) | ||
expect(Brazilian.getScore('VIIIa/b')).toStrictEqual([75, 76]) | ||
expect(Brazilian.getScore('II/IIsup')).toStrictEqual([18, 24]) | ||
}) | ||
}) | ||
|
||
describe('Invalid grade format', () => { | ||
jest.spyOn(console, 'warn').mockImplementation() | ||
beforeEach(() => { | ||
jest.clearAllMocks() | ||
}) | ||
test('invalid plus modifier', () => { | ||
const invalidGrade = Brazilian.getScore('VI+') | ||
expect(console.warn).toHaveBeenCalledWith( | ||
'Unexpected grade format: VI+ for grade scale Brazilian' | ||
) | ||
expect(invalidGrade).toEqual(-1) | ||
}) | ||
test('invalid minus modifier', () => { | ||
const invalidGrade = Brazilian.getScore('VI-') | ||
expect(console.warn).toHaveBeenCalledWith( | ||
'Unexpected grade format: VI- for grade scale Brazilian' | ||
) | ||
expect(invalidGrade).toEqual(-1) | ||
}) | ||
test('extra slash grade', () => { | ||
const invalidGrade = Brazilian.getScore('5/5+/6-') | ||
expect(console.warn).toHaveBeenCalledWith( | ||
'Unexpected grade format: 5/5+/6- for grade scale Brazilian' | ||
) | ||
expect(invalidGrade).toEqual(-1) | ||
}) | ||
test('next grade not subsequent (abc)', () => { | ||
const invalidGrade = Brazilian.getScore('VIIa/c') | ||
expect(console.warn).toHaveBeenCalledWith( | ||
'Unexpected grade slash not subsequent: VIIc' | ||
) | ||
expect(invalidGrade).toEqual(-1) | ||
}) | ||
test('next grade not subsequent (sup)', () => { | ||
const invalidGrade = Brazilian.getScore('V/VIsup') | ||
expect(console.warn).toHaveBeenCalledWith( | ||
'Unexpected grade slash not subsequent: VIsup' | ||
) | ||
expect(invalidGrade).toEqual(-1) | ||
}) | ||
test('not Brazilian scale', () => { | ||
const invalidGrade = Brazilian.getScore('V11') | ||
expect(console.warn).toHaveBeenCalledWith( | ||
'Unexpected grade format: V11 for grade scale Brazilian' | ||
) | ||
expect(invalidGrade).toEqual(-1) | ||
}) | ||
}) | ||
|
||
describe('Get Grade', () => { | ||
test('bottom of range', () => { | ||
expect(Brazilian.getGrade(0)).toBe('I') | ||
}) | ||
|
||
test('top of range', () => { | ||
expect(Brazilian.getGrade(1000)).toBe('XIV') | ||
}) | ||
|
||
test('single score provided', () => { | ||
expect(Brazilian.getGrade(25)).toBe('IIsup') | ||
expect(Brazilian.getGrade(30)).toBe('III') | ||
expect(Brazilian.getGrade(48)).toBe('IVsup') | ||
expect(Brazilian.getGrade(75)).toBe('VIIIa') | ||
}) | ||
test('range of scores provided', () => { | ||
expect(Brazilian.getGrade([43, 44])).toBe('IV') | ||
expect(Brazilian.getGrade([71, 72])).toBe('VIIb/VIIc') | ||
expect(Brazilian.getGrade([12, 15])).toBe('Isup/II') | ||
expect(Brazilian.getGrade([44, 55])).toBe('IV/IVsup') | ||
}) | ||
}) | ||
|
||
describe('Get Grade Band', () => { | ||
test('gets Gradeband', () => { | ||
expect(Brazilian.getGradeBand('III')).toEqual(GradeBands.BEGINNER) | ||
expect(Brazilian.getGradeBand('VIIIa')).toEqual(GradeBands.ADVANCED) | ||
expect(Brazilian.getGradeBand('IXb')).toEqual(GradeBands.EXPERT) | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,109 +1,109 @@ | ||
score,yds,french,uiaa,ewbank,saxon,norwegian | ||
0,5.0,1a,1,1,1,1- | ||
1,5.0,1a,1,1,1,1- | ||
2,5.0,1a+,1,1,1,1- | ||
3,5.0,1a+,1,1,1,1- | ||
4,5.0,1b,1,1,1,1 | ||
5,5.0,1b,1,2,1,1 | ||
6,5.0,1b+,1,2,1,1+ | ||
7,5.0,1b+,1,2,1,1+ | ||
8,5.0,1c,1,2,1,1+ | ||
9,5.0,1c,1,2,1,1+ | ||
10,5.0,1c+,1,3,1,2- | ||
11,5,1c+,1,4,1,2- | ||
12,5.1,2a,2,5,2,2 | ||
13,5.1,2a,2,5,2,2 | ||
14,5.1,2a+,2,5,2,2 | ||
15,5.1,2a+,2,6,2,2 | ||
16,5.1,2b,2,6,2,2+ | ||
17,5.1,2b,2,6,2,2+ | ||
18,5.2,2b+,2,7,2,2+ | ||
19,5.2,2b+,2,7,2,2+ | ||
20,5.2,2c,2,7,2,3- | ||
21,5.2,2c,2,7,2,3- | ||
22,5.3,2c+,2,8,2,3 | ||
23,5.3,2c+,2,8,2,3 | ||
24,5.3,3a,3,9,3,3 | ||
25,5.3,3a,3,9,3,3 | ||
26,5.4,3a+,3,10,3,3+ | ||
27,5.4,3a+,3,10,3,3+ | ||
28,5.4,3b,3,10,3,3+ | ||
29,5.4,3b,3,10,3,3+ | ||
30,5.4,3b+,3,10,3,4- | ||
31,5.5,3b+,3,11,3,4- | ||
32,5.5,3c,3,11,3,4 | ||
33,5.5,3c,3,12,3,4 | ||
34,5.5,3c+,3,12,3,4 | ||
35,5.5,3c+,3,12,3,4 | ||
36,5.6,4a,4,13,4,4+ | ||
37,5.6,4a,4,13,4,4+ | ||
38,5.6,4a+,4+,13,4,4+ | ||
39,5.6,4a+,4+,13,4,4+ | ||
40,5.6,4b,4+,13,5,5- | ||
41,5.7,4b,4+,14,5,5- | ||
42,5.7,4b+,5-,14,5,5- | ||
43,5.7,4b+,5-,14,5,5- | ||
44,5.7,4c,5-,15,5,5 | ||
45,5.7,4c,5-,15,5,5 | ||
46,5.8,4c+,5,16,6,5 | ||
47,5.8,4c+,5,16,6,5 | ||
48,5.8,5a,5,16,7a,5+ | ||
49,5.8,5a,5,16,7a,5+ | ||
50,5.8,5a+,5+,16,7a,5+ | ||
51,5.8,5a+,5+,16,7a,5+ | ||
52,5.9,5b,5+,17,7a,5+ | ||
53,5.9,5b,5+,17,7a,5+ | ||
54,5.9,5b+,6-,17,7b,5+ | ||
55,5.9,5b+,6-,17,7b,5+ | ||
56,5.9,5c,6,17,7b,6- | ||
57,5.10a,5c,6,18,7b,6- | ||
58,5.10a,5c+,6+,18,7c,6- | ||
59,5.10a,5c+,6+,18,7c,6- | ||
60,5.10a,6a,6+,18,7c,6- | ||
61,5.10a,6a,6+,18,7c,6- | ||
62,5.10b,6a+,7-,19,8a,6 | ||
63,5.10b,6a+,7-,19,8a,6 | ||
64,5.10c,6b,7,20,8b,6 | ||
65,5.10c,6b,7,20,8b,6 | ||
66,5.10d,6b+,7+,20,8c,6+ | ||
67,5.11a,6b+,7+,21,8c,6+ | ||
68,5.11a,6c,7+/8-,21,9a,7- | ||
69,5.11b,6c,7+/8-,22,9a,7- | ||
70,5.11b,6c+,8-,22,9a,7 | ||
71,5.11c,6c+,8-,23,9a,7 | ||
72,5.11c,7a,8,23,9b,7+ | ||
73,5.11d,7a,8,23,9b,7+ | ||
74,5.11d,7a+,8+,24,9c,8- | ||
75,5.12a,7a+,8+,24,9c,8- | ||
76,5.12b,7b,8+/9-,25,10a,8- | ||
77,5.12b,7b,8+/9-,25,10a,8- | ||
78,5.12c,7b+,9-,26,10a,8 | ||
79,5.12c,7b+,9-,26,10a,8 | ||
80,5.12d,7c,9,27,10b,8+ | ||
81,5.12d,7c,9,27,10b,8+ | ||
82,5.13a,7c+,9+,28,10c,8+ | ||
83,5.13a,7c+,9+,28,10c,8+ | ||
84,5.13b,8a,10-,29,10c,9- | ||
85,5.13b,8a,10-,29,10c,9- | ||
86,5.13c,8a+,10,30,11b,9- | ||
87,5.13c,8a+,10,30,11b,9- | ||
88,5.13d,8b,10+,31,11c,9 | ||
89,5.13d,8b,10+,31,11c,9 | ||
90,5.14a,8b+,10+/11-,32,11c,9+ | ||
91,5.14a,8b+,10+/11-,32,11c,9+ | ||
92,5.14b,8c,11-,33,12a,9+ | ||
93,5.14b,8c,11-,33,12a,9+ | ||
94,5.14c,8c+,11,34,12b,10- | ||
95,5.14c,8c+,11,34,12b,10- | ||
96,5.14d,9a,11,35,12c,10 | ||
97,5.14d,9a,11,35,12c,10 | ||
98,5.15a,9a+,11/11+,36,13a,10+ | ||
99,5.15a,9a+,11/11+,36,13a,10+ | ||
100,5.15b,9b,11+,37,13b,10+ | ||
101,5.15b,9b,11+,37,13b,10+ | ||
102,5.15c,9b+,11+/12-,38,13b,11- | ||
103,5.15c,9b+,11+/12-,38,13b,11- | ||
104,5.15d,9c,12-,39,13c,11 | ||
105,5.15d,9c,12-,39,13c,11 | ||
106,5.16a,9c+,12,40,13c,11+ | ||
107,5.16a,9c+,12,40,13c,11+ | ||
score,yds,french,uiaa,ewbank,saxon,norwegian,brazilian | ||
0,5.0,1a,1,1,1,1-,I | ||
1,5.0,1a,1,1,1,1-,I | ||
2,5.0,1a+,1,1,1,1-,I | ||
3,5.0,1a+,1,1,1,1-,I | ||
4,5.0,1b,1,1,1,1,I | ||
5,5.0,1b,1,2,1,1,I | ||
6,5.0,1b+,1,2,1,1+,I | ||
7,5.0,1b+,1,2,1,1+,I | ||
8,5.0,1c,1,2,1,1+,Isup | ||
9,5.0,1c,1,2,1,1+,Isup | ||
10,5.0,1c+,1,3,1,2-,Isup | ||
11,5,1c+,1,4,1,2-,Isup | ||
12,5.1,2a,2,5,2,2,Isup | ||
13,5.1,2a,2,5,2,2,Isup | ||
14,5.1,2a+,2,5,2,2,II | ||
15,5.1,2a+,2,6,2,2,II | ||
16,5.1,2b,2,6,2,2+,II | ||
17,5.1,2b,2,6,2,2+,II | ||
18,5.2,2b+,2,7,2,2+,II | ||
19,5.2,2b+,2,7,2,2+,II | ||
20,5.2,2c,2,7,2,3-,II | ||
21,5.2,2c,2,7,2,3-,II | ||
22,5.3,2c+,2,8,2,3,IIsup | ||
23,5.3,2c+,2,8,2,3,IIsup | ||
24,5.3,3a,3,9,3,3,IIsup | ||
25,5.3,3a,3,9,3,3,IIsup | ||
26,5.4,3a+,3,10,3,3+,IIsup | ||
27,5.4,3a+,3,10,3,3+,IIsup | ||
28,5.4,3b,3,10,3,3+,III | ||
29,5.4,3b,3,10,3,3+,III | ||
30,5.4,3b+,3,10,3,4-,III | ||
31,5.5,3b+,3,11,3,4-,III | ||
32,5.5,3c,3,11,3,4,III | ||
33,5.5,3c,3,12,3,4,III | ||
34,5.5,3c+,3,12,3,4,III | ||
35,5.5,3c+,3,12,3,4,III | ||
36,5.6,4a,4,13,4,4+,IIIsup | ||
37,5.6,4a,4,13,4,4+,IIIsup | ||
38,5.6,4a+,4+,13,4,4+,IIIsup | ||
39,5.6,4a+,4+,13,4,4+,IIIsup | ||
40,5.6,4b,4+,13,5,5-,IIIsup | ||
41,5.7,4b,4+,14,5,5-,IIIsup | ||
42,5.7,4b+,5-,14,5,5-,IV | ||
43,5.7,4b+,5-,14,5,5-,IV | ||
44,5.7,4c,5-,15,5,5,IV | ||
45,5.7,4c,5-,15,5,5,IV | ||
46,5.8,4c+,5,16,6,5,IV | ||
47,5.8,4c+,5,16,6,5,IV | ||
48,5.8,5a,5,16,7a,5+,IVsup | ||
49,5.8,5a,5,16,7a,5+,IVsup | ||
50,5.8,5a+,5+,16,7a,5+,IVsup | ||
51,5.8,5a+,5+,16,7a,5+,IVsup | ||
52,5.9,5b,5+,17,7a,5+,IVsup | ||
53,5.9,5b,5+,17,7a,5+,IVsup | ||
54,5.9,5b+,6-,17,7b,5+,IVsup | ||
55,5.9,5b+,6-,17,7b,5+,IVsup | ||
56,5.9,5c,6,17,7b,6-,V | ||
57,5.10a,5c,6,18,7b,6-,V | ||
58,5.10a,5c+,6+,18,7c,6-,V | ||
59,5.10a,5c+,6+,18,7c,6-,V | ||
60,5.10a,6a,6+,18,7c,6-,V | ||
61,5.10a,6a,6+,18,7c,6-,V | ||
62,5.10b,6a+,7-,19,8a,6,Vsup | ||
63,5.10b,6a+,7-,19,8a,6,Vsup | ||
64,5.10c,6b,7,20,8b,6,VI | ||
65,5.10c,6b,7,20,8b,6,VI | ||
66,5.10d,6b+,7+,20,8c,6+,VIsup | ||
67,5.11a,6b+,7+,21,8c,6+,VIsup | ||
68,5.11a,6c,7+/8-,21,9a,7-,VIIa | ||
69,5.11b,6c,7+/8-,22,9a,7-,VIIa | ||
70,5.11b,6c+,8-,22,9a,7,VIIb | ||
71,5.11c,6c+,8-,23,9a,7,VIIb | ||
72,5.11c,7a,8,23,9b,7+,VIIc | ||
73,5.11d,7a,8,23,9b,7+,VIIc | ||
74,5.11d,7a+,8+,24,9c,8-,VIIIa | ||
75,5.12a,7a+,8+,24,9c,8-,VIIIa | ||
76,5.12b,7b,8+/9-,25,10a,8-,VIIIb | ||
77,5.12b,7b,8+/9-,25,10a,8-,VIIIb | ||
78,5.12c,7b+,9-,26,10a,8,VIIIc | ||
79,5.12c,7b+,9-,26,10a,8,VIIIc | ||
80,5.12d,7c,9,27,10b,8+,IXa | ||
81,5.12d,7c,9,27,10b,8+,IXa | ||
82,5.13a,7c+,9+,28,10c,8+,IXb | ||
83,5.13a,7c+,9+,28,10c,8+,IXb | ||
84,5.13b,8a,10-,29,10c,9-,IXc | ||
85,5.13b,8a,10-,29,10c,9-,IXc | ||
86,5.13c,8a+,10,30,11b,9-,Xa | ||
87,5.13c,8a+,10,30,11b,9-,Xa | ||
88,5.13d,8b,10+,31,11c,9,Xb | ||
89,5.13d,8b,10+,31,11c,9,Xb | ||
90,5.14a,8b+,10+/11-,32,11c,9+,Xc | ||
91,5.14a,8b+,10+/11-,32,11c,9+,Xc | ||
92,5.14b,8c,11-,33,12a,9+,XIa | ||
93,5.14b,8c,11-,33,12a,9+,XIa | ||
94,5.14c,8c+,11,34,12b,10-,XIb | ||
95,5.14c,8c+,11,34,12b,10-,XIb | ||
96,5.14d,9a,11,35,12c,10,XIc | ||
97,5.14d,9a,11,35,12c,10,XIc | ||
98,5.15a,9a+,11/11+,36,13a,10+,XIIa | ||
99,5.15a,9a+,11/11+,36,13a,10+,XIIa | ||
100,5.15b,9b,11+,37,13b,10+,XIIb | ||
101,5.15b,9b,11+,37,13b,10+,XIIb | ||
102,5.15c,9b+,11+/12-,38,13b,11-,XIIc | ||
103,5.15c,9b+,11+/12-,38,13b,11-,XIIc | ||
104,5.15d,9c,12-,39,13c,11,XIII | ||
105,5.15d,9c,12-,39,13c,11,XIIIb | ||
106,5.16a,9c+,12,40,13c,11+,XIIIc | ||
107,5.16a,9c+,12,40,13c,11+,XIV |
Oops, something went wrong.