maths.ts
Version:
Math utilities library for TypeScript, JavaScript and Node.js
50 lines (46 loc) • 1.84 kB
text/typescript
/**
* @author Hector J. Vasquez <ipi.vasquez@gmail.com>
*
* @licence
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*describe('algorithms::simplex', () => {
it('Maximize test', () => {
let out = simplex(SIMPLEX_TEST_CASES['Maximize test 1']);
compareRNumberArrays(out, SIMPLEX_TEST_CASES['Maximize test 1'].out);
});
it('Minimize test', () => {
let out = simplex(SIMPLEX_TEST_CASES['Minimize test 1']);
compareRNumberArrays(out, SIMPLEX_TEST_CASES['Minimize test 1'].out);
});
});
describe('algorithms::modiMethod', () => {
it('Swimmers', () => {
let out = modiMethod(MODI_TEST_CASES.swimmers);
expect(out.value()).to.equals(MODI_TEST_CASES.swimmers.out.value());
});
it('Windmill', () => {
let out = modiMethod(MODI_TEST_CASES.windmills);
expect(out.value()).to.equals(MODI_TEST_CASES.windmills.out.value());
});
it('Power Co', () => {
let out = modiMethod(MODI_TEST_CASES.powerCo);
expect(out.value()).to.equals(MODI_TEST_CASES.powerCo.out.value());
});
});
function compareRNumberArrays(arr1: Node[], arr2: Node[]): void {
if (arr1.length !== arr2.length)
return;
for (let i = 0; i < arr1.length; i++)
expect(arr1[i].getNumberValue()).to.equals(arr2[i].getNumberValue());
}*/