Comments (4)
That solved the issue, thanks. btw the following snippet suggests a property-based testing method that can generate a large number of random list of ints to make sure that the end result of the diff algorithm is correct. It could be useful for you to add some test units like this:
import 'package:collection/collection.dart';
import 'package:diffutil_dart/diffutil.dart';
import 'package:fpdart/fpdart.dart';
main() {
List<int> randomIntList(int maxLength) => List.generate(
randomInt(0, maxLength).run(), (_) => randomInt(0, 10000).run());
({List<int> init, List<int> expected}) randomIntListPair() =>
(init: randomIntList(100), expected: randomIntList(200));
final tenThousandTestCases = List.generate(10000, (_) => randomIntListPair());
// ensuring property: b.equals(applyDiffs(a, diff(a, b)))
final result = tenThousandTestCases
.map((t) => t.expected.equals(applyDiffs(
t.init,
calculateListDiff(t.init, t.expected, detectMoves: true)
.getUpdatesWithData(),
)))
.fold(
(success: 0, failure: 0),
(state, testUnit) => switch (testUnit) {
true => (success: state.success + 1, failure: state.failure),
false => (success: state.success, failure: state.failure + 1),
});
print(result); // prints (failure: 0, success: 10000), it's all good now :)
}
applyDiffs(...)...
from diffutil.dart.
Thanks! I'll add something like that when I have time!
I published 4.0.1 with the fix from #22
from diffutil.dart.
i'm on the master branch btw, since i encountered the endless loop issue in 4.0.0.
from diffutil.dart.
thanks! you can try out the potential fix in #22
from diffutil.dart.
Related Issues (10)
- getUpdatesWithData - change return type from Iterable to List HOT 5
- DataChange not dispatched when value in List changes HOT 12
- Insertion order with `getUpdatesWithData` HOT 11
- Removing 2 consecutive elements from a list returns incorrect updates HOT 1
- While loop runs forever HOT 2
- Nice Idea about DiffUtil
- Option for computing in an isolate HOT 3
- Different result with batched parameter when one list is empty HOT 4
- RangeError (index): Invalid value: Not in inclusive range HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from diffutil.dart.