1. 4

    The short answer is no. It’s a very hard problem in general.

    The longer answer would be it depends. I am not aware of any such tool, but if the pieces of code over which you want to run such an analysis use a very specific subset of javascript in a very specific way, then it might be doable.

    If you want to test the equivalence of pure functions, generative testing (e.g. QuickCheck in Haskell) could also be used.

    1. 1

      If you want to test the equivalence of pure functions, generative testing (e.g. QuickCheck in Haskell) could also be used.

      Sadly, there’s very little in the way of pure functions to be found in this particular codebase. If I could snapshot the program state at the entry and exit points of a function I was refactoring, and then replace the old code with the new, I might be able to glean some insight. But that seems… hard 🤔

      1. 2

        you can introduce seams, to use the WEwLC language, by turning the relevant state into input to the function and turning any relevant mutations into output that get applied once the functions has returned. Now you do have a pure function whose behaviour can be captured in tests.

        BTW if that feels like too big a leap to make in one go, look at introducing proxyquire into your tests, which lets you replace any dependencies when you set up your fixtures. We use a combination of proxyquire and sinon at work where we need to test that a function performs some expected external action.

    1. 1

      How is this possible? The theoretical lower bound on sorting is O(n*log(n)) (without knowledge of the structure of the data); machine learning or not.

      1. 2

        I suspect that the training phase encodes knowledge of the structure of the data into an algorithm that only works on similar data.

        1. 2

          In that case the title is very, very misleading :º

          1. 1

            Yeah, I don’t think the claims in this paper would be accepted as-written if the authors submitted it to a machine-learning conference or journal. You can title a paper anything you want on arXiv though, for better or worse.