1 // Copyright 2020 Blue Static <https://www.bluestatic.org>
2 // This program is free software licensed under the GNU General Public License,
3 // version 3.0. The full text of the license can be found in LICENSE.txt.
4 // SPDX-License-Identifier: GPL-3.0-only
6 import { clampToZero, undefinedToZero } from './Math';
8 test('clamp to zero', () => {
9 expect(clampToZero(100)).toBe(100);
10 expect(clampToZero(-100)).toBe(0);
11 expect(clampToZero(0)).toBe(0);
14 test('undefiend to zero', () => {
15 expect(undefinedToZero(undefined)).toBe(0);
16 expect(undefinedToZero(100)).toBe(100);