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

Side by Side Diff: test/codegen/expect/lib/convert/chunked_conversion_utf8_test.js

Issue 2128353002: Check in codegen test expectations. (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 4 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
OLDNEW
(Empty)
1 dart_library.library('lib/convert/chunked_conversion_utf8_test', null, /* Import s */[
2 'dart_sdk',
3 'expect'
4 ], function load__chunked_conversion_utf8_test(exports, dart_sdk, expect) {
5 'use strict';
6 const core = dart_sdk.core;
7 const convert = dart_sdk.convert;
8 const _interceptors = dart_sdk._interceptors;
9 const dart = dart_sdk.dart;
10 const dartx = dart_sdk.dartx;
11 const expect$ = expect.expect;
12 const chunked_conversion_utf8_test = Object.create(null);
13 const unicode_tests = Object.create(null);
14 let SinkOfString = () => (SinkOfString = dart.constFn(core.Sink$(core.String)) )();
15 let ListOfint = () => (ListOfint = dart.constFn(core.List$(core.int)))();
16 let ListOfObject = () => (ListOfObject = dart.constFn(core.List$(core.Object)) )();
17 let JSArrayOfObject = () => (JSArrayOfObject = dart.constFn(_interceptors.JSAr ray$(core.Object)))();
18 let ListOfList = () => (ListOfList = dart.constFn(core.List$(core.List)))();
19 let ListOfintAndintToString = () => (ListOfintAndintToString = dart.constFn(da rt.definiteFunctionType(core.String, [ListOfint(), core.int])))();
20 let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionT ype(dart.dynamic, [])))();
21 let ListOfObjectToListOfObject = () => (ListOfObjectToListOfObject = dart.cons tFn(dart.definiteFunctionType(ListOfObject(), [ListOfObject()])))();
22 let VoidToListOfList = () => (VoidToListOfList = dart.constFn(dart.definiteFun ctionType(ListOfList(), [])))();
23 chunked_conversion_utf8_test.decode = function(bytes, chunkSize) {
24 let buffer = new core.StringBuffer();
25 let stringSink = convert.StringConversionSink.fromStringSink(buffer);
26 let byteSink = new convert.Utf8Decoder().startChunkedConversion(SinkOfString ()._check(stringSink));
27 let i = 0;
28 while (i < dart.notNull(bytes[dartx.length])) {
29 let nextChunk = [];
30 for (let j = 0; j < dart.notNull(chunkSize); j++) {
31 if (i < dart.notNull(bytes[dartx.length])) {
32 nextChunk[dartx.add](bytes[dartx.get](i));
33 i++;
34 }
35 }
36 byteSink.add(ListOfint()._check(nextChunk));
37 }
38 byteSink.close();
39 return buffer.toString();
40 };
41 dart.fn(chunked_conversion_utf8_test.decode, ListOfintAndintToString());
42 chunked_conversion_utf8_test.main = function() {
43 for (let test of unicode_tests.UNICODE_TESTS) {
44 let bytes = dart.dindex(test, 0);
45 let expected = dart.dindex(test, 1);
46 expect$.Expect.stringEquals(core.String._check(expected), chunked_conversi on_utf8_test.decode(ListOfint()._check(bytes), 1));
47 expect$.Expect.stringEquals(core.String._check(expected), chunked_conversi on_utf8_test.decode(ListOfint()._check(bytes), 2));
48 expect$.Expect.stringEquals(core.String._check(expected), chunked_conversi on_utf8_test.decode(ListOfint()._check(bytes), 3));
49 expect$.Expect.stringEquals(core.String._check(expected), chunked_conversi on_utf8_test.decode(ListOfint()._check(bytes), 4));
50 }
51 };
52 dart.fn(chunked_conversion_utf8_test.main, VoidTodynamic());
53 unicode_tests.INTER_BYTES = dart.constList([195, 142, 195, 177, 197, 163, 195, 169, 114, 195, 177, 195, 165, 197, 163, 195, 174, 195, 182, 195, 177, 195, 165, 196, 188, 195, 174, 197, 190, 195, 165, 197, 163, 195, 174, 225, 187, 157, 195, 177], core.int);
54 unicode_tests.INTER_STRING = "Îñţérñåţîöñåļîžåţîờñ";
55 unicode_tests.BLUEBERRY_BYTES = dart.constList([98, 108, 195, 165, 98, 195, 16 6, 114, 103, 114, 195, 184, 100], core.int);
56 unicode_tests.BLUEBERRY_STRING = "blåbærgrød";
57 unicode_tests.SIVA_BYTES1 = dart.constList([224, 174, 154, 224, 174, 191, 224, 174, 181, 224, 174, 190, 32, 224, 174, 133, 224, 174, 163, 224, 174, 190, 224, 174, 174, 224, 174, 190, 224, 175, 136, 224, 174, 178], core.int);
58 unicode_tests.SIVA_STRING1 = "சிவா அணாமாைல";
59 unicode_tests.SIVA_BYTES2 = dart.constList([224, 164, 191, 224, 164, 184, 224, 164, 181, 224, 164, 190, 32, 224, 164, 133, 224, 164, 163, 224, 164, 190, 224, 164, 174, 224, 164, 190, 224, 164, 178, 224, 165, 136], core.int);
60 unicode_tests.SIVA_STRING2 = "िसवा अणामालै";
61 unicode_tests.BEE_BYTES = dart.constList([240, 144, 144, 146], core.int);
62 unicode_tests.BEE_STRING = "𐐒";
63 unicode_tests.DIGIT_BYTES = dart.constList([53], core.int);
64 unicode_tests.DIGIT_STRING = "5";
65 unicode_tests.ASCII_BYTES = dart.constList([97, 98, 99, 100, 101, 102, 103, 10 4, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 12 0, 121, 122], core.int);
66 unicode_tests.ASCII_STRING = "abcdefghijklmnopqrstuvwxyz";
67 unicode_tests.BIGGEST_ASCII_BYTES = dart.constList([127], core.int);
68 unicode_tests.BIGGEST_ASCII_STRING = "";
69 unicode_tests.SMALLEST_2_UTF8_UNIT_BYTES = dart.constList([194, 128], core.int );
70 unicode_tests.SMALLEST_2_UTF8_UNIT_STRING = "€";
71 unicode_tests.BIGGEST_2_UTF8_UNIT_BYTES = dart.constList([223, 191], core.int) ;
72 unicode_tests.BIGGEST_2_UTF8_UNIT_STRING = "߿";
73 unicode_tests.SMALLEST_3_UTF8_UNIT_BYTES = dart.constList([224, 160, 128], cor e.int);
74 unicode_tests.SMALLEST_3_UTF8_UNIT_STRING = "ࠀ";
75 unicode_tests.BIGGEST_3_UTF8_UNIT_BYTES = dart.constList([239, 191, 191], core .int);
76 unicode_tests.BIGGEST_3_UTF8_UNIT_STRING = "￿";
77 unicode_tests.SMALLEST_4_UTF8_UNIT_BYTES = dart.constList([240, 144, 128, 128] , core.int);
78 unicode_tests.SMALLEST_4_UTF8_UNIT_STRING = "𐀀";
79 unicode_tests.BIGGEST_4_UTF8_UNIT_BYTES = dart.constList([244, 143, 191, 191], core.int);
80 unicode_tests.BIGGEST_4_UTF8_UNIT_STRING = "􏿿";
81 unicode_tests._TEST_PAIRS = dart.constList([dart.constList([dart.constList([], dart.dynamic), ""], core.Object), dart.constList([unicode_tests.INTER_BYTES, un icode_tests.INTER_STRING], core.Object), dart.constList([unicode_tests.BLUEBERRY _BYTES, unicode_tests.BLUEBERRY_STRING], core.Object), dart.constList([unicode_t ests.SIVA_BYTES1, unicode_tests.SIVA_STRING1], core.Object), dart.constList([uni code_tests.SIVA_BYTES2, unicode_tests.SIVA_STRING2], core.Object), dart.constLis t([unicode_tests.BEE_BYTES, unicode_tests.BEE_STRING], core.Object), dart.constL ist([unicode_tests.DIGIT_BYTES, unicode_tests.DIGIT_STRING], core.Object), dart. constList([unicode_tests.ASCII_BYTES, unicode_tests.ASCII_STRING], core.Object), dart.constList([unicode_tests.BIGGEST_ASCII_BYTES, unicode_tests.BIGGEST_ASCII_ STRING], core.Object), dart.constList([unicode_tests.SMALLEST_2_UTF8_UNIT_BYTES, unicode_tests.SMALLEST_2_UTF8_UNIT_STRING], core.Object), dart.constList([unico de_tests.BIGGEST_2_UTF8_UNIT_BYTES, unicode_tests.BIGGEST_2_UTF8_UNIT_STRING], c ore.Object), dart.constList([unicode_tests.SMALLEST_3_UTF8_UNIT_BYTES, unicode_t ests.SMALLEST_3_UTF8_UNIT_STRING], core.Object), dart.constList([unicode_tests.B IGGEST_3_UTF8_UNIT_BYTES, unicode_tests.BIGGEST_3_UTF8_UNIT_STRING], core.Object ), dart.constList([unicode_tests.SMALLEST_4_UTF8_UNIT_BYTES, unicode_tests.SMALL EST_4_UTF8_UNIT_STRING], core.Object), dart.constList([unicode_tests.BIGGEST_4_U TF8_UNIT_BYTES, unicode_tests.BIGGEST_4_UTF8_UNIT_STRING], core.Object)], ListOf Object());
82 unicode_tests._expandTestPairs = function() {
83 dart.assert(2 == unicode_tests.BEE_STRING[dartx.length]);
84 let tests = [];
85 tests[dartx.addAll](unicode_tests._TEST_PAIRS);
86 tests[dartx.addAll](unicode_tests._TEST_PAIRS[dartx.map](ListOfObject())(dar t.fn(test => {
87 let bytes = test[dartx.get](0);
88 let string = test[dartx.get](1);
89 let longBytes = [];
90 let longString = "";
91 for (let i = 0; i < 100; i++) {
92 longBytes[dartx.addAll](core.Iterable._check(bytes));
93 longString = dart.notNull(longString) + dart.notNull(core.String._check( string));
94 }
95 return JSArrayOfObject().of([longBytes, longString]);
96 }, ListOfObjectToListOfObject())));
97 return ListOfList()._check(tests);
98 };
99 dart.fn(unicode_tests._expandTestPairs, VoidToListOfList());
100 dart.defineLazy(unicode_tests, {
101 get UNICODE_TESTS() {
102 return unicode_tests._expandTestPairs();
103 }
104 });
105 // Exports:
106 exports.chunked_conversion_utf8_test = chunked_conversion_utf8_test;
107 exports.unicode_tests = unicode_tests;
108 });
OLDNEW
« no previous file with comments | « test/codegen/expect/lib/convert/chunked_conversion_utf89_test.js ('k') | test/codegen/expect/lib/convert/close_test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698