OLD | NEW |
1 dart_library.library('corelib/collection_to_string_test', null, /* Imports */[ | 1 dart_library.library('corelib/collection_to_string_test', null, /* Imports */[ |
2 'dart_sdk', | 2 'dart_sdk', |
3 'expect' | 3 'expect' |
4 ], function load__collection_to_string_test(exports, dart_sdk, expect) { | 4 ], function load__collection_to_string_test(exports, dart_sdk, expect) { |
5 'use strict'; | 5 'use strict'; |
6 const core = dart_sdk.core; | 6 const core = dart_sdk.core; |
7 const math = dart_sdk.math; | 7 const math = dart_sdk.math; |
8 const _interceptors = dart_sdk._interceptors; | 8 const _interceptors = dart_sdk._interceptors; |
9 const collection = dart_sdk.collection; | 9 const collection = dart_sdk.collection; |
10 const dart = dart_sdk.dart; | 10 const dart = dart_sdk.dart; |
11 const dartx = dart_sdk.dartx; | 11 const dartx = dart_sdk.dartx; |
12 const expect$ = expect.expect; | 12 const expect$ = expect.expect; |
13 const collection_to_string_test = Object.create(null); | 13 const collection_to_string_test = Object.create(null); |
14 let JSArrayOfint = () => (JSArrayOfint = dart.constFn(_interceptors.JSArray$(c
ore.int)))(); | 14 let JSArrayOfint = () => (JSArrayOfint = dart.constFn(_interceptors.JSArray$(c
ore.int)))(); |
15 let JSArrayOfString = () => (JSArrayOfString = dart.constFn(_interceptors.JSAr
ray$(core.String)))(); | 15 let JSArrayOfString = () => (JSArrayOfString = dart.constFn(_interceptors.JSAr
ray$(core.String)))(); |
16 let ListOfint = () => (ListOfint = dart.constFn(core.List$(core.int)))(); | 16 let ListOfint = () => (ListOfint = dart.constFn(core.List$(core.int)))(); |
17 let JSArrayOfListOfint = () => (JSArrayOfListOfint = dart.constFn(_interceptor
s.JSArray$(ListOfint())))(); | 17 let JSArrayOfListOfint = () => (JSArrayOfListOfint = dart.constFn(_interceptor
s.JSArray$(ListOfint())))(); |
| 18 let MapOfString$int = () => (MapOfString$int = dart.constFn(core.Map$(core.Str
ing, core.int)))(); |
18 let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionT
ype(dart.dynamic, [])))(); | 19 let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionT
ype(dart.dynamic, [])))(); |
19 let VoidTovoid = () => (VoidTovoid = dart.constFn(dart.definiteFunctionType(da
rt.void, [])))(); | 20 let VoidTovoid = () => (VoidTovoid = dart.constFn(dart.definiteFunctionType(da
rt.void, [])))(); |
20 let intAndStringBuffer__ToObject = () => (intAndStringBuffer__ToObject = dart.
constFn(dart.definiteFunctionType(core.Object, [core.int, core.StringBuffer], {e
xact: core.bool})))(); | 21 let intAndStringBuffer__ToObject = () => (intAndStringBuffer__ToObject = dart.
constFn(dart.definiteFunctionType(core.Object, [core.int, core.StringBuffer], {e
xact: core.bool})))(); |
21 let intAndboolAndStringBuffer__ToObject = () => (intAndboolAndStringBuffer__To
Object = dart.constFn(dart.definiteFunctionType(core.Object, [core.int, core.boo
l, core.StringBuffer, core.List])))(); | 22 let intAndboolAndStringBuffer__ToObject = () => (intAndboolAndStringBuffer__To
Object = dart.constFn(dart.definiteFunctionType(core.Object, [core.int, core.boo
l, core.StringBuffer, core.List])))(); |
22 let intAndboolAndStringBuffer__ToList = () => (intAndboolAndStringBuffer__ToLi
st = dart.constFn(dart.definiteFunctionType(core.List, [core.int, core.bool, cor
e.StringBuffer, core.List])))(); | 23 let intAndboolAndStringBuffer__ToList = () => (intAndboolAndStringBuffer__ToLi
st = dart.constFn(dart.definiteFunctionType(core.List, [core.int, core.bool, cor
e.StringBuffer, core.List])))(); |
23 let intAndboolAndStringBuffer__ToQueue = () => (intAndboolAndStringBuffer__ToQ
ueue = dart.constFn(dart.definiteFunctionType(collection.Queue, [core.int, core.
bool, core.StringBuffer, core.List])))(); | 24 let intAndboolAndStringBuffer__ToQueue = () => (intAndboolAndStringBuffer__ToQ
ueue = dart.constFn(dart.definiteFunctionType(collection.Queue, [core.int, core.
bool, core.StringBuffer, core.List])))(); |
24 let intAndboolAndStringBuffer__ToSet = () => (intAndboolAndStringBuffer__ToSet
= dart.constFn(dart.definiteFunctionType(core.Set, [core.int, core.bool, core.S
tringBuffer, core.List])))(); | 25 let intAndboolAndStringBuffer__ToSet = () => (intAndboolAndStringBuffer__ToSet
= dart.constFn(dart.definiteFunctionType(core.Set, [core.int, core.bool, core.S
tringBuffer, core.List])))(); |
25 let intAndboolAndStringBuffer__ToMap = () => (intAndboolAndStringBuffer__ToMap
= dart.constFn(dart.definiteFunctionType(core.Map, [core.int, core.bool, core.S
tringBuffer, core.List])))(); | 26 let intAndboolAndStringBuffer__ToMap = () => (intAndboolAndStringBuffer__ToMap
= dart.constFn(dart.definiteFunctionType(core.Map, [core.int, core.bool, core.S
tringBuffer, core.List])))(); |
26 let intAndboolAndStringBuffer__Todynamic = () => (intAndboolAndStringBuffer__T
odynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.int, core.
bool, core.StringBuffer, core.List, dart.dynamic, core.String])))(); | 27 let intAndboolAndStringBuffer__Todynamic = () => (intAndboolAndStringBuffer__T
odynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.int, core.
bool, core.StringBuffer, core.List, dart.dynamic, core.String])))(); |
27 let intAndboolAndStringBuffer__ToSet$ = () => (intAndboolAndStringBuffer__ToSe
t$ = dart.constFn(dart.definiteFunctionType(core.Set, [core.int, core.bool, core
.StringBuffer, core.List, core.Set])))(); | 28 let intAndboolAndStringBuffer__ToSet$ = () => (intAndboolAndStringBuffer__ToSe
t$ = dart.constFn(dart.definiteFunctionType(core.Set, [core.int, core.bool, core
.StringBuffer, core.List, core.Set])))(); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 expect$.Expect.equals(dart.toString(JSArrayOfString().of(['I', 'II'])), '[I,
II]'); | 67 expect$.Expect.equals(dart.toString(JSArrayOfString().of(['I', 'II'])), '[I,
II]'); |
67 expect$.Expect.equals(dart.toString(JSArrayOfListOfint().of([JSArrayOfint().
of([1, 2]), JSArrayOfint().of([3, 4]), JSArrayOfint().of([5, 6])])), '[[1, 2], [
3, 4], [5, 6]]'); | 68 expect$.Expect.equals(dart.toString(JSArrayOfListOfint().of([JSArrayOfint().
of([1, 2]), JSArrayOfint().of([3, 4]), JSArrayOfint().of([5, 6])])), '[[1, 2], [
3, 4], [5, 6]]'); |
68 expect$.Expect.equals(dart.toString(const$ || (const$ = dart.constList([], d
art.dynamic))), '[]'); | 69 expect$.Expect.equals(dart.toString(const$ || (const$ = dart.constList([], d
art.dynamic))), '[]'); |
69 expect$.Expect.equals(dart.toString(const$0 || (const$0 = dart.constList([1]
, core.int))), '[1]'); | 70 expect$.Expect.equals(dart.toString(const$0 || (const$0 = dart.constList([1]
, core.int))), '[1]'); |
70 expect$.Expect.equals(dart.toString(const$1 || (const$1 = dart.constList(['E
lvis'], core.String))), '[Elvis]'); | 71 expect$.Expect.equals(dart.toString(const$1 || (const$1 = dart.constList(['E
lvis'], core.String))), '[Elvis]'); |
71 expect$.Expect.equals(dart.toString(const$2 || (const$2 = dart.constList([nu
ll], dart.dynamic))), '[null]'); | 72 expect$.Expect.equals(dart.toString(const$2 || (const$2 = dart.constList([nu
ll], dart.dynamic))), '[null]'); |
72 expect$.Expect.equals(dart.toString(const$3 || (const$3 = dart.constList([1,
2], core.int))), '[1, 2]'); | 73 expect$.Expect.equals(dart.toString(const$3 || (const$3 = dart.constList([1,
2], core.int))), '[1, 2]'); |
73 expect$.Expect.equals(dart.toString(const$4 || (const$4 = dart.constList(['I
', 'II'], core.String))), '[I, II]'); | 74 expect$.Expect.equals(dart.toString(const$4 || (const$4 = dart.constList(['I
', 'II'], core.String))), '[I, II]'); |
74 expect$.Expect.equals(dart.toString(const$8 || (const$8 = dart.constList([co
nst$5 || (const$5 = dart.constList([1, 2], core.int)), const$6 || (const$6 = dar
t.constList([3, 4], core.int)), const$7 || (const$7 = dart.constList([5, 6], cor
e.int))], ListOfint()))), '[[1, 2], [3, 4], [5, 6]]'); | 75 expect$.Expect.equals(dart.toString(const$8 || (const$8 = dart.constList([co
nst$5 || (const$5 = dart.constList([1, 2], core.int)), const$6 || (const$6 = dar
t.constList([3, 4], core.int)), const$7 || (const$7 = dart.constList([5, 6], cor
e.int))], ListOfint()))), '[[1, 2], [3, 4], [5, 6]]'); |
75 expect$.Expect.equals(dart.toString(dart.map()), '{}'); | 76 expect$.Expect.equals(dart.toString(dart.map()), '{}'); |
76 expect$.Expect.equals(dart.toString(dart.map({Elvis: 'King'})), '{Elvis: Kin
g}'); | 77 expect$.Expect.equals(dart.toString(dart.map({Elvis: 'King'}, core.String, c
ore.String)), '{Elvis: King}'); |
77 expect$.Expect.equals(dart.toString(dart.map({Elvis: null})), '{Elvis: null}
'); | 78 expect$.Expect.equals(dart.toString(dart.map({Elvis: null}, core.String, dar
t.dynamic)), '{Elvis: null}'); |
78 expect$.Expect.equals(dart.toString(dart.map({I: 1, II: 2})), '{I: 1, II: 2}
'); | 79 expect$.Expect.equals(dart.toString(dart.map({I: 1, II: 2}, core.String, cor
e.int)), '{I: 1, II: 2}'); |
79 expect$.Expect.equals(dart.toString(dart.map({X: dart.map({I: 1, II: 2}), Y:
dart.map({III: 3, IV: 4}), Z: dart.map({V: 5, VI: 6})})), '{X: {I: 1, II: 2}, Y
: {III: 3, IV: 4}, Z: {V: 5, VI: 6}}'); | 80 expect$.Expect.equals(dart.toString(dart.map({X: dart.map({I: 1, II: 2}, cor
e.String, core.int), Y: dart.map({III: 3, IV: 4}, core.String, core.int), Z: dar
t.map({V: 5, VI: 6}, core.String, core.int)}, core.String, MapOfString$int())),
'{X: {I: 1, II: 2}, Y: {III: 3, IV: 4}, Z: {V: 5, VI: 6}}'); |
80 expect$.Expect.equals(dart.toString(const$9 || (const$9 = dart.const(dart.ma
p()))), '{}'); | 81 expect$.Expect.equals(dart.toString(const$9 || (const$9 = dart.const(dart.ma
p()))), '{}'); |
81 expect$.Expect.equals(dart.toString(const$10 || (const$10 = dart.const(dart.
map({Elvis: 'King'})))), '{Elvis: King}'); | 82 expect$.Expect.equals(dart.toString(const$10 || (const$10 = dart.const(dart.
map({Elvis: 'King'}, core.String, core.String)))), '{Elvis: King}'); |
82 expect$.Expect.equals(dart.toString(dart.map({Elvis: null})), '{Elvis: null}
'); | 83 expect$.Expect.equals(dart.toString(dart.map({Elvis: null}, core.String, dar
t.dynamic)), '{Elvis: null}'); |
83 expect$.Expect.equals(dart.toString(const$11 || (const$11 = dart.const(dart.
map({I: 1, II: 2})))), '{I: 1, II: 2}'); | 84 expect$.Expect.equals(dart.toString(const$11 || (const$11 = dart.const(dart.
map({I: 1, II: 2}, core.String, core.int)))), '{I: 1, II: 2}'); |
84 expect$.Expect.equals(dart.toString(const$15 || (const$15 = dart.const(dart.
map({X: const$12 || (const$12 = dart.const(dart.map({I: 1, II: 2}))), Y: const$1
3 || (const$13 = dart.const(dart.map({III: 3, IV: 4}))), Z: const$14 || (const$1
4 = dart.const(dart.map({V: 5, VI: 6})))})))), '{X: {I: 1, II: 2}, Y: {III: 3, I
V: 4}, Z: {V: 5, VI: 6}}'); | 85 expect$.Expect.equals(dart.toString(const$15 || (const$15 = dart.const(dart.
map({X: const$12 || (const$12 = dart.const(dart.map({I: 1, II: 2}, core.String,
core.int))), Y: const$13 || (const$13 = dart.const(dart.map({III: 3, IV: 4}, cor
e.String, core.int))), Z: const$14 || (const$14 = dart.const(dart.map({V: 5, VI:
6}, core.String, core.int)))}, core.String, MapOfString$int())))), '{X: {I: 1,
II: 2}, Y: {III: 3, IV: 4}, Z: {V: 5, VI: 6}}'); |
85 }; | 86 }; |
86 dart.fn(collection_to_string_test.smokeTest, VoidTovoid()); | 87 dart.fn(collection_to_string_test.smokeTest, VoidTovoid()); |
87 collection_to_string_test.exactTest = function() { | 88 collection_to_string_test.exactTest = function() { |
88 for (let i = 0; i < collection_to_string_test.NUM_TESTS; i++) { | 89 for (let i = 0; i < collection_to_string_test.NUM_TESTS; i++) { |
89 let size = math.sqrt(collection_to_string_test.random(collection_to_string
_test.MAX_COLLECTION_SIZE * collection_to_string_test.MAX_COLLECTION_SIZE))[dart
x.toInt](); | 90 let size = math.sqrt(collection_to_string_test.random(collection_to_string
_test.MAX_COLLECTION_SIZE * collection_to_string_test.MAX_COLLECTION_SIZE))[dart
x.toInt](); |
90 let stringRep = new core.StringBuffer(); | 91 let stringRep = new core.StringBuffer(); |
91 let o = collection_to_string_test.randomCollection(size, stringRep, {exact
: true}); | 92 let o = collection_to_string_test.randomCollection(size, stringRep, {exact
: true}); |
92 core.print(stringRep); | 93 core.print(stringRep); |
93 core.print(o); | 94 core.print(o); |
94 expect$.Expect.equals(dart.toString(o), stringRep.toString()); | 95 expect$.Expect.equals(dart.toString(o), stringRep.toString()); |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 dart.fn(collection_to_string_test.randomBool, VoidTobool()); | 264 dart.fn(collection_to_string_test.randomBool, VoidTobool()); |
264 collection_to_string_test.alphagram = function(s) { | 265 collection_to_string_test.alphagram = function(s) { |
265 let chars = s[dartx.codeUnits][dartx.toList](); | 266 let chars = s[dartx.codeUnits][dartx.toList](); |
266 chars[dartx.sort](dart.fn((a, b) => dart.notNull(a) - dart.notNull(b), intAn
dintToint())); | 267 chars[dartx.sort](dart.fn((a, b) => dart.notNull(a) - dart.notNull(b), intAn
dintToint())); |
267 return core.String.fromCharCodes(chars); | 268 return core.String.fromCharCodes(chars); |
268 }; | 269 }; |
269 dart.fn(collection_to_string_test.alphagram, StringToString()); | 270 dart.fn(collection_to_string_test.alphagram, StringToString()); |
270 // Exports: | 271 // Exports: |
271 exports.collection_to_string_test = collection_to_string_test; | 272 exports.collection_to_string_test = collection_to_string_test; |
272 }); | 273 }); |
OLD | NEW |