@@ -8,38 +8,41 @@ import 'dart:typed_data';
88import 'package:gzip/gzip.dart' ;
99import 'package:test/test.dart' ;
1010
11- import 'helper_mock.dart'
12- if (dart.library.io) 'helper_io.dart'
13- if (dart.library.js_interop) 'helper_web.dart' ;
14-
1511const enc = Utf8Encoder ();
1612void main () {
17- for (final (: name, : input, output: outputList) in cases) {
18- final output = switchPlatformBit (outputList);
13+ for (final (: name, : input, : output) in cases) {
1914 test (
2015 'Compress $name ' ,
21- () async => expect (await GZip ().compress (input), output),
16+ () async => exepctUpToPlatform (await GZip ().compress (input), output),
2217 );
2318 test (
2419 'Decompress $name ' ,
25- () async => expect (await GZip ().decompress (output), input),
20+ () async => exepctUpToPlatform (await GZip ().decompress (output), input),
2621 );
2722 test ('Roundtrip $name ' , () async {
2823 final compressed = await GZip ().compress (input);
29- expect (await GZip ().decompress (Uint8List .fromList (compressed)), input);
24+ exepctUpToPlatform (
25+ await GZip ().decompress (Uint8List .fromList (compressed)),
26+ input,
27+ );
3028 });
3129 test ('Roundtrip back $name ' , () async {
3230 final decompressed = await GZip ().decompress (output);
33- expect (await GZip ().compress (Uint8List .fromList (decompressed)), output);
31+ final actual = await GZip ().compress (Uint8List .fromList (decompressed));
32+ exepctUpToPlatform (actual, output);
3433 });
3534 }
3635}
3736
37+ void exepctUpToPlatform (List <int > actual, Uint8List output) {
38+ expect (toFantasyPlatformBit (actual), toFantasyPlatformBit (output));
39+ }
40+
3841final cases = [
3942 (
4043 name: 'Simple ASCII' ,
4144 input: enc.convert ('Hello World' ),
42- output: [
45+ output: Uint8List . fromList ( [
4346 31 ,
4447 139 ,
4548 8 ,
@@ -49,7 +52,7 @@ final cases = [
4952 0 ,
5053 0 ,
5154 0 ,
52- 3 ,
55+ 42 ,
5356 243 ,
5457 72 ,
5558 205 ,
@@ -71,12 +74,12 @@ final cases = [
7174 0 ,
7275 0 ,
7376 0 ,
74- ],
77+ ]) ,
7578 ),
7679 (
7780 name: 'More complex' ,
7881 input: enc.convert ('éàöñ 漢 こんにちは به متنی©®€£µ¥' ),
79- output: [
82+ output: Uint8List . fromList ( [
8083 31 ,
8184 139 ,
8285 8 ,
@@ -86,7 +89,7 @@ final cases = [
8689 0 ,
8790 0 ,
8891 0 ,
89- 3 ,
92+ 42 ,
9093 1 ,
9194 55 ,
9295 0 ,
@@ -155,6 +158,12 @@ final cases = [
155158 0 ,
156159 0 ,
157160 0 ,
158- ],
161+ ]) ,
159162 ),
160163];
164+
165+ Uint8List toFantasyPlatformBit (List <int > input) {
166+ const osBit = 9 ;
167+ input[osBit] = 42 ;
168+ return Uint8List .fromList (input);
169+ }
0 commit comments