math5/src/math5.ts

21 lines
618 B
TypeScript
Raw Normal View History

import {assemble} from '@/core/Dispatcher'
import * as specifications from './all'
const math = assemble(specifications)
export default math
if (import.meta.vitest) {
const {it, expect} = import.meta.vitest
it('Can type numbers and Complex<T>', () => {
expect(math.typeOf(-7.5)).toBe('number')
expect(math.typeOf({re:2, im: 0.5})).toBe('Complex<number>')
expect(math.typeOf({re: {re: -1, im: 3}, im: {re: 0, im: 2.2}}))
.toBe('Complex<Complex<number>>')
})
it("Doesn't have a string type yet", () => {
expect(math.typeOf('foo')).toBe('unknown')
})
}