OLD | NEW |
1 dart_library.library('corelib/collection_from_test', null, /* Imports */[ | 1 dart_library.library('corelib/collection_from_test', null, /* Imports */[ |
2 'dart_sdk', | 2 'dart_sdk', |
3 'expect' | 3 'expect' |
4 ], function load__collection_from_test(exports, dart_sdk, expect) { | 4 ], function load__collection_from_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_from_test = Object.create(null); | 11 const collection_from_test = Object.create(null); |
12 let SetOfint = () => (SetOfint = dart.constFn(core.Set$(core.int)))(); | 12 let SetOfint = () => (SetOfint = dart.constFn(core.Set$(core.int)))(); |
13 let ListOfint = () => (ListOfint = dart.constFn(core.List$(core.int)))(); | 13 let ListOfint = () => (ListOfint = dart.constFn(core.List$(core.int)))(); |
14 let QueueOfint = () => (QueueOfint = dart.constFn(collection.Queue$(core.int))
)(); | 14 let QueueOfint = () => (QueueOfint = dart.constFn(collection.Queue$(core.int))
)(); |
15 let dynamicTovoid = () => (dynamicTovoid = dart.constFn(dart.definiteFunctionT
ype(dart.void, [dart.dynamic])))(); | 15 let dynamicTovoid = () => (dynamicTovoid = dart.constFn(dart.definiteFunctionT
ype(dart.void, [dart.dynamic])))(); |
16 let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionT
ype(dart.dynamic, [])))(); | 16 let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionT
ype(dart.dynamic, [])))(); |
17 collection_from_test.CollectionFromTest = class CollectionFromTest extends cor
e.Object { | 17 collection_from_test.CollectionFromTest = class CollectionFromTest extends cor
e.Object { |
18 static testMain() { | 18 static testMain() { |
19 let set = SetOfint().new(); | 19 let set = SetOfint().new(); |
20 set.add(1); | 20 set.add(1); |
21 set.add(2); | 21 set.add(2); |
22 set.add(4); | 22 set.add(4); |
23 collection_from_test.CollectionFromTest.check(set, ListOfint().from(set)); | 23 collection_from_test.CollectionFromTest.check(set, ListOfint().from(set)); |
24 collection_from_test.CollectionFromTest.check(set, core.List.from(set)); | 24 collection_from_test.CollectionFromTest.check(set, core.List.from(set)); |
25 collection_from_test.CollectionFromTest.check(set, QueueOfint().from(set))
; | 25 collection_from_test.CollectionFromTest.check(set, QueueOfint().from(set))
; |
26 collection_from_test.CollectionFromTest.check(set, collection.Queue.from(s
et)); | 26 collection_from_test.CollectionFromTest.check(set, collection.Queue.from(s
et)); |
27 collection_from_test.CollectionFromTest.check(set, SetOfint().from(set)); | 27 collection_from_test.CollectionFromTest.check(set, SetOfint().from(set)); |
28 collection_from_test.CollectionFromTest.check(set, core.Set.from(set)); | 28 collection_from_test.CollectionFromTest.check(set, SetOfint().from(set)); |
29 } | 29 } |
30 static check(initial, other) { | 30 static check(initial, other) { |
31 expect$.Expect.equals(3, initial[dartx.length]); | 31 expect$.Expect.equals(3, initial[dartx.length]); |
32 expect$.Expect.equals(initial[dartx.length], other[dartx.length]); | 32 expect$.Expect.equals(initial[dartx.length], other[dartx.length]); |
33 let initialSum = 0; | 33 let initialSum = 0; |
34 let otherSum = 0; | 34 let otherSum = 0; |
35 initial[dartx.forEach](dart.fn(e => { | 35 initial[dartx.forEach](dart.fn(e => { |
36 initialSum = dart.notNull(initialSum) + dart.notNull(core.int._check(e))
; | 36 initialSum = dart.notNull(initialSum) + dart.notNull(core.int._check(e))
; |
37 }, dynamicTovoid())); | 37 }, dynamicTovoid())); |
38 other[dartx.forEach](dart.fn(e => { | 38 other[dartx.forEach](dart.fn(e => { |
(...skipping 10 matching lines...) Expand all Loading... |
49 }), | 49 }), |
50 names: ['testMain', 'check'] | 50 names: ['testMain', 'check'] |
51 }); | 51 }); |
52 collection_from_test.main = function() { | 52 collection_from_test.main = function() { |
53 collection_from_test.CollectionFromTest.testMain(); | 53 collection_from_test.CollectionFromTest.testMain(); |
54 }; | 54 }; |
55 dart.fn(collection_from_test.main, VoidTodynamic()); | 55 dart.fn(collection_from_test.main, VoidTodynamic()); |
56 // Exports: | 56 // Exports: |
57 exports.collection_from_test = collection_from_test; | 57 exports.collection_from_test = collection_from_test; |
58 }); | 58 }); |
OLD | NEW |