| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 tag to allow the test to run on Dartium. | 5 // Library tag to allow the test to run on Dartium. |
| 6 library base64_test; | 6 library base64_test; |
| 7 | 7 |
| 8 import "package:expect/expect.dart"; | |
| 9 import 'dart:crypto'; | 8 import 'dart:crypto'; |
| 10 | 9 |
| 11 // Data from http://tools.ietf.org/html/rfc4648. | 10 // Data from http://tools.ietf.org/html/rfc4648. |
| 12 var inputs = | 11 var inputs = |
| 13 const [ '', 'f', 'fo', 'foo', 'foob', 'fooba', 'foobar' ]; | 12 const [ '', 'f', 'fo', 'foo', 'foob', 'fooba', 'foobar' ]; |
| 14 var results = | 13 var results = |
| 15 const [ '', 'Zg==', 'Zm8=', 'Zm9v', 'Zm9vYg==', 'Zm9vYmE=', 'Zm9vYmFy' ]; | 14 const [ '', 'Zg==', 'Zm8=', 'Zm9v', 'Zm9vYg==', 'Zm9vYmE=', 'Zm9vYmFy' ]; |
| 16 | 15 |
| 17 var longLine = | 16 var longLine = |
| 18 "Man is distinguished, not only by his reason, but by this singular " | 17 "Man is distinguished, not only by his reason, but by this singular " |
| (...skipping 28 matching lines...) Expand all Loading... |
| 47 void main() { | 46 void main() { |
| 48 for (var i = 0; i < inputs.length; i++) { | 47 for (var i = 0; i < inputs.length; i++) { |
| 49 var enc = CryptoUtils.bytesToBase64(inputs[i].codeUnits); | 48 var enc = CryptoUtils.bytesToBase64(inputs[i].codeUnits); |
| 50 Expect.equals(results[i], enc); | 49 Expect.equals(results[i], enc); |
| 51 } | 50 } |
| 52 Expect.equals(CryptoUtils.bytesToBase64(longLine.codeUnits, 76), | 51 Expect.equals(CryptoUtils.bytesToBase64(longLine.codeUnits, 76), |
| 53 longLineResult); | 52 longLineResult); |
| 54 Expect.equals(CryptoUtils.bytesToBase64(longLine.codeUnits), | 53 Expect.equals(CryptoUtils.bytesToBase64(longLine.codeUnits), |
| 55 longLineResultNoBreak); | 54 longLineResultNoBreak); |
| 56 } | 55 } |
| OLD | NEW |