WordPress.org

Make WordPress Core

Changeset 39265


Ignore:
Timestamp:
11/16/16 13:14:44 (5 months ago)
Author:
SergeyBiryukov
Message:

Tests: Use assertEquals()' native functionality for delta comparison in test_wp_convert_bytes_to_hr().

See #23626.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/media.php

    r38858 r39265  
    293293        // now some values around 
    294294        $hr = wp_convert_bytes_to_hr( $tb + $tb / 2 + $mb ); 
    295         $this->assertTrue( abs( 1.50000095367 - (float) str_replace( ',', '.', $hr ) ) < 0.0001 ); 
     295        $this->assertEquals( 1.50000095367, (float) str_replace( ',', '.', $hr ), 0.0001 ); 
    296296 
    297297        $hr = wp_convert_bytes_to_hr( $tb - $mb - $kb ); 
    298         $this->assertTrue( abs( 1023.99902248 - (float) str_replace( ',', '.', $hr ) ) < 0.0001 ); 
     298        $this->assertEquals( 1023.99902248, (float) str_replace( ',', '.', $hr ), 0.0001 ); 
    299299 
    300300        $hr = wp_convert_bytes_to_hr( $gb + $gb / 2 + $mb ); 
    301         $this->assertTrue( abs( 1.5009765625 - (float) str_replace( ',', '.', $hr ) ) < 0.0001 ); 
     301        $this->assertEquals( 1.5009765625, (float) str_replace( ',', '.', $hr ), 0.0001 ); 
    302302 
    303303        $hr = wp_convert_bytes_to_hr( $gb - $mb - $kb ); 
    304         $this->assertTrue( abs( 1022.99902344 - (float) str_replace( ',', '.', $hr ) ) < 0.0001 ); 
     304        $this->assertEquals( 1022.99902344, (float) str_replace( ',', '.', $hr ), 0.0001 ); 
    305305 
    306306        // edge 
Note: See TracChangeset for help on using the changeset viewer.