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

Side by Side Diff: test/vlq_test.dart

Issue 1240863004: Upgrade to the new test runner. (Closed) Base URL: git@github.com:dart-lang/source_maps@master
Patch Set: Created 5 years, 5 months 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
« no previous file with comments | « test/utils_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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.vlq_test; 5 library test.vlq_test;
6 6
7 import 'dart:math'; 7 import 'dart:math';
8 import 'package:unittest/unittest.dart'; 8 import 'package:test/test.dart';
9 import 'package:source_maps/src/vlq.dart'; 9 import 'package:source_maps/src/vlq.dart';
10 10
11 main() { 11 main() {
12 test('encode and decode - simple values', () { 12 test('encode and decode - simple values', () {
13 expect(encodeVlq(1).join(''), 'C'); 13 expect(encodeVlq(1).join(''), 'C');
14 expect(encodeVlq(2).join(''), 'E'); 14 expect(encodeVlq(2).join(''), 'E');
15 expect(encodeVlq(3).join(''), 'G'); 15 expect(encodeVlq(3).join(''), 'G');
16 expect(encodeVlq(100).join(''), 'oG'); 16 expect(encodeVlq(100).join(''), 'oG');
17 expect(decodeVlq('C'.split('').iterator), 1); 17 expect(decodeVlq('C'.split('').iterator), 1);
18 expect(decodeVlq('E'.split('').iterator), 2); 18 expect(decodeVlq('E'.split('').iterator), 2);
(...skipping 23 matching lines...) Expand all
42 expect(() => encodeVlq(min_int - 1), throws); 42 expect(() => encodeVlq(min_int - 1), throws);
43 expect(() => encodeVlq(min_int - 2), throws); 43 expect(() => encodeVlq(min_int - 2), throws);
44 44
45 45
46 // if we allowed more than 32 bits, these would be the expected encodings 46 // if we allowed more than 32 bits, these would be the expected encodings
47 // for the large numbers above. 47 // for the large numbers above.
48 expect(() => decodeVlq('ggggggE'.split('').iterator), throws); 48 expect(() => decodeVlq('ggggggE'.split('').iterator), throws);
49 expect(() => decodeVlq('igggggE'.split('').iterator), throws); 49 expect(() => decodeVlq('igggggE'.split('').iterator), throws);
50 expect(() => decodeVlq('jgggggE'.split('').iterator), throws); 50 expect(() => decodeVlq('jgggggE'.split('').iterator), throws);
51 expect(() => decodeVlq('lgggggE'.split('').iterator), throws); 51 expect(() => decodeVlq('lgggggE'.split('').iterator), throws);
52 }); 52 },
53 // This test uses integers so large they overflow in JS.
54 testOn: "dart-vm");
53 } 55 }
54 56
55 _checkEncodeDecode(int value) { 57 _checkEncodeDecode(int value) {
56 var encoded = encodeVlq(value); 58 var encoded = encodeVlq(value);
57 expect(decodeVlq(encoded.iterator), value); 59 expect(decodeVlq(encoded.iterator), value);
58 expect(decodeVlq(encoded.join('').split('').iterator), value); 60 expect(decodeVlq(encoded.join('').split('').iterator), value);
59 } 61 }
OLDNEW
« no previous file with comments | « test/utils_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698