ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/jtreg/util/Spliterator/SpliteratorTraversingAndSplittingTest.java
(Generate patch)

Comparing jsr166/src/test/jtreg/util/Spliterator/SpliteratorTraversingAndSplittingTest.java (file contents):
Revision 1.5 by jsr166, Mon Jul 11 20:41:50 2016 UTC vs.
Revision 1.6 by jsr166, Fri Dec 9 04:46:51 2016 UTC

# Line 25 | Line 25
25   * @test
26   * @summary Spliterator traversing and splitting tests
27   * @run testng SpliteratorTraversingAndSplittingTest
28 < * @bug 8020016 8071477
28 > * @bug 8020016 8071477 8072784 8169838
29   */
30  
31   import org.testng.annotations.DataProvider;
32   import org.testng.annotations.Test;
33  
34 + import java.nio.CharBuffer;
35   import java.util.AbstractCollection;
36   import java.util.AbstractList;
37   import java.util.AbstractSet;
38   import java.util.ArrayDeque;
39   import java.util.ArrayList;
40   import java.util.Arrays;
41 + import java.util.BitSet;
42   import java.util.Collection;
43   import java.util.Collections;
44   import java.util.Comparator;
# Line 80 | Line 82 | import java.util.function.IntConsumer;
82   import java.util.function.LongConsumer;
83   import java.util.function.Supplier;
84   import java.util.function.UnaryOperator;
85 + import java.util.stream.IntStream;
86  
87 + import static java.util.stream.Collectors.toList;
88   import static org.testng.Assert.*;
89   import static org.testng.Assert.assertEquals;
90  
# Line 881 | Line 885 | public class SpliteratorTraversingAndSpl
885              cdb.add("new CharSequenceImpl(\"%s\")", CharSequenceImpl::new);
886              cdb.add("new StringBuilder(\"%s\")", StringBuilder::new);
887              cdb.add("new StringBuffer(\"%s\")", StringBuffer::new);
888 +            cdb.add("CharBuffer.wrap(\"%s\".toCharArray())", s -> CharBuffer.wrap(s.toCharArray()));
889          }
890  
891 +
892 +        Object[][] bitStreamTestcases = new Object[][] {
893 +                { "none", IntStream.empty().toArray() },
894 +                { "index 0", IntStream.of(0).toArray() },
895 +                { "index 255", IntStream.of(255).toArray() },
896 +                { "index 0 and 255", IntStream.of(0, 255).toArray() },
897 +                { "every bit", IntStream.range(0, 255).toArray() },
898 +                { "step 2", IntStream.range(0, 255).map(f -> f * 2).toArray() },
899 +                { "step 3", IntStream.range(0, 255).map(f -> f * 3).toArray() },
900 +                { "step 5", IntStream.range(0, 255).map(f -> f * 5).toArray() },
901 +                { "step 7", IntStream.range(0, 255).map(f -> f * 7).toArray() },
902 +                { "1, 10, 100, 1000", IntStream.of(1, 10, 100, 1000).toArray() },
903 +        };
904 +        for (Object[] tc : bitStreamTestcases) {
905 +            String description = (String)tc[0];
906 +            int[] exp = (int[])tc[1];
907 +            SpliteratorOfIntDataBuilder db = new SpliteratorOfIntDataBuilder(
908 +                    data, IntStream.of(exp).boxed().collect(toList()));
909 +
910 +            db.add("BitSet.stream.spliterator() {" + description + "}", () ->
911 +                IntStream.of(exp).collect(BitSet::new, BitSet::set, BitSet::or).
912 +                        stream().spliterator()
913 +            );
914 +        }
915          return spliteratorOfIntDataProvider = data.toArray(new Object[0][]);
916      }
917  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines