@stdlib/types
Advanced tools
Comparing version 0.3.2 to 0.4.0
{ | ||
"name": "@stdlib/types", | ||
"version": "0.3.2", | ||
"version": "0.4.0", | ||
"description": "stdlib TypeScript type declarations.", | ||
@@ -5,0 +5,0 @@ "license": "Apache-2.0", |
@@ -188,4 +188,4 @@ <!-- | ||
[test-image]: https://github.com/stdlib-js/types/actions/workflows/test.yml/badge.svg?branch=v0.3.2 | ||
[test-url]: https://github.com/stdlib-js/types/actions/workflows/test.yml?query=branch:v0.3.2 | ||
[test-image]: https://github.com/stdlib-js/types/actions/workflows/test.yml/badge.svg?branch=v0.4.0 | ||
[test-url]: https://github.com/stdlib-js/types/actions/workflows/test.yml?query=branch:v0.4.0 | ||
@@ -192,0 +192,0 @@ [coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/types/main.svg |
121
test.ts
@@ -22,6 +22,7 @@ /* | ||
import * as array from '@stdlib/types/array'; | ||
import * as blas from '@stdlib/types/blas'; | ||
import * as complex from '@stdlib/types/complex'; | ||
import * as iter from '@stdlib/types/iter'; | ||
import * as ndarray from '@stdlib/types/ndarray'; | ||
import * as obj from '@stdlib/types/object'; | ||
import * as complex from '@stdlib/types/complex'; | ||
import * as random from '@stdlib/types/random'; | ||
@@ -108,2 +109,25 @@ import * as slice from '@stdlib/types/slice'; | ||
/** | ||
* Returns a boolean array-like object. | ||
* | ||
* @returns boolean array-like object | ||
*/ | ||
function boolArray(): array.BooleanArrayLike { | ||
const buf: array.TypedArray = new Uint8Array( 8 ); | ||
const obj: array.BooleanArrayLike = { | ||
'byteLength': 8, | ||
'byteOffset': 0, | ||
'BYTES_PER_ELEMENT': 1, | ||
'length': 8, | ||
'get': ( i: number ): boolean => { | ||
return Boolean( buf[ i ] ); | ||
}, | ||
'set': ( value: boolean, i?: number ) => { | ||
i = ( i ) ? i : 0; | ||
buf[ i ] = ( buf[ i ] ) ? 1 : 0; | ||
} | ||
}; | ||
return obj; | ||
} | ||
/** | ||
* Returns a complex number array-like object. | ||
@@ -366,4 +390,68 @@ * | ||
} | ||
const v33: array.BooleanArrayLike = boolArray(); | ||
if ( v33.byteOffset !== 0 ) { | ||
throw new Error( 'something went wrong' ); | ||
} | ||
} | ||
// The compiler should not throw an error when using BLAS types... | ||
{ | ||
const v1: blas.Layout = 'row-major'; | ||
if ( typeof v1 !== 'string' ) { | ||
throw new Error( 'something went wrong' ); | ||
} | ||
const v2: blas.TransposeOperation = 'transpose'; | ||
if ( typeof v2 !== 'string' ) { | ||
throw new Error( 'something went wrong' ); | ||
} | ||
const v3: blas.MatrixTriangle = 'upper'; | ||
if ( typeof v3 !== 'string' ) { | ||
throw new Error( 'something went wrong' ); | ||
} | ||
const v4: blas.DiagonalType = 'unit'; | ||
if ( typeof v4 !== 'string' ) { | ||
throw new Error( 'something went wrong' ); | ||
} | ||
const v5: blas.OperationSide = 'right'; | ||
if ( typeof v5 !== 'string' ) { | ||
throw new Error( 'something went wrong' ); | ||
} | ||
} | ||
// The compiler should not throw an error when using complex number types... | ||
{ | ||
const v1: complex.ComplexLike = { | ||
're': 1.0, | ||
'im': 1.0 | ||
}; | ||
if ( v1.re !== 1.0 ) { | ||
throw new Error( 'something went wrong' ); | ||
} | ||
const v2: complex.Complex64 = { | ||
're': 1.0, | ||
'im': 1.0, | ||
'byteLength': 8, | ||
'BYTES_PER_ELEMENT': 4 | ||
}; | ||
if ( v2.re !== 1.0 ) { | ||
throw new Error( 'something went wrong' ); | ||
} | ||
const v3: complex.Complex128 = { | ||
're': 1.0, | ||
'im': 1.0, | ||
'byteLength': 16, | ||
'BYTES_PER_ELEMENT': 8 | ||
}; | ||
if ( v3.re !== 1.0 ) { | ||
throw new Error( 'something went wrong' ); | ||
} | ||
} | ||
// The compiler should not throw an error when using iterator or iterable types... | ||
@@ -548,33 +636,2 @@ { | ||
// The compiler should not throw an error when using complex number types... | ||
{ | ||
const v1: complex.ComplexLike = { | ||
're': 1.0, | ||
'im': 1.0 | ||
}; | ||
if ( v1.re !== 1.0 ) { | ||
throw new Error( 'something went wrong' ); | ||
} | ||
const v2: complex.Complex64 = { | ||
're': 1.0, | ||
'im': 1.0, | ||
'byteLength': 8, | ||
'BYTES_PER_ELEMENT': 4 | ||
}; | ||
if ( v2.re !== 1.0 ) { | ||
throw new Error( 'something went wrong' ); | ||
} | ||
const v3: complex.Complex128 = { | ||
're': 1.0, | ||
'im': 1.0, | ||
'byteLength': 16, | ||
'BYTES_PER_ELEMENT': 8 | ||
}; | ||
if ( v3.re !== 1.0 ) { | ||
throw new Error( 'something went wrong' ); | ||
} | ||
} | ||
// The compiler should not throw an error when using PRNG types... | ||
@@ -581,0 +638,0 @@ { |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
127279
4140
1
80