Chromium Code Reviews| Index: tests/lib/crypto/base64_test.dart |
| diff --git a/tests/lib/crypto/base64_test.dart b/tests/lib/crypto/base64_test.dart |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..93ab13b990d15aa08a1f5715b71592df9d6fa2a1 |
| --- /dev/null |
| +++ b/tests/lib/crypto/base64_test.dart |
| @@ -0,0 +1,21 @@ |
| +// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| +// for details. All rights reserved. Use of this source code is governed by a |
| +// BSD-style license that can be found in the LICENSE file. |
| + |
| +// Library tag to allow the test to run on Dartium. |
| +#library('base64_test'); |
| + |
| +#import("dart:crypto"); |
| + |
| +// Data from http://tools.ietf.org/html/rfc4648. |
| +var inputs = |
| + const [ '', 'f', 'fo', 'foo', 'foob', 'fooba', 'foobar' ]; |
| +var results = |
| + const [ '', 'Zg==', 'Zm8=', 'Zm9v', 'Zm9vYg==', 'Zm9vYmE=', 'Zm9vYmFy' ]; |
|
Søren Gjesse
2012/05/30 13:40:08
There is a longer example in tests/standalone/cryp
Mads Ager (google)
2012/05/30 15:16:10
Thanks!
|
| + |
| +void main() { |
| + for (var i = 0; i < inputs.length; i++) { |
| + var enc = CryptoUtils.bytesToBase64(inputs[i].charCodes()); |
| + Expect.equals(results[i], enc); |
| + } |
| +} |