> So, why would we want to write mathematics any differently?
I think you're stretching the unit-test-to-mathematics analogy a little too far.I haven't looked at the book in question, but generally, you don't just "know if" your solution is correct, you prove it, or at least consider examples that can demonstrate if your solution works in some conceivable cases. That's how "unit tests" work in mathematics.
If the book has armed you with enough knowledge to work though a problem to the end, it has done it's job. The real test will come as you build on that knowledge later on in the book or in real-life applications.
Moreover, it's not like this stuff is obscure knowledge. You can find help online or by looking at other books or connecting with others.