From 701b2d23f2d2d12b9755886aa9bd6e53fed9ae0e Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Wed, 16 Nov 2016 13:14:44 +0000 Subject: [PATCH] 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 --- tests/phpunit/tests/media.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/phpunit/tests/media.php b/tests/phpunit/tests/media.php index 48999301ea..62f011e3dd 100644 --- a/tests/phpunit/tests/media.php +++ b/tests/phpunit/tests/media.php @@ -292,16 +292,16 @@ https://w.org' // 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 ) );