OLD | NEW |
1 dart_library.library('corelib/collection_test', null, /* Imports */[ | 1 dart_library.library('corelib/collection_test', null, /* Imports */[ |
2 'dart_sdk', | 2 'dart_sdk', |
3 'expect' | 3 'expect' |
4 ], function load__collection_test(exports, dart_sdk, expect) { | 4 ], function load__collection_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 collection = dart_sdk.collection; | 7 const collection = dart_sdk.collection; |
8 const dart = dart_sdk.dart; | 8 const dart = dart_sdk.dart; |
9 const dartx = dart_sdk.dartx; | 9 const dartx = dart_sdk.dartx; |
10 const expect$ = expect.expect; | 10 const expect$ = expect.expect; |
11 const collection_test = Object.create(null); | 11 const collection_test = Object.create(null); |
| 12 let SetOfint = () => (SetOfint = dart.constFn(core.Set$(core.int)))(); |
12 let dynamicAnddynamicTodynamic = () => (dynamicAnddynamicTodynamic = dart.cons
tFn(dart.definiteFunctionType(dart.dynamic, [dart.dynamic, dart.dynamic])))(); | 13 let dynamicAnddynamicTodynamic = () => (dynamicAnddynamicTodynamic = dart.cons
tFn(dart.definiteFunctionType(dart.dynamic, [dart.dynamic, dart.dynamic])))(); |
13 let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionT
ype(dart.dynamic, [])))(); | 14 let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionT
ype(dart.dynamic, [])))(); |
14 collection_test.CollectionTest = class CollectionTest extends core.Object { | 15 collection_test.CollectionTest = class CollectionTest extends core.Object { |
15 new(iterable) { | 16 new(iterable) { |
16 this.testFold(iterable); | 17 this.testFold(iterable); |
17 } | 18 } |
18 testFold(iterable) { | 19 testFold(iterable) { |
19 expect$.Expect.equals(28, iterable[dartx.fold](dart.dynamic)(0, dart.fn((p
rev, element) => dart.dsend(prev, '+', element), dynamicAnddynamicTodynamic())))
; | 20 expect$.Expect.equals(28, iterable[dartx.fold](dart.dynamic)(0, dart.fn((p
rev, element) => dart.dsend(prev, '+', element), dynamicAnddynamicTodynamic())))
; |
20 expect$.Expect.equals(3024, iterable[dartx.fold](dart.dynamic)(1, dart.fn(
(prev, element) => dart.dsend(prev, '*', element), dynamicAnddynamicTodynamic())
)); | 21 expect$.Expect.equals(3024, iterable[dartx.fold](dart.dynamic)(1, dart.fn(
(prev, element) => dart.dsend(prev, '*', element), dynamicAnddynamicTodynamic())
)); |
21 } | 22 } |
22 }; | 23 }; |
23 dart.setSignature(collection_test.CollectionTest, { | 24 dart.setSignature(collection_test.CollectionTest, { |
24 constructors: () => ({new: dart.definiteFunctionType(collection_test.Collect
ionTest, [core.Iterable])}), | 25 constructors: () => ({new: dart.definiteFunctionType(collection_test.Collect
ionTest, [core.Iterable])}), |
25 methods: () => ({testFold: dart.definiteFunctionType(dart.void, [core.Iterab
le])}) | 26 methods: () => ({testFold: dart.definiteFunctionType(dart.void, [core.Iterab
le])}) |
26 }); | 27 }); |
27 let const$; | 28 let const$; |
28 collection_test.main = function() { | 29 collection_test.main = function() { |
29 let TEST_ELEMENTS = const$ || (const$ = dart.constList([4, 2, 6, 7, 9], core
.int)); | 30 let TEST_ELEMENTS = const$ || (const$ = dart.constList([4, 2, 6, 7, 9], core
.int)); |
30 new collection_test.CollectionTest(TEST_ELEMENTS); | 31 new collection_test.CollectionTest(TEST_ELEMENTS); |
31 let fixedList = core.List.new(TEST_ELEMENTS[dartx.length]); | 32 let fixedList = core.List.new(TEST_ELEMENTS[dartx.length]); |
32 for (let i = 0; i < dart.notNull(TEST_ELEMENTS[dartx.length]); i++) { | 33 for (let i = 0; i < dart.notNull(TEST_ELEMENTS[dartx.length]); i++) { |
33 fixedList[dartx.set](i, TEST_ELEMENTS[dartx.get](i)); | 34 fixedList[dartx.set](i, TEST_ELEMENTS[dartx.get](i)); |
34 } | 35 } |
35 new collection_test.CollectionTest(fixedList); | 36 new collection_test.CollectionTest(fixedList); |
36 new collection_test.CollectionTest(core.List.from(TEST_ELEMENTS)); | 37 new collection_test.CollectionTest(core.List.from(TEST_ELEMENTS)); |
37 new collection_test.CollectionTest(core.Set.from(TEST_ELEMENTS)); | 38 new collection_test.CollectionTest(SetOfint().from(TEST_ELEMENTS)); |
38 new collection_test.CollectionTest(collection.Queue.from(TEST_ELEMENTS)); | 39 new collection_test.CollectionTest(collection.Queue.from(TEST_ELEMENTS)); |
39 }; | 40 }; |
40 dart.fn(collection_test.main, VoidTodynamic()); | 41 dart.fn(collection_test.main, VoidTodynamic()); |
41 // Exports: | 42 // Exports: |
42 exports.collection_test = collection_test; | 43 exports.collection_test = collection_test; |
43 }); | 44 }); |
OLD | NEW |