Skip to content

Remove usage of float keys in arrays tests #6662

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
341 changes: 199 additions & 142 deletions ext/standard/tests/array/005.phpt

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion ext/standard/tests/array/009.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ $varient_arrays = array (
array(NULL),// array with NULL
array(null),// array with null
array(NULL, true, null, "", 1), // mixed array
array(-1.5 => "test", -2 => "rest", 2.5 => "two",
array(-1 => "test", -2 => "rest", 2 => "two",
"" => "string", 0 => "zero", "" => "" ) // mixed array
);

Expand Down
48 changes: 9 additions & 39 deletions ext/standard/tests/array/array_change_key_case_variation3.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,6 @@ $inputs = array(
-2345 => 'negative',
),

// float data
/*2*/ 'float' => array(
10.5 => 'positive',
-10.5 => 'negative',
.5 => 'half',
),

'extreme floats' => array(
12.3456789000e6 => 'large',
12.3456789000E-10 => 'small',
),

// null data
/*3*/ 'null uppercase' => array(
NULL => 'null 1',
Expand Down Expand Up @@ -110,65 +98,47 @@ array(4) {
string(8) "negative"
}

-- Iteration 2 : float data --
array(3) {
[10]=>
string(8) "positive"
[-10]=>
string(8) "negative"
[0]=>
string(4) "half"
}

-- Iteration 3 : extreme floats data --
array(2) {
[12345678]=>
string(5) "large"
[0]=>
string(5) "small"
}

-- Iteration 4 : null uppercase data --
-- Iteration 2 : null uppercase data --
array(1) {
[""]=>
string(6) "null 1"
}

-- Iteration 5 : null lowercase data --
-- Iteration 3 : null lowercase data --
array(1) {
[""]=>
string(6) "null 2"
}

-- Iteration 6 : bool lowercase data --
-- Iteration 4 : bool lowercase data --
array(2) {
[1]=>
string(6) "lowert"
[0]=>
string(6) "lowerf"
}

-- Iteration 7 : bool uppercase data --
-- Iteration 5 : bool uppercase data --
array(2) {
[1]=>
string(6) "uppert"
[0]=>
string(6) "upperf"
}

-- Iteration 8 : empty double quotes data --
-- Iteration 6 : empty double quotes data --
array(1) {
[""]=>
string(6) "emptyd"
}

-- Iteration 9 : empty single quotes data --
-- Iteration 7 : empty single quotes data --
array(1) {
[""]=>
string(6) "emptys"
}

-- Iteration 10 : string data --
-- Iteration 8 : string data --
array(3) {
["STRINGD"]=>
string(7) "stringd"
Expand All @@ -178,13 +148,13 @@ array(3) {
string(7) "stringh"
}

-- Iteration 11 : undefined data --
-- Iteration 9 : undefined data --
array(1) {
[""]=>
string(9) "undefined"
}

-- Iteration 12 : unset data --
-- Iteration 10 : unset data --
array(1) {
[""]=>
string(5) "unset"
Expand Down
4 changes: 2 additions & 2 deletions ext/standard/tests/array/array_chunk_variation5.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ echo "*** Testing array_chunk() : usage variations ***\n";
$input_array = array(1, 2, 3);

// different magnitude's
$sizes = array(-1, count($input_array) + 1, 0, 1.5);
$sizes = array(-1, count($input_array) + 1, 0, 1);

// loop through the array for size argument
foreach ($sizes as $size){
Expand Down Expand Up @@ -86,7 +86,7 @@ array_chunk(): Argument #2 ($length) must be greater than 0
array_chunk(): Argument #2 ($length) must be greater than 0
array_chunk(): Argument #2 ($length) must be greater than 0

-- Testing array_chunk() when size = 1.5 --
-- Testing array_chunk() when size = 1 --
array(3) {
[0]=>
array(1) {
Expand Down
30 changes: 4 additions & 26 deletions ext/standard/tests/array/array_combine_variation4.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,6 @@ $arrays = array (
array(1 => "1"),
array(1 => "1", 2 => "2", 3 => "3", 4 => "4"),

// arrays with float keys
/*5*/ array(2.3333 => "float"),
array(1.2 => "f1", 3.33 => "f2",
4.89999922839999 => "f3",
33333333.333333 => "f4"),

// arrays with string keys
/*7*/ array('\tHello' => 111, 're\td' => "color",
'\v\fworld' => 2.2, 'pen\n' => 33),
Expand Down Expand Up @@ -112,22 +106,6 @@ array(4) {
string(1) "4"
}
-- Iteration 5 --
array(1) {
["float"]=>
string(5) "float"
}
-- Iteration 6 --
array(4) {
["f1"]=>
string(2) "f1"
["f2"]=>
string(2) "f2"
["f3"]=>
string(2) "f3"
["f4"]=>
string(2) "f4"
}
-- Iteration 7 --
array(4) {
[111]=>
int(111)
Expand All @@ -138,7 +116,7 @@ array(4) {
[33]=>
int(33)
}
-- Iteration 8 --
-- Iteration 6 --
array(4) {
[111]=>
int(111)
Expand All @@ -149,21 +127,21 @@ array(4) {
[33]=>
int(33)
}
-- Iteration 9 --
-- Iteration 7 --
array(2) {
["hello"]=>
string(5) "hello"
["string"]=>
string(6) "string"
}
-- Iteration 10 --
-- Iteration 8 --
array(2) {
["hello"]=>
string(5) "hello"
["resource"]=>
string(8) "resource"
}
-- Iteration 11 --
-- Iteration 9 --
array(7) {
[1]=>
int(1)
Expand Down
4 changes: 2 additions & 2 deletions ext/standard/tests/array/array_combine_variation5.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ $arrays = array (
array("f1" => 1.2, 'f2' => 3.33, 3 => 4.89999922839999, 'f4' => 33333333.333),

// arrays with string values
/*7*/ array(111 => "\tHello", "red" => "col\tor", 2 => "\v\fworld", 3.3 => "pen\n"),
array(111 => '\tHello', "red" => 'col\tor', 2 => '\v\fworld', 3.3 => 'pen\n'),
/*7*/ array(111 => "\tHello", "red" => "col\tor", 2 => "\v\fworld", 3 => "pen\n"),
array(111 => '\tHello', "red" => 'col\tor', 2 => '\v\fworld', 3 => 'pen\n'),
array(1 => "hello", "heredoc" => $heredoc),

// array with object, unset variable and resource variable
Expand Down
29 changes: 6 additions & 23 deletions ext/standard/tests/array/array_diff_assoc_variation4.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,6 @@ $inputs = array(
12345 => 'positive',
-2345 => 'negative'),

// float data
/*2*/
'float' => array(
10.5 => 'float 1',
-10.5 => 'float 2',
.5 => 'float 3'),

// null data
/*3*/
'null' => array(
Expand Down Expand Up @@ -109,58 +102,48 @@ array(4) {
}

-- Iteration 2 --
array(3) {
[10]=>
string(7) "float 1"
[-10]=>
string(7) "float 2"
[0]=>
string(7) "float 3"
}

-- Iteration 3 --
array(1) {
[""]=>
string(6) "null 2"
}

-- Iteration 4 --
-- Iteration 3 --
array(2) {
[1]=>
string(5) "boolT"
[0]=>
string(5) "boolF"
}

-- Iteration 5 --
-- Iteration 4 --
array(1) {
[""]=>
string(6) "emptys"
}

-- Iteration 6 --
-- Iteration 5 --
array(2) {
["string"]=>
string(7) "strings"
["hello world"]=>
string(7) "stringh"
}

-- Iteration 7 --
-- Iteration 6 --
array(2) {
["binary1"]=>
string(8) "binary 1"
["binary2"]=>
string(8) "binary 2"
}

-- Iteration 8 --
-- Iteration 7 --
array(1) {
[""]=>
string(9) "undefined"
}

-- Iteration 9 --
-- Iteration 8 --
array(1) {
[""]=>
string(5) "unset"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Test array_diff_assoc() function : usage variations - compare integers, floats a

echo "*** Testing array_diff_assoc() : usage variations ***\n";
$arr_default_int = array(1, 2, 3, 'a');
$arr_float = array(0 => 1.00, 1.00 => 2.00, 2.00 => 3.00, 'b');
$arr_float = array(0 => 1.00, 1 => 2.00, 2 => 3.00, 'b');
$arr_string = array('1', '2', '3', 'c');
$arr_string_float = array('0' => '1.00', '1.00' => '2.00', '2.00' => '3.00', 'd');

Expand Down
27 changes: 0 additions & 27 deletions ext/standard/tests/array/array_diff_key_variation5.phpt

This file was deleted.

39 changes: 0 additions & 39 deletions ext/standard/tests/array/array_diff_uassoc_variation10.phpt

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ echo "*** Testing array_diff_uassoc() : usage variation ***\n";

//Initialize variables
$arr_default_int = array(1, 2, 3, 4);
$arr_float = array(0 => 1.00, 1.00 => 2.00, 2.00 => 3.00, 3.00 => 4.00);
$arr_float = array(0 => 1.00, 1 => 2.00, 2 => 3.00, 3 => 4.00);


function key_compare_func($key1, $key2)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Test array_diff_uassoc() function : usage variation - Comparing floating points
echo "*** Testing array_diff_uassoc() : usage variation ***\n";

//Initialize variables
$arr_float = array(0 => 1.00, 1.00 => 2.00);
$arr_float = array(0 => 1.00, 1 => 2.00);
$arr_string_int = array('1', '2');
$arr_string_float = array('0' => '1.00', '1.00' => '2.00');

Expand Down
Loading