diff --git a/tests/APILengthCoDecTest.php b/tests/APILengthCoDecTest.php index d26870c..5b59514 100644 --- a/tests/APILengthCoDecTest.php +++ b/tests/APILengthCoDecTest.php @@ -46,7 +46,7 @@ class APILengthCoDecTest extends TestCase public function encodedLengthProvider(): array { // [encoded length value, length value] - $default = [ + $result = [ [0, 0], // Low limit value for 1 byte encoded length [0x39, 0x39], // Arbitrary median value for 1 byte encoded length [0x7f, 0x7F], // High limit value for 1 byte encoded length @@ -64,17 +64,13 @@ class APILengthCoDecTest extends TestCase [0xEFFFFFFF, 0xFFFFFFF], // High limit value for 4 bytes encoded length ]; - if (PHP_INT_SIZE < 8) { - return $default; + if (PHP_INT_SIZE > 4) { + $result[] = [0xF010000000, 0x10000000]; // Low limit value for 5 bytes encoded length + $result[] = [0xF10D4EF9C3, 0x10D4EF9C3]; // Arbitrary median value for 5 bytes encoded length + $result[] = [0xF7FFFFFFFF, 0x7FFFFFFFF]; // High limit value for 5 bytes encoded length } - $append = [ - [0xF010000000, 0x10000000], // Low limit value for 5 bytes encoded length - [0xF10D4EF9C3, 0x10D4EF9C3], // Arbitrary median value for 5 bytes encoded length - [0xF7FFFFFFFF, 0x7FFFFFFFF], // High limit value for 5 bytes encoded length - ]; - - return array_merge($default, $append); + return $result; } /** diff --git a/tests/Helpers/BinaryStringHelperTest.php b/tests/Helpers/BinaryStringHelperTest.php index df12129..014f17a 100644 --- a/tests/Helpers/BinaryStringHelperTest.php +++ b/tests/Helpers/BinaryStringHelperTest.php @@ -24,7 +24,7 @@ class BinaryStringHelperTest extends TestCase public function IntegerToNBOBinaryStringProvider(): array { - $default = [ + $result = [ [0, chr(0)], // lower boundary value [0xFFFFFFFF, chr(0xFF) . chr(0xFF) . chr(0xFF) . chr(0xFF)], // 32 bits maximal value @@ -38,16 +38,12 @@ class BinaryStringHelperTest extends TestCase [0x390DDD99, chr(0x39) . chr(0x0D) . chr(0xDD) . chr(0x99)], ]; - if (PHP_INT_SIZE < 8) { - return $default; - } - - $append = [ + if (PHP_INT_SIZE > 4) { // -1 is encoded with 0xFFFFFFF..... // 64 bits maximal value (on a 64 bits system only) - [-1, chr(0xFF) . chr(0xFF) . chr(0xFF) . chr(0xFF) . chr(0xFF) . chr(0xFF) . chr(0xFF) . chr(0xFF)], // 64 bits upper boundary value - ]; + $result[] = [-1, chr(0xFF) . chr(0xFF) . chr(0xFF) . chr(0xFF) . chr(0xFF) . chr(0xFF) . chr(0xFF) . chr(0xFF)]; // 64 bits upper boundary value + } - return array_merge($default, $append); + return $result; } }