Lines Matching refs:floats
39 * Unit test for {@link Floats}.
61 = Floats.concat(NUMBERS, new float[] {NaN});
65 assertEquals(((Float) value).hashCode(), Floats.hashCode(value));
71 assertEquals(!(Float.isInfinite(value) || Float.isNaN(value)), Floats.isFinite(value));
81 Floats.compare(x, y));
87 assertFalse(Floats.contains(EMPTY, (float) 1));
88 assertFalse(Floats.contains(ARRAY1, (float) 2));
89 assertFalse(Floats.contains(ARRAY234, (float) 1));
90 assertTrue(Floats.contains(new float[] {(float) -1}, (float) -1));
91 assertTrue(Floats.contains(ARRAY234, (float) 2));
92 assertTrue(Floats.contains(ARRAY234, (float) 3));
93 assertTrue(Floats.contains(ARRAY234, (float) 4));
96 assertTrue("" + value, Floats.contains(new float[] {5f, value}, value));
98 assertFalse(Floats.contains(new float[] {5f, NaN}, NaN));
102 assertEquals(-1, Floats.indexOf(EMPTY, (float) 1));
103 assertEquals(-1, Floats.indexOf(ARRAY1, (float) 2));
104 assertEquals(-1, Floats.indexOf(ARRAY234, (float) 1));
105 assertEquals(0, Floats.indexOf(
107 assertEquals(0, Floats.indexOf(ARRAY234, (float) 2));
108 assertEquals(1, Floats.indexOf(ARRAY234, (float) 3));
109 assertEquals(2, Floats.indexOf(ARRAY234, (float) 4));
110 assertEquals(1, Floats.indexOf(
116 Floats.indexOf(new float[] {5f, value}, value));
118 assertEquals(-1, Floats.indexOf(new float[] {5f, NaN}, NaN));
122 assertEquals(0, Floats.indexOf(EMPTY, EMPTY));
123 assertEquals(0, Floats.indexOf(ARRAY234, EMPTY));
124 assertEquals(-1, Floats.indexOf(EMPTY, ARRAY234));
125 assertEquals(-1, Floats.indexOf(ARRAY234, ARRAY1));
126 assertEquals(-1, Floats.indexOf(ARRAY1, ARRAY234));
127 assertEquals(0, Floats.indexOf(ARRAY1, ARRAY1));
128 assertEquals(0, Floats.indexOf(ARRAY234, ARRAY234));
129 assertEquals(0, Floats.indexOf(
131 assertEquals(1, Floats.indexOf(
133 assertEquals(1, Floats.indexOf(ARRAY234, new float[] { (float) 3 }));
134 assertEquals(2, Floats.indexOf(ARRAY234, new float[] { (float) 4 }));
135 assertEquals(1, Floats.indexOf(new float[] { (float) 2, (float) 3,
139 assertEquals(2, Floats.indexOf(
144 assertEquals(1, Floats.indexOf(
149 assertEquals(-1, Floats.indexOf(
155 assertEquals("" + value, 1, Floats.indexOf(
158 assertEquals(-1, Floats.indexOf(
163 assertEquals(-1, Floats.lastIndexOf(EMPTY, (float) 1));
164 assertEquals(-1, Floats.lastIndexOf(ARRAY1, (float) 2));
165 assertEquals(-1, Floats.lastIndexOf(ARRAY234, (float) 1));
166 assertEquals(0, Floats.lastIndexOf(
168 assertEquals(0, Floats.lastIndexOf(ARRAY234, (float) 2));
169 assertEquals(1, Floats.lastIndexOf(ARRAY234, (float) 3));
170 assertEquals(2, Floats.lastIndexOf(ARRAY234, (float) 4));
171 assertEquals(3, Floats.lastIndexOf(
177 0, Floats.lastIndexOf(new float[] {value, 5f}, value));
179 assertEquals(-1, Floats.lastIndexOf(new float[] {NaN, 5f}, NaN));
184 Floats.max();
191 assertEquals(GREATEST, Floats.max(GREATEST));
192 assertEquals(LEAST, Floats.max(LEAST));
193 assertEquals((float) 9, Floats.max(
197 assertEquals(0f, Floats.max(-0f, 0f));
198 assertEquals(0f, Floats.max(0f, -0f));
199 assertEquals(GREATEST, Floats.max(NUMBERS));
200 assertTrue(Float.isNaN(Floats.max(VALUES)));
205 Floats.min();
212 assertEquals(LEAST, Floats.min(LEAST));
213 assertEquals(GREATEST, Floats.min(GREATEST));
214 assertEquals((float) 0, Floats.min(
218 assertEquals(-0f, Floats.min(-0f, 0f));
219 assertEquals(-0f, Floats.min(0f, -0f));
220 assertEquals(LEAST, Floats.min(NUMBERS));
221 assertTrue(Float.isNaN(Floats.min(VALUES)));
225 assertTrue(Arrays.equals(EMPTY, Floats.concat()));
226 assertTrue(Arrays.equals(EMPTY, Floats.concat(EMPTY)));
227 assertTrue(Arrays.equals(EMPTY, Floats.concat(EMPTY, EMPTY, EMPTY)));
228 assertTrue(Arrays.equals(ARRAY1, Floats.concat(ARRAY1)));
229 assertNotSame(ARRAY1, Floats.concat(ARRAY1));
230 assertTrue(Arrays.equals(ARRAY1, Floats.concat(EMPTY, ARRAY1, EMPTY)));
233 Floats.concat(ARRAY1, ARRAY1, ARRAY1)));
236 Floats.concat(ARRAY1, ARRAY234)));
240 assertSame(EMPTY, Floats.ensureCapacity(EMPTY, 0, 1));
241 assertSame(ARRAY1, Floats.ensureCapacity(ARRAY1, 0, 1));
242 assertSame(ARRAY1, Floats.ensureCapacity(ARRAY1, 1, 1));
245 Floats.ensureCapacity(ARRAY1, 2, 1)));
250 Floats.ensureCapacity(ARRAY1, -1, 1);
256 Floats.ensureCapacity(ARRAY1, 1, -1);
264 assertEquals("", Floats.join(",", EMPTY));
265 assertEquals("1.0", Floats.join(",", ARRAY1));
266 assertEquals("1.0,2.0", Floats.join(",", (float) 1, (float) 2));
268 Floats.join("", (float) 1, (float) 2, (float) 3));
283 Comparator<float[]> comparator = Floats.lexicographicalComparator();
289 Comparator<float[]> comparator = Floats.lexicographicalComparator();
295 SerializableTester.reserializeAndAssert(Floats.stringConverter());
301 assertTrue(Arrays.equals(EMPTY, Floats.toArray(none)));
304 assertTrue(Arrays.equals(ARRAY1, Floats.toArray(one)));
309 assertTrue(Arrays.equals(array, Floats.toArray(three)));
311 assertTrue(Arrays.equals(array, Floats.toArray(Floats.asList(array))));
317 List<Float> list = Floats.asList(VALUES).subList(0, i);
321 float[] arr = Floats.toArray(misleadingSize);
333 Floats.toArray(list);
345 List<Float> floats = Arrays.asList((float) 0, (float) 1, (float) 2);
349 assertTrue(Arrays.equals(array, Floats.toArray(bytes)));
350 assertTrue(Arrays.equals(array, Floats.toArray(shorts)));
351 assertTrue(Arrays.equals(array, Floats.toArray(ints)));
352 assertTrue(Arrays.equals(array, Floats.toArray(floats)));
353 assertTrue(Arrays.equals(array, Floats.toArray(longs)));
354 assertTrue(Arrays.equals(array, Floats.toArray(doubles)));
359 List<Float> list = Floats.asList(array);
368 List<Float> list = Floats.asList(array);
369 float[] newArray = Floats.toArray(list);
382 List<Float> list = Floats.asList(array);
384 Floats.toArray(list.subList(1, 3))));
386 Floats.toArray(list.subList(2, 2))));
390 assertSame(Collections.emptyList(), Floats.asList(EMPTY));
408 @GwtIncompatible("Floats.tryParse")
410 assertEquals(referenceTryParse(input), Floats.tryParse(input));
413 @GwtIncompatible("Floats.tryParse")
415 assertEquals(Float.valueOf(expected), Floats.tryParse(input));
418 @GwtIncompatible("Floats.tryParse")
438 @GwtIncompatible("Floats.tryParse")
448 @GwtIncompatible("Floats.tryParse")
455 @GwtIncompatible("Floats.tryParse")
462 @GwtIncompatible("Floats.tryParse")
469 @GwtIncompatible("Floats.tryParse")
480 @GwtIncompatible("Floats.tryParse")
483 assertEquals(referenceTryParse(badInput), Floats.tryParse(badInput));
484 assertNull(Floats.tryParse(badInput));
490 new NullPointerTester().testAllPublicStaticMethods(Floats.class);
495 Converter<String, Float> converter = Floats.stringConverter();
508 Floats.stringConverter().convert("notanumber");
515 assertNull(Floats.stringConverter().convert(null));
516 assertNull(Floats.stringConverter().reverse().convert(null));
521 Converter<String, Float> converter = Floats.stringConverter();
532 tester.testAllPublicInstanceMethods(Floats.stringConverter());