OLD | NEW |
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 import 'dart:codec'; | |
6 import 'dart:convert'; | 5 import 'dart:convert'; |
7 | 6 |
8 import 'package:expect/expect.dart'; | 7 import 'package:expect/expect.dart'; |
9 | 8 |
10 class MyCodec extends Codec<int, String> { | 9 class MyCodec extends Codec<int, String> { |
11 const MyCodec(); | 10 const MyCodec(); |
12 | 11 |
13 Converter<int, String> get encoder => new IntStringConverter(); | 12 Converter<int, String> get encoder => new IntStringConverter(); |
14 Converter<String, int> get decoder => new StringIntConverter(); | 13 Converter<String, int> get decoder => new StringIntConverter(); |
15 } | 14 } |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 | 60 |
62 inverted = TEST_CODEC2.inverted; | 61 inverted = TEST_CODEC2.inverted; |
63 fused = TEST_CODEC2.fuse(inverted); | 62 fused = TEST_CODEC2.fuse(inverted); |
64 Expect.equals(499, fused.encode(0)); | 63 Expect.equals(499, fused.encode(0)); |
65 Expect.equals(499, fused.decode(0)); | 64 Expect.equals(499, fused.decode(0)); |
66 | 65 |
67 fused = TEST_CODEC.fuse(inverted); | 66 fused = TEST_CODEC.fuse(inverted); |
68 Expect.equals(405, fused.encode(5)); | 67 Expect.equals(405, fused.encode(5)); |
69 Expect.equals(101, fused.decode(2)); | 68 Expect.equals(101, fused.decode(2)); |
70 } | 69 } |
OLD | NEW |