3 ms·
It looks like there are two maintained implementations of this at the moment - one in C# https://github.com/j-brooke/FracturedJson/wiki/.NET-Library https://git
by simonw 10mo ago
It looks like there are two maintained implementations of this at the moment - one in C# https://github.com/j-brooke/FracturedJson/wiki/.NET-Library https://github.com/j-brooke/FracturedJson/wiki/.NET-Library and another in TypeScript/JavaScript https://github.com/j-brooke/FracturedJsonJs https://github.com/j-brooke/FracturedJsonJs. They each have their own test suite.
There's an older pure Python version but it's no longer maintained - the author of that recently replaced it with a Python library wrapping the C# code.
This looks to me like the perfect opportunity for a language-independent conformance suite - a set of tests defined as data files that can be shared across multiple implementations.
This would not only guarantee that the existing C# and TypeScript implementations behaved exactly the same way, but would also make it much easier to build and then maintain more implementations across other languages.
Interestingly the now-deprecated Python library does actually use a data-driven test suite in the kind of shape I'm describing: https://github.com/masaccio/compact-json/tree/main/tests/data https://github.com/masaccio/compact-json/tree/main/tests/dat...
That new Python library is https://pypi.org/project/fractured-json/ https://pypi.org/project/fractured-json/ but it's a wrapper around the C# library and says "You must install a valid .NET runtime" - that makes it mostly a non-starter as a dependency for other Python projects because it breaks the ability to "pip install" them without a significant extra step.
- klysm 10mo agoThis is also basically a pure function which makes it super simple to write a harness.
- odyssey7 10mo agoThis is a good idea, though I don’t think it would guarantee program equivalence beyond the test cases.
- rafabulsing 10mo agoWell yeah, but then any discrepancies that are found can be discussed (to decide which of the behaviors is the expected one) and then added as a test for all existing and future implementations.
- simonw 10mo agoDepends on how comprehensive the test suite is. And OK it's not equivalent to a formal proof, but passing 1,000+ tests that cover every aspect of the specification is pretty close from a practical perspective, especially for a visual formatting tool.
- boxed 10mo agoWith mutation testing you can guarantee that all the behavior in the code is tested.
- odyssey7 10mo agoUC Berkeley: “Top-level functional equivalence requires that, for any possible set of inputs x, the two pieces of code produce the same output. … testing, or input-output (I/O) equivalence, is the default correctness metric used by the community. … It is infeasible to guarantee full top-level functional equivalence (i.e., equivalence for any value of x) with testing since this would require testing on a number of inputs so large as to be practically infinite.” https://www2.eecs.berkeley.edu/Pubs/TechRpts/2025/EECS-2025-174.pdf https://www2.eecs.berkeley.edu/Pubs/TechRpts/2025/EECS-2025-...
- esrauch 10mo agoIn practice mutation fuzz testers are able to whitebox see where branches are in the underlying code, with a differential fuzz test under that approach its generally able to fuzz over test cases that go over all branches. So I think under some computer science theory case for arbitrary functions its not possible, but for the actual shape of behavior in question from this library I think its realistic that a decent corpus of 'real' examples and then differential fuzzing would give you more confidence that anyone has in nearly any program's correctness here on real Earth.
- odyssey7 10mo agoYes, there are different levels of sureness being described. When I hear guarantee, it makes me think of correctness proofs. Confidence is more of a practical notion for how much you trust the system for a given use case. Testing can definitely provide confidence in this scenario.
- EmilStenstrom 10mo agoData driven test suites are really good for building trust in a library. Both the html5lib-tests suite and my recent xss-bench are examples of this!
- fcoury 10mo agoJust ported it to rust and plan on maintaining it if you want to add it to your original comment. More details on a sibling comment: https://github.com/fcoury/fracturedjson-rs https://github.com/fcoury/fracturedjson-rs https://crates.io/crates/fracturedjson https://crates.io/crates/fracturedjson Comment with details: https://news.ycombinator.com/item?id=46468641 https://news.ycombinator.com/item?id=46468641
- tonixx 10mo ago[dead]