/** * @license * Copyright 2022, JsData. All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * 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. * ========================================================================== */ import { Tensor, TensorLike } from './types'; declare global { namespace jest { interface Matchers { /** * Tests whether or not every entry of a Tensor(Like) is close * to the corresponding entry of an expected tensor. * * @param expected The expected result tensor. * @param params Tolerance and broadcast settings. `{broadcast: false}` disallows * broadcasting, i.e. the result tensor must have the same shape as * the expected tensor. `{rtol, atol}` are the relative and absolute * tolerance parameter. Two entries `x` and `y` are considered equal * iff `|x-y| <= max(|x|, |y|)*rtol + atol`. Set `{rtol: 0, atol: 0}` * for exact equality. */ toBeAllCloseTo: T extends Tensor | TensorLike ? (expected: Tensor | TensorLike, params?: { rtol?: number; atol?: number; broadcast?: boolean; allowEmpty?: boolean; }) => R : undefined; /** * Tests whether or not every entry of a Tensor(Like) is less than or close * to the corresponding entry of an expected tensor. * * @param expected The expected result tensor. * @param params Tolerance and broadcast settings. `{broadcast: false}` disallows * broadcasting, i.e. the result tensor must have the same shape as * the expected tensor. `{rtol, atol}` are the relative and absolute * tolerance parameter. Two entries `x` and `y` are considered equal * iff `x-y <= max(|x|, |y|)*rtol + atol`. Set `{rtol: 0, atol: 0}` * for exact equality. */ toBeAllLessOrClose: T extends Tensor | TensorLike ? (expected: Tensor | TensorLike, params?: { rtol?: number; atol?: number; broadcast?: boolean; allowEmpty?: boolean; }) => R : undefined; /** * Tests whether or not every entry of a Tensor(Like) is greater than or close * to the corresponding entry of an expected tensor. * * @param expected The expected result tensor. * @param params Tolerance and broadcast settings. `{broadcast: false}` disallows * broadcasting, i.e. the result tensor must have the same shape as * the expected tensor. `{rtol, atol}` are the relative and absolute * tolerance parameter. Two entries `x` and `y` are considered equal * iff `x-y >= -max(|x|, |y|)*rtol - atol`. Set `{rtol: 0, atol: 0}` * for exact equality. */ toBeAllGreaterOrClose: T extends Tensor | TensorLike ? (expected: Tensor | TensorLike, params?: { rtol?: number; atol?: number; broadcast?: boolean; allowEmpty?: boolean; }) => R : undefined; /** * Tests whether or not every entry of a Tensor(Like) is sufficiently less than * the corresponding entry of an expected tensor. * * @param expected The expected result tensor. * @param params Tolerance and broadcast settings. `{broadcast: false}` disallows * broadcasting, i.e. the result tensor must have the same shape as * the expected tensor. `{rtol, atol}` are the relative and absolute * tolerance parameter. Two entries `x` and `y` are considered equal * iff `x-y < -max(|x|, |y|)*rtol - atol`. Set `{rtol: 0, atol: 0}` * for exact equality. */ toBeAllLessNotClose: T extends Tensor | TensorLike ? (expected: Tensor | TensorLike, params?: { rtol?: number; atol?: number; broadcast?: boolean; allowEmpty?: boolean; }) => R : undefined; /** * Tests whether or not every entry of a Tensor(Like) is sufficiently greater than * the corresponding entry of an expected tensor. * * @param expected The expected result tensor. * @param params Tolerance and broadcast settings. `{broadcast: false}` disallows * broadcasting, i.e. the result tensor must have the same shape as * the expected tensor. `{rtol, atol}` are the relative and absolute * tolerance parameter. Two entries `x` and `y` are considered equal * iff `x-y > max(|x|, |y|)*rtol + atol`. Set `{rtol: 0, atol: 0}` * for exact equality. */ toBeAllGreaterNotClose: T extends Tensor | TensorLike ? (expected: Tensor | TensorLike, params?: { rtol?: number; atol?: number; broadcast?: boolean; allowEmpty?: boolean; }) => R : undefined; } } } export declare function toBeAll(this: { isNot: boolean; }, result: TensorLike | Tensor, expect: TensorLike | Tensor, { broadcast, allowEmpty }: { broadcast?: boolean | undefined; allowEmpty?: boolean | undefined; }, description: string, match: (x: number, y: number) => boolean): { message: () => string; pass: boolean; }; export declare function toBeAllCloseTo(this: { isNot: boolean; }, result: TensorLike | Tensor, expect: TensorLike | Tensor, params?: { rtol?: number; atol?: number; broadcast?: boolean; }): { message: () => string; pass: boolean; }; export declare function toBeAllLessOrClose(this: { isNot: boolean; }, result: TensorLike | Tensor, expect: TensorLike | Tensor, params?: { rtol?: number; atol?: number; broadcast?: boolean; }): { message: () => string; pass: boolean; }; export declare function toBeAllGreaterOrClose(this: { isNot: boolean; }, result: TensorLike | Tensor, expect: TensorLike | Tensor, params?: { rtol?: number; atol?: number; broadcast?: boolean; }): { message: () => string; pass: boolean; }; export declare function toBeAllLessNotClose(this: { isNot: boolean; }, result: TensorLike | Tensor, expect: TensorLike | Tensor, params?: { rtol?: number; atol?: number; broadcast?: boolean; }): { message: () => string; pass: boolean; }; export declare function toBeAllGreaterNotClose(this: { isNot: boolean; }, result: TensorLike | Tensor, expect: TensorLike | Tensor, params?: { rtol?: number; atol?: number; broadcast?: boolean; }): { message: () => string; pass: boolean; };