File "approximatelyEqual.test.ts"

Full path: /home/fsibplc/public_html/sommilito-bank2/splide-4.1.3/src/js/utils/math/approximatelyEqual/approximatelyEqual.test.ts
File size: 600 B (600 B bytes)
MIME-type: text/x-java
Charset: utf-8

Download   Open   Edit   Advanced Editor   Back

import { approximatelyEqual } from './approximatelyEqual';


describe( 'approximatelyEqual', () => {
  test( 'can tell if 2 numbers are approximately equal or not.', () => {
    expect( approximatelyEqual( 1, 1, 1 ) ).toBe( true );
    expect( approximatelyEqual( 1, 0.9, 1 ) ).toBe( true );
    expect( approximatelyEqual( 1, 1.9, 1 ) ).toBe( true );

    expect( approximatelyEqual( 1, 2, 1 ) ).toBe( false );
    expect( approximatelyEqual( 1, 0, 1 ) ).toBe( false );

    expect( approximatelyEqual( 1, 2, 2 ) ).toBe( true );
    expect( approximatelyEqual( 1, 0, 2 ) ).toBe( true );
  } );
} );