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("dart:crypto"); | 8 #import("dart:crypto"); |
9 | 9 |
10 // Data from http://tools.ietf.org/html/rfc4648. | 10 // Data from http://tools.ietf.org/html/rfc4648. |
(...skipping 27 matching lines...) Expand all Loading... |
38 "BhbmltYWxzLCB3aGljaCBpcyBhIGx1c3Qgb2Yg" | 38 "BhbmltYWxzLCB3aGljaCBpcyBhIGx1c3Qgb2Yg" |
39 "dGhlIG1pbmQsIHRoYXQgYnkgYSBwZXJzZXZlcm" | 39 "dGhlIG1pbmQsIHRoYXQgYnkgYSBwZXJzZXZlcm" |
40 "FuY2Ugb2YgZGVsaWdodCBpbiB0aGUgY29udGlu" | 40 "FuY2Ugb2YgZGVsaWdodCBpbiB0aGUgY29udGlu" |
41 "dWVkIGFuZCBpbmRlZmF0aWdhYmxlIGdlbmVyYX" | 41 "dWVkIGFuZCBpbmRlZmF0aWdhYmxlIGdlbmVyYX" |
42 "Rpb24gb2Yga25vd2xlZGdlLCBleGNlZWRzIHRo" | 42 "Rpb24gb2Yga25vd2xlZGdlLCBleGNlZWRzIHRo" |
43 "ZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm" | 43 "ZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm" |
44 "5hbCBwbGVhc3VyZS4="; | 44 "5hbCBwbGVhc3VyZS4="; |
45 | 45 |
46 void main() { | 46 void main() { |
47 for (var i = 0; i < inputs.length; i++) { | 47 for (var i = 0; i < inputs.length; i++) { |
48 var enc = CryptoUtils.bytesToBase64(inputs[i].charCodes()); | 48 var enc = CryptoUtils.bytesToBase64(inputs[i].charCodes); |
49 Expect.equals(results[i], enc); | 49 Expect.equals(results[i], enc); |
50 } | 50 } |
51 Expect.equals(CryptoUtils.bytesToBase64(longLine.charCodes(), 76), | 51 Expect.equals(CryptoUtils.bytesToBase64(longLine.charCodes, 76), |
52 longLineResult); | 52 longLineResult); |
53 Expect.equals(CryptoUtils.bytesToBase64(longLine.charCodes()), | 53 Expect.equals(CryptoUtils.bytesToBase64(longLine.charCodes), |
54 longLineResultNoBreak); | 54 longLineResultNoBreak); |
55 } | 55 } |
OLD | NEW |