Skip to content

Commit f9287a1

Browse files
committed
Add non working test case
1 parent 72060b4 commit f9287a1

File tree

1 file changed

+125
-3
lines changed

1 file changed

+125
-3
lines changed

src/__tests__/matrix/positiveLinearCombination.js

Lines changed: 125 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,12 @@ describe('Positive linear combination', () => {
2121

2222
solutions = positiveLinearCombination(base, vector);
2323

24+
2425
expect(solutions).toEqual(expected);
2526
});
26-
it('Decimal Base I', () => {
27+
28+
29+
it('Base I Decimal I', () => {
2730
let base = new Matrix([
2831
[0, 20, 100, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
2932
[0, 0, 0, 0, 0, 30, 100, 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
@@ -37,9 +40,128 @@ describe('Positive linear combination', () => {
3740
let solutions = Matrix.zeros(1, base.columns);
3841
let expected = new Matrix([[1, 0, 1, 0, 0, 0.5]]);
3942

40-
solutions = positiveLinearCombination(base, vector, { lowestDecimal: 0.5 });
43+
solutions = positiveLinearCombination(base, vector, { lowestDecimal:
44+
0.5 });
45+
46+
expect(solutions).toEqual(expected);
47+
});
48+
49+
50+
it('Luc I', () => {
51+
let base = new Matrix([
52+
[1, 0, 0, 0, 0, 0, 0, 0, 0, 0],
53+
[1, 1, 0, 0, 0, 0, 0, 0, 0, 0],
54+
[1, 1, 1, 0, 0, 0, 0, 0, 0, 0],
55+
[1, 1, 1, 1, 0, 0, 0, 0, 0, 0],
56+
[1, 1, 1, 1, 1, 0, 0, 0, 0, 0],
57+
[1, 1, 1, 1, 1, 1, 0, 0, 0, 0],
58+
[1, 1, 1, 1, 1, 1, 1, 0, 0, 0],
59+
[1, 1, 1, 1, 1, 1, 1, 1, 0, 0],
60+
[1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
61+
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
62+
]);
63+
let vector = new Matrix([[1, 0, 0, 0, 0, 0, 0, 0, 0, 0]]);
64+
let solutions = Matrix.zeros(1, base.columns);
65+
let expected = new Matrix([[1, 0, 0, 0, 0, 0, 0, 0, 0, 0]]);
66+
67+
solutions = positiveLinearCombination(base, vector);
4168

42-
console.table(solutions);
4369
expect(solutions).toEqual(expected);
4470
});
71+
72+
73+
it('Luc II', () => {
74+
let base = new Matrix([
75+
[1, 0, 0, 0, 0, 0, 0, 0, 0, 0],
76+
[1, 1, 0, 0, 0, 0, 0, 0, 0, 0],
77+
[1, 1, 1, 0, 0, 0, 0, 0, 0, 0],
78+
[1, 1, 1, 1, 0, 0, 0, 0, 0, 0],
79+
[1, 1, 1, 1, 1, 0, 0, 0, 0, 0],
80+
[1, 1, 1, 1, 1, 1, 0, 0, 0, 0],
81+
[1, 1, 1, 1, 1, 1, 1, 0, 0, 0],
82+
[1, 1, 1, 1, 1, 1, 1, 1, 0, 0],
83+
[1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
84+
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
85+
]);
86+
let vector = new Matrix([[3, 0, 0, 0, 0, 0, 0, 0, 0, 0]]);
87+
let solutions = Matrix.zeros(1, base.columns);
88+
89+
90+
let expected = new Matrix([[3, 0, 0, 0, 0, 0, 0, 0, 0, 0]]);
91+
92+
solutions = positiveLinearCombination(base, vector);
93+
expect(solutions).toEqual(expected);
94+
});
95+
96+
97+
it('Luc III', () => {
98+
let base = new Matrix([
99+
[1, 0, 0, 0, 0, 0, 0, 0, 0, 0],
100+
[1, 1, 0, 0, 0, 0, 0, 0, 0, 0],
101+
[1, 1, 1, 0, 0, 0, 0, 0, 0, 0],
102+
[1, 1, 1, 1, 0, 0, 0, 0, 0, 0],
103+
[1, 1, 1, 1, 1, 0, 0, 0, 0, 0],
104+
[1, 1, 1, 1, 1, 1, 0, 0, 0, 0],
105+
[1, 1, 1, 1, 1, 1, 1, 0, 0, 0],
106+
[1, 1, 1, 1, 1, 1, 1, 1, 0, 0],
107+
[1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
108+
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
109+
]);
110+
let vector = new Matrix([[0, 1, 0, 0, 0, 0, 0, 0, 0, 0]]);
111+
let solutions = Matrix.zeros(1, base.columns);
112+
113+
114+
let expected = new Matrix([[1, 0, 0, 0, 0, 0, 0, 0, 0, 0]]);
115+
116+
solutions = positiveLinearCombination(base, vector);
117+
expect(solutions).toEqual(expected);
118+
});
119+
it('Luc IV', () => {
120+
let base = new Matrix([
121+
[1, 0, 0, 0, 0, 0, 0, 0, 0, 0],
122+
[1, 1, 0, 0, 0, 0, 0, 0, 0, 0],
123+
[1, 1, 1, 0, 0, 0, 0, 0, 0, 0],
124+
[1, 1, 1, 1, 0, 0, 0, 0, 0, 0],
125+
[1, 1, 1, 1, 1, 0, 0, 0, 0, 0],
126+
[1, 1, 1, 1, 1, 1, 0, 0, 0, 0],
127+
[1, 1, 1, 1, 1, 1, 1, 0, 0, 0],
128+
[1, 1, 1, 1, 1, 1, 1, 1, 0, 0],
129+
[1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
130+
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
131+
]);
132+
let vector = new Matrix([[0, 1, 1, 0, 0, 0, 0, 0, 0, 0]]);
133+
let solutions = Matrix.zeros(1, base.columns);
134+
135+
136+
let expected = new Matrix([[0, 1, 0, 0, 0, 0, 0, 0, 0, 0]]);
137+
138+
solutions = positiveLinearCombination(base, vector);
139+
expect(solutions).toEqual(expected);
140+
});
141+
142+
/*
143+
144+
it('Luc V', () => {
145+
let base = new Matrix([
146+
[1, 0, 0, 0, 0, 0, 0, 0, 0, 0],
147+
[1, 1, 0, 0, 0, 0, 0, 0, 0, 0],
148+
[1, 1, 1, 0, 0, 0, 0, 0, 0, 0],
149+
[1, 1, 1, 1, 0, 0, 0, 0, 0, 0],
150+
[1, 1, 1, 1, 1, 0, 0, 0, 0, 0],
151+
[1, 1, 1, 1, 1, 1, 0, 0, 0, 0],
152+
[1, 1, 1, 1, 1, 1, 1, 0, 0, 0],
153+
[1, 1, 1, 1, 1, 1, 1, 1, 0, 0],
154+
[1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
155+
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
156+
]);
157+
let vector = new Matrix([[10, 9, 8, 7, 6, 5, 4, 3, 2, 1]]);
158+
let solutions = Matrix.zeros(1, base.columns);
159+
160+
161+
let expected = new Matrix([[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]);
162+
163+
solutions = positiveLinearCombination(base, vector);
164+
expect(solutions).toEqual(expected);
165+
});
166+
*/
45167
});

0 commit comments

Comments
 (0)