Sha256: 182bfc7293712abf91c376554be8452928b83c6a8ab830b66be6505c64353a58
Contents?: true
Size: 1.05 KB
Versions: 72
Compression:
Stored size: 1.05 KB
Contents
component extends="testbox.system.BaseSpec" { function beforeAll(){ SUT = createObject( 'SaddlePoints' ); } function run(){ describe( "My SaddlePoints class", function(){ it( 'Can identify single saddle point', function(){ expect( SUT.saddlePoints( input=[[9, 8, 7], [5, 3, 2], [6, 6, 7]] ) ).toBe( [{"row":1,"column":0}] ); }); it( 'Can identify that empty matrix has no saddle points', function(){ expect( SUT.saddlePoints( input=[[]] ) ).toBe( [] ); }); it( 'Can identify lack of saddle points when there are none', function(){ expect( SUT.saddlePoints( input=[[1, 2, 3], [3, 1, 2], [2, 3, 1]] ) ).toBe( [] ); }); it( 'Can identify multiple saddle points', function(){ expect( SUT.saddlePoints( input=[[4, 5, 4], [3, 5, 5], [1, 5, 4]] ) ).toBe( [{"row":0,"column":1},{"row":1,"column":1},{"row":2,"column":1}] ); }); it( 'Can identify saddle point in bottom right corner', function(){ expect( SUT.saddlePoints( input=[[8, 7, 9], [6, 7, 6], [3, 2, 5]] ) ).toBe( [{"row":2,"column":2}] ); }); }); } }
Version data entries
72 entries across 71 versions & 1 rubygems