Hacker News new | ask | show | jobs
by derefr 4335 days ago
I don’t know what you’re talking about, but it isn’t function composition. Function composition consumes outputs as it produces inputs, in equal measure — in f(g(x)), the domain of f is bounded by the codomain of g, which is itself bounded by x. If g has three branches, but f always outputs a value that takes the first branch, then g will only ever follow one branch in your test; you won’t get a combinatoric explosion of possible branches taken.

You might be thinking more of testing several expressions independently, e.g. assert([f(x), g(x)] == […]). This does what you’re talking about, but I don’t think anybody (including the author of the post) was recommending this.