OLD | NEW |
1 dart_library.library('corelib/shuffle_test', null, /* Imports */[ | 1 dart_library.library('corelib/shuffle_test', null, /* Imports */[ |
2 'dart_sdk', | 2 'dart_sdk', |
3 'expect' | 3 'expect' |
4 ], function load__shuffle_test(exports, dart_sdk, expect) { | 4 ], function load__shuffle_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 _interceptors = dart_sdk._interceptors; | 7 const _interceptors = dart_sdk._interceptors; |
8 const typed_data = dart_sdk.typed_data; | 8 const typed_data = dart_sdk.typed_data; |
9 const math = dart_sdk.math; | 9 const math = dart_sdk.math; |
10 const dart = dart_sdk.dart; | 10 const dart = dart_sdk.dart; |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 combos = combos * fact; | 106 combos = combos * fact; |
107 } | 107 } |
108 } | 108 } |
109 if (!dart.test(listsDifferent())) { | 109 if (!dart.test(listsDifferent())) { |
110 expect$.Expect.fail(dart.str`Didn't shuffle at all, p < 1:1e80: ${list}`); | 110 expect$.Expect.fail(dart.str`Didn't shuffle at all, p < 1:1e80: ${list}`); |
111 } | 111 } |
112 }; | 112 }; |
113 dart.fn(shuffle_test.testShuffle, dynamicTovoid()); | 113 dart.fn(shuffle_test.testShuffle, dynamicTovoid()); |
114 shuffle_test.testRandom = function() { | 114 shuffle_test.testRandom = function() { |
115 let randomNums = JSArrayOfint().of([37, 87, 42, 157, 252, 17]); | 115 let randomNums = JSArrayOfint().of([37, 87, 42, 157, 252, 17]); |
116 let numbers = core.List.generate(25, dart.fn(x => x, intToint())); | 116 let numbers = ListOfint().generate(25, dart.fn(x => x, intToint())); |
117 let l1 = numbers[dartx.toList](); | 117 let l1 = numbers[dartx.toList](); |
118 l1[dartx.shuffle](new shuffle_test.MockRandom(ListOfint()._check(randomNums)
)); | 118 l1[dartx.shuffle](new shuffle_test.MockRandom(ListOfint()._check(randomNums)
)); |
119 for (let i = 0; i < 50; i++) { | 119 for (let i = 0; i < 50; i++) { |
120 let l2 = numbers[dartx.toList](); | 120 let l2 = numbers[dartx.toList](); |
121 l2[dartx.shuffle](new shuffle_test.MockRandom(ListOfint()._check(randomNum
s))); | 121 l2[dartx.shuffle](new shuffle_test.MockRandom(ListOfint()._check(randomNum
s))); |
122 expect$.Expect.listEquals(l1, l2); | 122 expect$.Expect.listEquals(l1, l2); |
123 } | 123 } |
124 }; | 124 }; |
125 dart.fn(shuffle_test.testRandom, VoidTodynamic()); | 125 dart.fn(shuffle_test.testRandom, VoidTodynamic()); |
126 const _values = Symbol('_values'); | 126 const _values = Symbol('_values'); |
(...skipping 23 matching lines...) Expand all Loading... |
150 constructors: () => ({new: dart.definiteFunctionType(shuffle_test.MockRandom
, [core.List$(core.int)])}), | 150 constructors: () => ({new: dart.definiteFunctionType(shuffle_test.MockRandom
, [core.List$(core.int)])}), |
151 methods: () => ({ | 151 methods: () => ({ |
152 nextInt: dart.definiteFunctionType(core.int, [core.int]), | 152 nextInt: dart.definiteFunctionType(core.int, [core.int]), |
153 nextDouble: dart.definiteFunctionType(core.double, []), | 153 nextDouble: dart.definiteFunctionType(core.double, []), |
154 nextBool: dart.definiteFunctionType(core.bool, []) | 154 nextBool: dart.definiteFunctionType(core.bool, []) |
155 }) | 155 }) |
156 }); | 156 }); |
157 // Exports: | 157 // Exports: |
158 exports.shuffle_test = shuffle_test; | 158 exports.shuffle_test = shuffle_test; |
159 }); | 159 }); |
OLD | NEW |