Skip to content

Commit 16d3422

Browse files
author
replabrobin
committed
1 parent 718ef3c commit 16d3422

2 files changed

Lines changed: 34 additions & 0 deletions

File tree

js/test/highjump.spec.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,4 +506,21 @@ describe('Given an instance of Athlib.HighJumpCompetition', function(){
506506
(function(v){it("competition is finished",()=>{expect(v).to.equal(true)});})(c.isFinished);
507507
(function(v){it("competition is not running",()=>{expect(v).to.equal(false)});})(c.isRunning);
508508
});
509+
describe('test_nor_strangness',function(){
510+
var mx =[
511+
['bib', '4.65', '4.75', '4.85', '4.95', '5.05', '4.95', '4.90', '4.85'],
512+
['193','o','xo','o','xxx','-','x','x','x'],
513+
['175','o','xo','o','-','xxx','x','x','o']
514+
];
515+
function check(title, r1v, r2v, p175, p193){
516+
mx[1][8] = r1v;
517+
mx[2][8] = r2v;
518+
var c = Athlib.HighJumpCompetition.fromMatrix(mx);
519+
it(title+' '+r1v+' '+r2v,()=>{expect(c.jumpersByBib['175'].place).to.equal(p175) && expect(c.jumpersByBib['193'].place).to.equal(p193)});
520+
};
521+
check("175 place 1, 193 place 2", 'x', 'o', 1, 2);
522+
check("175 place 1, 193 place 2", 'r', 'o', 1, 2);
523+
check("175 place 1, 193 place 1", 'r', 'r', 1, 1);
524+
check("175 place 1, 193 place 1", 'x', 'x', 1, 1);
525+
});
509526
});

tests/test_highjump.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,23 @@ def test_rieto_pv(self):
396396
self.assertEqual(c.state,'finished','One winning jumper failed at his chosen height')
397397
self.assertEqual(c.jumpers_by_bib['EF007915'].place,1,'EF007915 came first')
398398

399+
def test_nor_strangeness(self):
400+
mx = [_.split() for _ in '''bib 4.65 4.75 4.85 4.95 5.05 4.95 4.90 4.85
401+
193 o xo o xxx - x x x
402+
175 o xo o - xxx x x o'''.split('\n')]
403+
def check(r1v, r2v, p175, p193):
404+
mx[1][8] = r1v;
405+
mx[2][8] = r2v;
406+
c = HighJumpCompetition.from_matrix(mx)
407+
self.assertTrue(c.jumpers_by_bib['175'].place==p175
408+
and
409+
c.jumpers_by_bib['193'].place==p193,
410+
'175 place %s 193 place %s %s %s' % (p175,p193,r1v,r2v))
411+
check('x', 'o', 1, 2);
412+
check('r', 'o', 1, 2);
413+
check('r', 'r', 1, 1);
414+
check('x', 'x', 1, 1);
415+
399416

400417
if __name__ == '__main__':
401418
main()

0 commit comments

Comments
 (0)