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 dart2js.serialization_test_helper; | 5 library dart2js.serialization_test_helper; |
6 | 6 |
7 import 'dart:collection'; | 7 import 'dart:collection'; |
8 import 'package:compiler/src/common/resolution.dart'; | 8 import 'package:compiler/src/common/resolution.dart'; |
9 import 'package:compiler/src/constants/expressions.dart'; | 9 import 'package:compiler/src/constants/expressions.dart'; |
10 import 'package:compiler/src/dart_types.dart'; | 10 import 'package:compiler/src/dart_types.dart'; |
11 import 'package:compiler/src/compiler.dart'; | 11 import 'package:compiler/src/compiler.dart'; |
12 import 'package:compiler/src/elements/elements.dart'; | 12 import 'package:compiler/src/elements/elements.dart'; |
13 import 'package:compiler/src/serialization/equivalence.dart'; | 13 import 'package:compiler/src/serialization/equivalence.dart'; |
14 import 'package:compiler/src/tree/nodes.dart'; | 14 import 'package:compiler/src/tree/nodes.dart'; |
15 import 'package:expect/expect.dart'; | 15 import 'package:expect/expect.dart'; |
16 import 'test_data.dart'; | |
16 | 17 |
17 Check currentCheck; | 18 Check currentCheck; |
18 | 19 |
19 class Check { | 20 class Check { |
20 final Check parent; | 21 final Check parent; |
21 final Object object1; | 22 final Object object1; |
22 final Object object2; | 23 final Object object2; |
23 final String property; | 24 final String property; |
24 final Object value1; | 25 final Object value1; |
25 final Object value2; | 26 final Object value2; |
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
582 | 583 |
583 if (resolvedAst1 == null || resolvedAst2 == null) return; | 584 if (resolvedAst1 == null || resolvedAst2 == null) return; |
584 | 585 |
585 if (verbose) { | 586 if (verbose) { |
586 print('Checking resolved asts for $member1 vs $member2'); | 587 print('Checking resolved asts for $member1 vs $member2'); |
587 } | 588 } |
588 | 589 |
589 testResolvedAstEquivalence( | 590 testResolvedAstEquivalence( |
590 resolvedAst1, resolvedAst2, const CheckStrategy()); | 591 resolvedAst1, resolvedAst2, const CheckStrategy()); |
591 } | 592 } |
593 | |
594 /// Return the test arguments for testing the [index]th segment (1-based) of | |
Bill Hesse
2016/07/20 13:46:45
I think you should have two functions, one for ret
Johnni Winther
2016/07/25 08:30:08
Done.
| |
595 /// the [TESTS] split into [count] groups. The first [skip] tests are excluded | |
596 /// from the automatic grouping and tested if `index <= 0`. | |
597 List<String> testSegment(int index, int count, int skip) { | |
598 | |
599 int segmentNumber(int i) { | |
600 return skip + i * (TESTS.length - skip) ~/ count; | |
601 } | |
602 | |
603 if (index <= 0) { | |
604 return ['${-index}', '${-index}']; | |
605 } else if (index == 1 && skip != 0) { | |
606 return ['${skip}', '${segmentNumber(index) - 1}']; | |
607 } else if (index == count) { | |
608 return ['${segmentNumber(index - 1)}']; | |
609 } else { | |
610 return ['${segmentNumber(index - 1)}', '${segmentNumber(index) - 1}']; | |
611 } | |
612 } | |
OLD | NEW |