@@ -27,8 +27,8 @@ describe('linear sum problem', () => {
2727 const { columnAssignments, rowAssignments } = linearSumAssignment ( diff , {
2828 maximaze : false ,
2929 } ) ;
30- expect ( columnAssignments ) . toMatchCloseTo ( [ 2 , 0 , 1 , 3 , 4 ] ) ;
31- expect ( rowAssignments ) . toMatchCloseTo ( [ 1 , 2 , 0 , 3 , 4 , - 1 ] ) ;
30+ expect ( columnAssignments ) . toMatchCloseTo ( [ 1 , 2 , 0 , 3 , 4 , - 1 ] ) ;
31+ expect ( rowAssignments ) . toMatchCloseTo ( [ 2 , 0 , 1 , 3 , 4 ] ) ;
3232 } ) ;
3333 it ( 'differents size: rows < columns' , ( ) => {
3434 const a = [ 3.1 , 1.1 , 1.9 , 3.99 , 5.2 ] ;
@@ -42,4 +42,16 @@ describe('linear sum problem', () => {
4242 expect ( columnAssignments ) . toMatchCloseTo ( [ 1 , 2 , 0 , 3 , 4 , - 1 ] ) ;
4343 expect ( rowAssignments ) . toMatchCloseTo ( [ 2 , 0 , 1 , 3 , 4 ] ) ;
4444 } ) ;
45+ it ( 'before failing case' , ( ) => {
46+ const diff = [
47+ [ 0.10000000000000009 , 0.5 , 0.6000000000000001 , 1.1 ] ,
48+ [ 0.3999999999999999 , 0 , 0.10000000000000009 , 0.6000000000000001 ] ,
49+ [ 0.8999999999999999 , 0.5 , 0.3999999999999999 , 0.10000000000000009 ] ,
50+ ] ;
51+ const { columnAssignments, rowAssignments } = linearSumAssignment ( diff , {
52+ maximaze : false ,
53+ } ) ;
54+ expect ( columnAssignments ) . toMatchCloseTo ( [ 0 , 1 , 2 , - 1 ] ) ;
55+ expect ( rowAssignments ) . toMatchCloseTo ( [ 0 , 1 , 2 ] ) ;
56+ } ) ;
4557} ) ;
0 commit comments