OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 library test.src.summary.api_signature_test; | 5 library test.src.summary.api_signature_test; |
6 | 6 |
7 import 'package:analyzer/src/summary/api_signature.dart'; | 7 import 'package:analyzer/src/summary/api_signature.dart'; |
8 import 'package:analyzer/src/summary/format.dart'; | 8 import 'package:analyzer/src/summary/format.dart'; |
9 import 'package:convert/convert.dart'; | 9 import 'package:convert/convert.dart'; |
10 import 'package:crypto/crypto.dart'; | 10 import 'package:crypto/crypto.dart'; |
| 11 import 'package:test/test.dart'; |
11 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 12 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
12 import 'package:unittest/unittest.dart'; | |
13 | 13 |
14 main() { | 14 main() { |
15 groupSep = ' | '; | 15 defineReflectiveSuite(() { |
16 defineReflectiveTests(ApiSignatureTest); | 16 defineReflectiveTests(ApiSignatureTest); |
| 17 }); |
17 } | 18 } |
18 | 19 |
19 @reflectiveTest | 20 @reflectiveTest |
20 class ApiSignatureTest { | 21 class ApiSignatureTest { |
21 ApiSignature sig = new ApiSignature.unversioned(); | 22 ApiSignature sig = new ApiSignature.unversioned(); |
22 | 23 |
23 void checkBytes(List<int> bytes) { | 24 void checkBytes(List<int> bytes) { |
24 expect(sig.getBytes_forDebug(), bytes); | 25 expect(sig.getBytes_forDebug(), bytes); |
25 expect(sig.toHex(), hex.encode(md5.convert(bytes).bytes)); | 26 expect(sig.toHex(), hex.encode(md5.convert(bytes).bytes)); |
26 } | 27 } |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 for (int i = 0; i < 100000; i++) { | 103 for (int i = 0; i < 100000; i++) { |
103 sig.addInt(i); | 104 sig.addInt(i); |
104 expectedResult.add(i % 0x100); | 105 expectedResult.add(i % 0x100); |
105 expectedResult.add((i ~/ 0x100) % 0x100); | 106 expectedResult.add((i ~/ 0x100) % 0x100); |
106 expectedResult.add((i ~/ 0x10000) % 0x100); | 107 expectedResult.add((i ~/ 0x10000) % 0x100); |
107 expectedResult.add((i ~/ 0x1000000) % 0x100); | 108 expectedResult.add((i ~/ 0x1000000) % 0x100); |
108 } | 109 } |
109 checkBytes(expectedResult); | 110 checkBytes(expectedResult); |
110 } | 111 } |
111 } | 112 } |
OLD | NEW |