Enable testing with vitest (#13)
Resolves #12. Co-authored-by: Jos de Jong <wjosdejong@gmail.com> Reviewed-on: #13 Co-authored-by: Glen Whitney <glen@studioinfinity.org> Co-committed-by: Glen Whitney <glen@studioinfinity.org>
This commit is contained in:
parent
06909a6a5e
commit
047385d56b
7 changed files with 820 additions and 14 deletions
20
src/math5.ts
Normal file
20
src/math5.ts
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
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')
|
||||
})
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue