There is not really a difference in software. The 'what' is defined by the 'how'. Imagine you had a very clear idea of the 'what', so complete that it could be used to test every possible output of the 'how' -- in which case, you already know all the answers and you don't need to have that 'how'. (The purpose of software is to produce stuff you don't already know.)
You can compare the 'what's of two 'how's -- that is what testing is doing.
Hm, I think of testing as more of knowing a couple of 'what's' and checking whether our 'how' correctly reaches them. There's an infinite number of 'what's' and we obviously can't test them all, but with testing we generally take a hopefully useful sample of 'what's' and make sure that our 'how' reaches them correctly.
There is a style of testing where you devise two algorithms for the same thing and check whether they both reach the same result. I'm rather dubious of that style.
You can compare the 'what's of two 'how's -- that is what testing is doing.