Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
hpeebles committed Oct 3, 2024
1 parent 5a25840 commit 3110fa9
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions test/runtime/value/convert/bigint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Type } from '@sinclair/typebox'
import { Assert } from '../../assert/index'

describe('value/convert/BigInt', () => {
it('Should convert bitint from string 1', () => {
it('Should convert bigint from string 1', () => {
const T = Type.BigInt()
const R = Value.Convert(T, '1')
Assert.IsEqual(R, BigInt(1))
Expand All @@ -13,7 +13,7 @@ describe('value/convert/BigInt', () => {
const R = Value.Convert(T, '3.14')
Assert.IsEqual(R, BigInt(3))
})
it('Should convert bitint from string 3', () => {
it('Should convert bigint from string 3', () => {
const T = Type.BigInt()
const R = Value.Convert(T, 'true')
Assert.IsEqual(R, BigInt(1))
Expand Down Expand Up @@ -43,7 +43,7 @@ describe('value/convert/BigInt', () => {
const R = Value.Convert(T, '-12345678901234567890.123')
Assert.IsEqual(R, BigInt('-12345678901234567890'))
})
it('Should convert bitint from number 1', () => {
it('Should convert bigint from number 1', () => {
const T = Type.BigInt()
const R = Value.Convert(T, 1)
Assert.IsEqual(R, BigInt(1))
Expand All @@ -63,10 +63,15 @@ describe('value/convert/BigInt', () => {
const R = Value.Convert(T, Number.MAX_SAFE_INTEGER)
Assert.IsEqual(R, BigInt(9007199254740991))
})
it('Should convert bitint from boolean 1', () => {
it('Should convert bigint from number 4', () => {
const T = Type.BigInt()
const R = Value.Convert(T, true)
Assert.IsEqual(R, BigInt(1))
const R = Value.Convert(T, Number.MAX_SAFE_INTEGER)
Assert.IsEqual(R, BigInt(9007199254740991))
})
it('Should convert bigint from number 5 1', () => {
const T = Type.BigInt()
const R = Value.Convert(T, 123456789012345.6789)
Assert.IsEqual(R, BigInt(123456789012345))
})
it('Should convert bigint from boolean 2', () => {
const T = Type.BigInt()
Expand Down

0 comments on commit 3110fa9

Please sign in to comment.