Git Product home page Git Product logo

Comments (4)

MHQB avatar MHQB commented on August 11, 2024 1

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.

knaeckeKami avatar knaeckeKami commented on August 11, 2024 1

Thanks! I'll add something like that when I have time!

I published 4.0.1 with the fix from #22

from diffutil.dart.

MHQB avatar MHQB commented on August 11, 2024

i'm on the master branch btw, since i encountered the endless loop issue in 4.0.0.

from diffutil.dart.

knaeckeKami avatar knaeckeKami commented on August 11, 2024

thanks! you can try out the potential fix in #22

from diffutil.dart.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.