| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 import 'dart:async'; | 5 import 'dart:async'; |
| 6 import 'package:observe/observe.dart'; | 6 import 'package:observe/observe.dart'; |
| 7 import 'package:unittest/unittest.dart'; | 7 import 'package:unittest/unittest.dart'; |
| 8 import 'observe_test_utils.dart'; | 8 import 'observe_test_utils.dart'; |
| 9 | 9 |
| 10 // This file contains code ported from: | 10 // This file contains code ported from: |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 observeArray(model); | 261 observeArray(model); |
| 262 model.addAll([1, 2, 3]); | 262 model.addAll([1, 2, 3]); |
| 263 assertEditDistance(model, 3); | 263 assertEditDistance(model, 3); |
| 264 }); | 264 }); |
| 265 | 265 |
| 266 observeTest('trunacte and add, sharing a contiguous block', () { | 266 observeTest('trunacte and add, sharing a contiguous block', () { |
| 267 var model = toObservable(['x', 'x', 'x', 'x', '1', '2', '3']); | 267 var model = toObservable(['x', 'x', 'x', 'x', '1', '2', '3']); |
| 268 observeArray(model); | 268 observeArray(model); |
| 269 model.length = 0; | 269 model.length = 0; |
| 270 model.addAll(['1', '2', '3', 'y', 'y', 'y', 'y']); | 270 model.addAll(['1', '2', '3', 'y', 'y', 'y', 'y']); |
| 271 assertEditDistance(model, 7); | 271 assertEditDistance(model, 8); |
| 272 }); | 272 }); |
| 273 | 273 |
| 274 observeTest('truncate and add, sharing a discontiguous block', () { | 274 observeTest('truncate and add, sharing a discontiguous block', () { |
| 275 var model = toObservable(['1', '2', '3', '4', '5']); | 275 var model = toObservable(['1', '2', '3', '4', '5']); |
| 276 observeArray(model); | 276 observeArray(model); |
| 277 model.length = 0; | 277 model.length = 0; |
| 278 model.addAll(['a', '2', 'y', 'y', '4', '5', 'z', 'z']); | 278 model.addAll(['a', '2', 'y', 'y', '4', '5', 'z', 'z']); |
| 279 assertEditDistance(model, 8); | 279 assertEditDistance(model, 7); |
| 280 }); | 280 }); |
| 281 | 281 |
| 282 observeTest('insert at beginning and end', () { | 282 observeTest('insert at beginning and end', () { |
| 283 var model = toObservable([2, 3, 4]); | 283 var model = toObservable([2, 3, 4]); |
| 284 observeArray(model); | 284 observeArray(model); |
| 285 model.insert(0, 5); | 285 model.insert(0, 5); |
| 286 model[2] = 6; | 286 model[2] = 6; |
| 287 model.add(7); | 287 model.add(7); |
| 288 assertEditDistance(model, 4); | 288 assertEditDistance(model, 4); |
| 289 }); | 289 }); |
| 290 }); | 290 }); |
| 291 } | 291 } |
| OLD | NEW |