/*
* @license Apache-2.0
*
* Copyright (c) 2026 The Stdlib Authors.
*
* 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.
*/
/* eslint-disable space-in-parens */
///
import zeros = require( './../../../../zeros' );
import tile = require( './index' );
// TESTS //
// The function returns an ndarray having the same type as the input ndarray...
{
tile( zeros( [ 2, 2 ], { 'dtype': 'float64' } ), [ 2, 2 ] ); // $ExpectType float64ndarray
tile( zeros( [ 2, 2 ], { 'dtype': 'float32' } ), [ 2, 2 ] ); // $ExpectType float32ndarray
tile( zeros( [ 2, 2 ], { 'dtype': 'complex128' } ), [ 2, 2 ] ); // $ExpectType complex128ndarray
tile( zeros( [ 2, 2 ], { 'dtype': 'complex64' } ), [ 2, 2 ] ); // $ExpectType complex64ndarray
tile( zeros( [ 2, 2 ], { 'dtype': 'int32' } ), [ 2, 2 ] ); // $ExpectType int32ndarray
tile( zeros( [ 2, 2 ], { 'dtype': 'int16' } ), [ 2, 2 ] ); // $ExpectType int16ndarray
tile( zeros( [ 2, 2 ], { 'dtype': 'int8' } ), [ 2, 2 ] ); // $ExpectType int8ndarray
tile( zeros( [ 2, 2 ], { 'dtype': 'uint32' } ), [ 2, 2 ] ); // $ExpectType uint32ndarray
tile( zeros( [ 2, 2 ], { 'dtype': 'uint16' } ), [ 2, 2 ] ); // $ExpectType uint16ndarray
tile( zeros( [ 2, 2 ], { 'dtype': 'uint8' } ), [ 2, 2 ] ); // $ExpectType uint8ndarray
tile( zeros( [ 2, 2 ], { 'dtype': 'uint8c' } ), [ 2, 2 ] ); // $ExpectType uint8cndarray
tile( zeros( [ 2, 2 ], { 'dtype': 'generic' } ), [ 2, 2 ] ); // $ExpectType genericndarray
}
// The compiler throws an error if the function is not provided a first argument which is an ndarray...
{
tile( '5', [ 2, 2, 2 ] ); // $ExpectError
tile( 5, [ 2, 2, 2 ] ); // $ExpectError
tile( true, [ 2, 2, 2 ] ); // $ExpectError
tile( false, [ 2, 2, 2 ] ); // $ExpectError
tile( null, [ 2, 2, 2 ] ); // $ExpectError
tile( {}, [ 2, 2, 2 ] ); // $ExpectError
tile( [ '5' ], [ 2, 2, 2 ] ); // $ExpectError
tile( ( x: number ): number => x, [ 2, 2, 2 ] ); // $ExpectError
}
// The compiler throws an error if the function is not provided a second argument which is an array-like object containing numbers...
{
const x = zeros( [ 2, 2 ], {
'dtype': 'float64'
});
tile( x, '5' ); // $ExpectError
tile( x, 5 ); // $ExpectError
tile( x, true ); // $ExpectError
tile( x, false ); // $ExpectError
tile( x, null ); // $ExpectError
tile( x, {} ); // $ExpectError
tile( x, [ '5' ] ); // $ExpectError
tile( x, ( x: number ): number => x ); // $ExpectError
}
// The compiler throws an error if the function is provided an unsupported number of arguments...
{
const x = zeros( [ 2, 2 ], {
'dtype': 'float64'
});
tile(); // $ExpectError
tile( x ); // $ExpectError
tile( x, [ 1, 2, 3 ], [ 2, 3 ] ); // $ExpectError
}