OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 import 'dart:async'; | 5 import 'dart:async'; |
6 import 'dart:io'; | 6 import 'dart:io'; |
7 import 'dart:isolate'; | 7 import 'dart:isolate'; |
8 | 8 |
9 void testZLibDeflate() { | 9 void testZLibDeflate() { |
10 test(int level, List<int> expected) { | 10 test(int level, List<int> expected) { |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 controller.stream.transform(new ZLibDeflater()) | 72 controller.stream.transform(new ZLibDeflater()) |
73 .reduce([], (buffer, data) { | 73 .reduce([], (buffer, data) { |
74 buffer.addAll(data); | 74 buffer.addAll(data); |
75 return buffer; | 75 return buffer; |
76 }) | 76 }) |
77 .then((data) { | 77 .then((data) { |
78 Expect.equals(26, data.length); | 78 Expect.equals(26, data.length); |
79 Expect.listEquals([98, 96, 100, 98, 102, 97, 101, 99, 231, 224, 4, 0, 0, | 79 Expect.listEquals([98, 96, 100, 98, 102, 97, 101, 99, 231, 224, 4, 0, 0, |
80 0, 255, 255], | 80 0, 255, 255], |
81 // Skip header, as it can change. | 81 // Skip header, as it can change. |
82 data.getRange(10, 16)); | 82 data.sublist(10)); |
83 port.close(); | 83 port.close(); |
84 }); | 84 }); |
85 controller.add(data); | 85 controller.add(data); |
86 controller.close(); | 86 controller.close(); |
87 } | 87 } |
88 | 88 |
89 void testZLibDeflateInvalidLevel() { | 89 void testZLibDeflateInvalidLevel() { |
90 test2(gzip, level) { | 90 test2(gzip, level) { |
91 var port = new ReceivePort(); | 91 var port = new ReceivePort(); |
92 try { | 92 try { |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 } | 136 } |
137 } | 137 } |
138 | 138 |
139 void main() { | 139 void main() { |
140 testZLibDeflate(); | 140 testZLibDeflate(); |
141 testZLibDeflateEmpty(); | 141 testZLibDeflateEmpty(); |
142 testZLibDeflateGZip(); | 142 testZLibDeflateGZip(); |
143 testZLibDeflateInvalidLevel(); | 143 testZLibDeflateInvalidLevel(); |
144 testZLibInflate(); | 144 testZLibInflate(); |
145 } | 145 } |
OLD | NEW |