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_reflective_loader/test_reflective_loader.dart'; |
11 import 'package:unittest/unittest.dart'; | 12 import 'package:unittest/unittest.dart'; |
12 | 13 |
13 import '../../reflective_tests.dart'; | |
14 | |
15 main() { | 14 main() { |
16 groupSep = ' | '; | 15 groupSep = ' | '; |
17 runReflectiveTests(ApiSignatureTest); | 16 defineReflectiveTests(ApiSignatureTest); |
18 } | 17 } |
19 | 18 |
20 @reflectiveTest | 19 @reflectiveTest |
21 class ApiSignatureTest { | 20 class ApiSignatureTest { |
22 ApiSignature sig = new ApiSignature.unversioned(); | 21 ApiSignature sig = new ApiSignature.unversioned(); |
23 | 22 |
24 void checkBytes(List<int> bytes) { | 23 void checkBytes(List<int> bytes) { |
25 expect(sig.getBytes_forDebug(), bytes); | 24 expect(sig.getBytes_forDebug(), bytes); |
26 expect(sig.toHex(), hex.encode(md5.convert(bytes).bytes)); | 25 expect(sig.toHex(), hex.encode(md5.convert(bytes).bytes)); |
27 } | 26 } |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 for (int i = 0; i < 100000; i++) { | 102 for (int i = 0; i < 100000; i++) { |
104 sig.addInt(i); | 103 sig.addInt(i); |
105 expectedResult.add(i % 0x100); | 104 expectedResult.add(i % 0x100); |
106 expectedResult.add((i ~/ 0x100) % 0x100); | 105 expectedResult.add((i ~/ 0x100) % 0x100); |
107 expectedResult.add((i ~/ 0x10000) % 0x100); | 106 expectedResult.add((i ~/ 0x10000) % 0x100); |
108 expectedResult.add((i ~/ 0x1000000) % 0x100); | 107 expectedResult.add((i ~/ 0x1000000) % 0x100); |
109 } | 108 } |
110 checkBytes(expectedResult); | 109 checkBytes(expectedResult); |
111 } | 110 } |
112 } | 111 } |
OLD | NEW |