OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 main() { |
| 6 List<int> list1 = <int>[1, 2, 3]; |
| 7 List<int> list2 = const <int>[4, 5]; |
| 8 List<String> list3 = <String>[]; |
| 9 Set<int> set1 = new Set<int>(); |
| 10 set1..add(11) |
| 11 ..add(12) |
| 12 ..add(13); |
| 13 Set set2 = new Set(); |
| 14 |
| 15 Iterable<int> skip0 = list1.skip(0); |
| 16 Iterator<int> it = skip0.iterator; |
| 17 Expect.isNull(it.current); |
| 18 Expect.isTrue(it.moveNext()); |
| 19 Expect.equals(1, it.current); |
| 20 Expect.isTrue(it.moveNext()); |
| 21 Expect.equals(2, it.current); |
| 22 Expect.isTrue(it.moveNext()); |
| 23 Expect.equals(3, it.current); |
| 24 Expect.isFalse(it.moveNext()); |
| 25 Expect.isNull(it.current); |
| 26 |
| 27 Iterable<int> skip1 = list1.skip(1); |
| 28 it = skip1.iterator; |
| 29 Expect.isNull(it.current); |
| 30 Expect.isTrue(it.moveNext()); |
| 31 Expect.equals(2, it.current); |
| 32 Expect.isTrue(it.moveNext()); |
| 33 Expect.equals(3, it.current); |
| 34 Expect.isFalse(it.moveNext()); |
| 35 Expect.isNull(it.current); |
| 36 |
| 37 Iterable<int> skip2 = list1.skip(2); |
| 38 it = skip2.iterator; |
| 39 Expect.isNull(it.current); |
| 40 Expect.isTrue(it.moveNext()); |
| 41 Expect.equals(3, it.current); |
| 42 Expect.isFalse(it.moveNext()); |
| 43 Expect.isNull(it.current); |
| 44 |
| 45 Iterable<int> skip3 = list1.skip(3); |
| 46 it = skip3.iterator; |
| 47 Expect.isNull(it.current); |
| 48 Expect.isFalse(it.moveNext()); |
| 49 Expect.isNull(it.current); |
| 50 |
| 51 Iterable<int> skip4 = list1.skip(4); |
| 52 it = skip4.iterator; |
| 53 Expect.isNull(it.current); |
| 54 Expect.isFalse(it.moveNext()); |
| 55 Expect.isNull(it.current); |
| 56 |
| 57 skip0 = list1.skip(0); |
| 58 skip1 = skip0.skip(1); |
| 59 skip2 = skip1.skip(1); |
| 60 skip3 = skip2.skip(1); |
| 61 skip4 = skip3.skip(1); |
| 62 it = skip0.iterator; |
| 63 Expect.isNull(it.current); |
| 64 Expect.isTrue(it.moveNext()); |
| 65 Expect.equals(1, it.current); |
| 66 Expect.isTrue(it.moveNext()); |
| 67 Expect.equals(2, it.current); |
| 68 Expect.isTrue(it.moveNext()); |
| 69 Expect.equals(3, it.current); |
| 70 Expect.isFalse(it.moveNext()); |
| 71 Expect.isNull(it.current); |
| 72 it = skip1.iterator; |
| 73 Expect.isNull(it.current); |
| 74 Expect.isTrue(it.moveNext()); |
| 75 Expect.equals(2, it.current); |
| 76 Expect.isTrue(it.moveNext()); |
| 77 Expect.equals(3, it.current); |
| 78 Expect.isFalse(it.moveNext()); |
| 79 Expect.isNull(it.current); |
| 80 it = skip2.iterator; |
| 81 Expect.isNull(it.current); |
| 82 Expect.isTrue(it.moveNext()); |
| 83 Expect.equals(3, it.current); |
| 84 Expect.isFalse(it.moveNext()); |
| 85 Expect.isNull(it.current); |
| 86 it = skip3.iterator; |
| 87 Expect.isNull(it.current); |
| 88 Expect.isFalse(it.moveNext()); |
| 89 Expect.isNull(it.current); |
| 90 it = skip4.iterator; |
| 91 Expect.isNull(it.current); |
| 92 Expect.isFalse(it.moveNext()); |
| 93 Expect.isNull(it.current); |
| 94 |
| 95 skip0 = list2.skip(0); |
| 96 it = skip0.iterator; |
| 97 Expect.isNull(it.current); |
| 98 Expect.isTrue(it.moveNext()); |
| 99 Expect.equals(4, it.current); |
| 100 Expect.isTrue(it.moveNext()); |
| 101 Expect.equals(5, it.current); |
| 102 Expect.isFalse(it.moveNext()); |
| 103 Expect.isNull(it.current); |
| 104 |
| 105 skip1 = list2.skip(1); |
| 106 it = skip1.iterator; |
| 107 Expect.isNull(it.current); |
| 108 Expect.isTrue(it.moveNext()); |
| 109 Expect.equals(5, it.current); |
| 110 Expect.isFalse(it.moveNext()); |
| 111 Expect.isNull(it.current); |
| 112 |
| 113 skip2 = list2.skip(2); |
| 114 it = skip2.iterator; |
| 115 Expect.isNull(it.current); |
| 116 Expect.isFalse(it.moveNext()); |
| 117 Expect.isNull(it.current); |
| 118 |
| 119 skip3 = list2.skip(3); |
| 120 it = skip3.iterator; |
| 121 Expect.isNull(it.current); |
| 122 Expect.isFalse(it.moveNext()); |
| 123 Expect.isNull(it.current); |
| 124 |
| 125 Iterable<String> skip02 = list3.skip(0); |
| 126 Iterator<String> it2 = skip02.iterator; |
| 127 Expect.isNull(it2.current); |
| 128 Expect.isFalse(it2.moveNext()); |
| 129 Expect.isNull(it2.current); |
| 130 |
| 131 Iterable<String> skip12 = list3.skip(1); |
| 132 it2 = skip12.iterator; |
| 133 Expect.isNull(it2.current); |
| 134 Expect.isFalse(it2.moveNext()); |
| 135 Expect.isNull(it2.current); |
| 136 |
| 137 skip0 = set1.skip(0); |
| 138 List<int> copied = skip0.toList(); |
| 139 Expect.equals(3, copied.length); |
| 140 Expect.isTrue(set1.contains(copied[0])); |
| 141 Expect.isTrue(set1.contains(copied[1])); |
| 142 Expect.isTrue(set1.contains(copied[2])); |
| 143 Expect.isTrue(copied[0] != copied[1]); |
| 144 Expect.isTrue(copied[0] != copied[2]); |
| 145 Expect.isTrue(copied[1] != copied[2]); |
| 146 it = skip0.iterator; |
| 147 Expect.isNull(it.current); |
| 148 Expect.isTrue(it.moveNext()); |
| 149 Expect.isNotNull(it.current); |
| 150 Expect.isTrue(it.moveNext()); |
| 151 Expect.isNotNull(it.current); |
| 152 Expect.isTrue(it.moveNext()); |
| 153 Expect.isNotNull(it.current); |
| 154 Expect.isFalse(it.moveNext()); |
| 155 Expect.isNull(it.current); |
| 156 |
| 157 skip1 = set1.skip(1); |
| 158 copied = skip1.toList(); |
| 159 Expect.equals(2, copied.length); |
| 160 Expect.isTrue(set1.contains(copied[0])); |
| 161 Expect.isTrue(set1.contains(copied[1])); |
| 162 Expect.isTrue(copied[0] != copied[1]); |
| 163 it = skip1.iterator; |
| 164 Expect.isNull(it.current); |
| 165 Expect.isTrue(it.moveNext()); |
| 166 Expect.isNotNull(it.current); |
| 167 Expect.isTrue(it.moveNext()); |
| 168 Expect.isNotNull(it.current); |
| 169 Expect.isFalse(it.moveNext()); |
| 170 Expect.isNull(it.current); |
| 171 |
| 172 skip2 = set1.skip(2); |
| 173 copied = skip2.toList(); |
| 174 Expect.equals(1, copied.length); |
| 175 Expect.isTrue(set1.contains(copied[0])); |
| 176 it = skip2.iterator; |
| 177 Expect.isNull(it.current); |
| 178 Expect.isTrue(it.moveNext()); |
| 179 Expect.isNotNull(it.current); |
| 180 Expect.isFalse(it.moveNext()); |
| 181 Expect.isNull(it.current); |
| 182 |
| 183 skip3 = set1.skip(3); |
| 184 it = skip3.iterator; |
| 185 Expect.isNull(it.current); |
| 186 Expect.isFalse(it.moveNext()); |
| 187 Expect.isNull(it.current); |
| 188 |
| 189 skip4 = set1.skip(4); |
| 190 it = skip4.iterator; |
| 191 Expect.isNull(it.current); |
| 192 Expect.isFalse(it.moveNext()); |
| 193 Expect.isNull(it.current); |
| 194 |
| 195 skip0 = set2.skip(0); |
| 196 it = skip0.iterator; |
| 197 Expect.isNull(it.current); |
| 198 Expect.isFalse(it.moveNext()); |
| 199 Expect.isNull(it.current); |
| 200 |
| 201 skip1 = set2.skip(1); |
| 202 it = skip1.iterator; |
| 203 Expect.isNull(it.current); |
| 204 Expect.isFalse(it.moveNext()); |
| 205 Expect.isNull(it.current); |
| 206 } |
OLD | NEW |