Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(736)

Side by Side Diff: pkg/kernel/test/type_hashcode_test.dart

Issue 2528623002: Disable kernel unit tests. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4 import 'package:kernel/kernel.dart';
5 import 'type_parser.dart';
6 import 'type_unification_test.dart' show testCases;
7 import 'package:test/test.dart';
8
9 void checkHashCodeEquality(DartType type1, DartType type2) {
10 if (type1 == type2 && type1.hashCode != type2.hashCode) {
11 fail('Equal types with different hash codes: $type1 and $type2');
12 }
13 }
14
15 const int MinimumSmi = -(1 << 30);
16 const int MaximumSmi = (1 << 30) - 1;
17
18 bool isSmallInteger(int hash) {
19 return MinimumSmi <= hash && hash <= MaximumSmi;
20 }
21
22 void checkHashCodeRange(DartType type) {
23 int hash = type.hashCode;
24 if (!isSmallInteger(hash)) {
25 fail('Hash code for $type is not a SMI: $hash');
26 }
27 }
28
29 void main() {
30 for (var testCase in testCases) {
31 test('$testCase', () {
32 var env = new LazyTypeEnvironment();
33 var type1 = env.parse(testCase.type1);
34 var type2 = env.parse(testCase.type2);
35 checkHashCodeEquality(type1, type2);
36 checkHashCodeRange(type1);
37 checkHashCodeRange(type2);
38 });
39 }
40 }
OLDNEW
« no previous file with comments | « pkg/kernel/test/baseline_type_propagation_test_disabled.dart ('k') | pkg/kernel/test/type_hashcode_test_disabled.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698