Tests: Use assertEquals()
' native functionality for delta comparison in test_wp_convert_bytes_to_hr()
.
See #23626. git-svn-id: https://develop.svn.wordpress.org/trunk@39265 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
9421418577
commit
701b2d23f2
@ -292,16 +292,16 @@ https://w.org</a>'
|
||||
|
||||
// now some values around
|
||||
$hr = wp_convert_bytes_to_hr( $tb + $tb / 2 + $mb );
|
||||
$this->assertTrue( abs( 1.50000095367 - (float) str_replace( ',', '.', $hr ) ) < 0.0001 );
|
||||
$this->assertEquals( 1.50000095367, (float) str_replace( ',', '.', $hr ), 0.0001 );
|
||||
|
||||
$hr = wp_convert_bytes_to_hr( $tb - $mb - $kb );
|
||||
$this->assertTrue( abs( 1023.99902248 - (float) str_replace( ',', '.', $hr ) ) < 0.0001 );
|
||||
$this->assertEquals( 1023.99902248, (float) str_replace( ',', '.', $hr ), 0.0001 );
|
||||
|
||||
$hr = wp_convert_bytes_to_hr( $gb + $gb / 2 + $mb );
|
||||
$this->assertTrue( abs( 1.5009765625 - (float) str_replace( ',', '.', $hr ) ) < 0.0001 );
|
||||
$this->assertEquals( 1.5009765625, (float) str_replace( ',', '.', $hr ), 0.0001 );
|
||||
|
||||
$hr = wp_convert_bytes_to_hr( $gb - $mb - $kb );
|
||||
$this->assertTrue( abs( 1022.99902344 - (float) str_replace( ',', '.', $hr ) ) < 0.0001 );
|
||||
$this->assertEquals( 1022.99902344, (float) str_replace( ',', '.', $hr ), 0.0001 );
|
||||
|
||||
// edge
|
||||
$this->assertEquals( '-1B', wp_convert_bytes_to_hr( -1 ) );
|
||||
|
Loading…
Reference in New Issue
Block a user