From 689120a476bcd7394b9c2c006eec2946f52a4008 Mon Sep 17 00:00:00 2001 From: Richard van Velzen Date: Mon, 8 Oct 2018 12:25:07 +0200 Subject: [PATCH] Add tests for 0.0/-0.0 in Map and Set --- tests/Map/put.php | 5 +++++ tests/Set/add.php | 3 +++ 2 files changed, 8 insertions(+) diff --git a/tests/Map/put.php b/tests/Map/put.php index c09a9f1..cf2eb8c 100644 --- a/tests/Map/put.php +++ b/tests/Map/put.php @@ -31,6 +31,11 @@ public function putDataProvider() [[null, null], [null, null]], [[null, null]] ], + [ + // Test that -0.0 and 0.0 map to the same key + [[-0.0, -0.0], [0.0, 0.0]], + [[-0.0, 0.0]], + ] ]; } diff --git a/tests/Set/add.php b/tests/Set/add.php index c114079..ad33190 100644 --- a/tests/Set/add.php +++ b/tests/Set/add.php @@ -23,6 +23,9 @@ public function addDataProvider() [['1'], [ 1 ], ['1', 1 ]], [[ 1 ], ['1'], [ 1, '1']], + // Test that 0.0 and -0.0 are treated as the same value + [[], [0.0, -0.0], [0.0]], + // Test adding sample values to empty set adds all. [[], $unique, $unique],