Skip to content

Commit

Permalink
Add non working test case
Browse files Browse the repository at this point in the history
  • Loading branch information
Goneiross committed Nov 27, 2018
1 parent 72060b4 commit f9287a1
Showing 1 changed file with 125 additions and 3 deletions.
128 changes: 125 additions & 3 deletions src/__tests__/matrix/positiveLinearCombination.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,12 @@ describe('Positive linear combination', () => {

solutions = positiveLinearCombination(base, vector);


expect(solutions).toEqual(expected);
});
it('Decimal Base I', () => {


it('Base I Decimal I', () => {
let base = new Matrix([
[0, 20, 100, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 30, 100, 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
Expand All @@ -37,9 +40,128 @@ describe('Positive linear combination', () => {
let solutions = Matrix.zeros(1, base.columns);
let expected = new Matrix([[1, 0, 1, 0, 0, 0.5]]);

solutions = positiveLinearCombination(base, vector, { lowestDecimal: 0.5 });
solutions = positiveLinearCombination(base, vector, { lowestDecimal:
0.5 });

expect(solutions).toEqual(expected);
});


it('Luc I', () => {
let base = new Matrix([
[1, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[1, 1, 0, 0, 0, 0, 0, 0, 0, 0],
[1, 1, 1, 0, 0, 0, 0, 0, 0, 0],
[1, 1, 1, 1, 0, 0, 0, 0, 0, 0],
[1, 1, 1, 1, 1, 0, 0, 0, 0, 0],
[1, 1, 1, 1, 1, 1, 0, 0, 0, 0],
[1, 1, 1, 1, 1, 1, 1, 0, 0, 0],
[1, 1, 1, 1, 1, 1, 1, 1, 0, 0],
[1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
]);
let vector = new Matrix([[1, 0, 0, 0, 0, 0, 0, 0, 0, 0]]);
let solutions = Matrix.zeros(1, base.columns);
let expected = new Matrix([[1, 0, 0, 0, 0, 0, 0, 0, 0, 0]]);

solutions = positiveLinearCombination(base, vector);

console.table(solutions);
expect(solutions).toEqual(expected);
});


it('Luc II', () => {
let base = new Matrix([
[1, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[1, 1, 0, 0, 0, 0, 0, 0, 0, 0],
[1, 1, 1, 0, 0, 0, 0, 0, 0, 0],
[1, 1, 1, 1, 0, 0, 0, 0, 0, 0],
[1, 1, 1, 1, 1, 0, 0, 0, 0, 0],
[1, 1, 1, 1, 1, 1, 0, 0, 0, 0],
[1, 1, 1, 1, 1, 1, 1, 0, 0, 0],
[1, 1, 1, 1, 1, 1, 1, 1, 0, 0],
[1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
]);
let vector = new Matrix([[3, 0, 0, 0, 0, 0, 0, 0, 0, 0]]);
let solutions = Matrix.zeros(1, base.columns);


let expected = new Matrix([[3, 0, 0, 0, 0, 0, 0, 0, 0, 0]]);

solutions = positiveLinearCombination(base, vector);
expect(solutions).toEqual(expected);
});


it('Luc III', () => {
let base = new Matrix([
[1, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[1, 1, 0, 0, 0, 0, 0, 0, 0, 0],
[1, 1, 1, 0, 0, 0, 0, 0, 0, 0],
[1, 1, 1, 1, 0, 0, 0, 0, 0, 0],
[1, 1, 1, 1, 1, 0, 0, 0, 0, 0],
[1, 1, 1, 1, 1, 1, 0, 0, 0, 0],
[1, 1, 1, 1, 1, 1, 1, 0, 0, 0],
[1, 1, 1, 1, 1, 1, 1, 1, 0, 0],
[1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
]);
let vector = new Matrix([[0, 1, 0, 0, 0, 0, 0, 0, 0, 0]]);
let solutions = Matrix.zeros(1, base.columns);


let expected = new Matrix([[1, 0, 0, 0, 0, 0, 0, 0, 0, 0]]);

solutions = positiveLinearCombination(base, vector);
expect(solutions).toEqual(expected);
});
it('Luc IV', () => {
let base = new Matrix([
[1, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[1, 1, 0, 0, 0, 0, 0, 0, 0, 0],
[1, 1, 1, 0, 0, 0, 0, 0, 0, 0],
[1, 1, 1, 1, 0, 0, 0, 0, 0, 0],
[1, 1, 1, 1, 1, 0, 0, 0, 0, 0],
[1, 1, 1, 1, 1, 1, 0, 0, 0, 0],
[1, 1, 1, 1, 1, 1, 1, 0, 0, 0],
[1, 1, 1, 1, 1, 1, 1, 1, 0, 0],
[1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
]);
let vector = new Matrix([[0, 1, 1, 0, 0, 0, 0, 0, 0, 0]]);
let solutions = Matrix.zeros(1, base.columns);


let expected = new Matrix([[0, 1, 0, 0, 0, 0, 0, 0, 0, 0]]);

solutions = positiveLinearCombination(base, vector);
expect(solutions).toEqual(expected);
});

/*
it('Luc V', () => {
let base = new Matrix([
[1, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[1, 1, 0, 0, 0, 0, 0, 0, 0, 0],
[1, 1, 1, 0, 0, 0, 0, 0, 0, 0],
[1, 1, 1, 1, 0, 0, 0, 0, 0, 0],
[1, 1, 1, 1, 1, 0, 0, 0, 0, 0],
[1, 1, 1, 1, 1, 1, 0, 0, 0, 0],
[1, 1, 1, 1, 1, 1, 1, 0, 0, 0],
[1, 1, 1, 1, 1, 1, 1, 1, 0, 0],
[1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
]);
let vector = new Matrix([[10, 9, 8, 7, 6, 5, 4, 3, 2, 1]]);
let solutions = Matrix.zeros(1, base.columns);
let expected = new Matrix([[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]);
solutions = positiveLinearCombination(base, vector);
expect(solutions).toEqual(expected);
});
*/
});

0 comments on commit f9287a1

Please sign in to comment.