@@ -1308,24 +1308,6 @@ void testLang381() {
13081308 assertTrue (Float .isNaN (NumberUtils .max (bF )));
13091309 }
13101310
1311- @ Test
1312- void testMinMaxSignedZero () {
1313- // The varargs overloads must agree with Math.min/Math.max (and the three-argument
1314- // overloads, which delegate to them) on the sign of zero. -0.0 is distinct from 0.0,
1315- // e.g. 1 / -0.0 is -Infinity, so the raw bits are asserted here.
1316- assertEquals (Double .doubleToRawLongBits (0.0d ), Double .doubleToRawLongBits (NumberUtils .max (-0.0d , 0.0d )));
1317- assertEquals (Double .doubleToRawLongBits (0.0d ), Double .doubleToRawLongBits (NumberUtils .max (0.0d , -0.0d )));
1318- assertEquals (Double .doubleToRawLongBits (-0.0d ), Double .doubleToRawLongBits (NumberUtils .min (-0.0d , 0.0d )));
1319- assertEquals (Double .doubleToRawLongBits (-0.0d ), Double .doubleToRawLongBits (NumberUtils .min (0.0d , -0.0d )));
1320- assertEquals (Float .floatToRawIntBits (0.0f ), Float .floatToRawIntBits (NumberUtils .max (-0.0f , 0.0f )));
1321- assertEquals (Float .floatToRawIntBits (0.0f ), Float .floatToRawIntBits (NumberUtils .max (0.0f , -0.0f )));
1322- assertEquals (Float .floatToRawIntBits (-0.0f ), Float .floatToRawIntBits (NumberUtils .min (-0.0f , 0.0f )));
1323- assertEquals (Float .floatToRawIntBits (-0.0f ), Float .floatToRawIntBits (NumberUtils .min (0.0f , -0.0f )));
1324- // the varargs result matches the three-argument overload
1325- assertEquals (Double .doubleToRawLongBits (NumberUtils .max (-0.0d , 0.0d , 0.0d )), Double .doubleToRawLongBits (NumberUtils .max (-0.0d , 0.0d )));
1326- assertEquals (Double .doubleToRawLongBits (NumberUtils .min (0.0d , -0.0d , 0.0d )), Double .doubleToRawLongBits (NumberUtils .min (0.0d , -0.0d )));
1327- }
1328-
13291311 @ Test
13301312 void testLang747 () {
13311313 assertEquals (Integer .valueOf (0x8000 ), NumberUtils .createNumber ("0x8000" ));
@@ -1718,6 +1700,24 @@ void testMinLong_nullArray() {
17181700 assertNullPointerException (() -> NumberUtils .min ((long []) null ));
17191701 }
17201702
1703+ @ Test
1704+ void testMinMaxSignedZero () {
1705+ // The varargs overloads must agree with Math.min/Math.max (and the three-argument
1706+ // overloads, which delegate to them) on the sign of zero. -0.0 is distinct from 0.0,
1707+ // e.g. 1 / -0.0 is -Infinity, so the raw bits are asserted here.
1708+ assertEquals (Double .doubleToRawLongBits (0.0d ), Double .doubleToRawLongBits (NumberUtils .max (-0.0d , 0.0d )));
1709+ assertEquals (Double .doubleToRawLongBits (0.0d ), Double .doubleToRawLongBits (NumberUtils .max (0.0d , -0.0d )));
1710+ assertEquals (Double .doubleToRawLongBits (-0.0d ), Double .doubleToRawLongBits (NumberUtils .min (-0.0d , 0.0d )));
1711+ assertEquals (Double .doubleToRawLongBits (-0.0d ), Double .doubleToRawLongBits (NumberUtils .min (0.0d , -0.0d )));
1712+ assertEquals (Float .floatToRawIntBits (0.0f ), Float .floatToRawIntBits (NumberUtils .max (-0.0f , 0.0f )));
1713+ assertEquals (Float .floatToRawIntBits (0.0f ), Float .floatToRawIntBits (NumberUtils .max (0.0f , -0.0f )));
1714+ assertEquals (Float .floatToRawIntBits (-0.0f ), Float .floatToRawIntBits (NumberUtils .min (-0.0f , 0.0f )));
1715+ assertEquals (Float .floatToRawIntBits (-0.0f ), Float .floatToRawIntBits (NumberUtils .min (0.0f , -0.0f )));
1716+ // the varargs result matches the three-argument overload
1717+ assertEquals (Double .doubleToRawLongBits (NumberUtils .max (-0.0d , 0.0d , 0.0d )), Double .doubleToRawLongBits (NumberUtils .max (-0.0d , 0.0d )));
1718+ assertEquals (Double .doubleToRawLongBits (NumberUtils .min (0.0d , -0.0d , 0.0d )), Double .doubleToRawLongBits (NumberUtils .min (0.0d , -0.0d )));
1719+ }
1720+
17211721 @ Test
17221722 void testMinShort () {
17231723 assertEquals ((short ) 5 , NumberUtils .min ((short ) 5 ), "min(short[]) failed for array length 1" );
0 commit comments