News for hackers. Stuff that matters.
Re:Ask HN: What is your best advice for a developer to write... by khedoros on Wednesday June 29, 2016 @03:46PM (#12004249)
It's perfectly possible to write a function with a small enough set of arguments to make it practical to exhaustively test.
Re:Ask HN: What is your best advice for a developer to write... by StrykerKKD on Wednesday June 29, 2016 @04:15PM (#12004455)
Well it's possible, but how many developer would rather make a new type for using the first ten integer instead of just using int?

I think random testing is a good way to get almost exhaustively tests.

Re:Ask HN: What is your best advice for a developer to write... by khedoros on Wednesday June 29, 2016 @04:27PM (#12004558)
A developer that uses a narrower integer data type, or who wants to be clear that the argument is a member of an enumerated set of options, not an integer. What kind of developer represents non-integer data as an integer data type?

> I think random testing is a good way to get almost exhaustively tests.

I think that testing known/predictable edge and corner cases makes more sense (in some cases), but I also think that I was responding to a comment about the impossibility of using tests to prove correctness of a function, not about how to derive practical benefits despite theoretical limitations.

Re:Ask HN: What is your best advice for a developer to write... by StrykerKKD on Wednesday June 29, 2016 @05:01PM (#12004785)
You are right, I didn't think the example through.

You are right, you can use tests to prove a function if - the function has very limited arguments and - the function is pure or does very limited amount of state change(side effect)

Generally speaking tests are not the right tool for proving program correctness.

Re:Ask HN: What is your best advice for a developer to write... by 8note on Wednesday June 29, 2016 @08:46PM (#12005905)
integers are frequently used to represent fixed point numbers anytime you're doing interesting math in an embedded system
Re:Ask HN: What is your best advice for a developer to write... by khedoros on Wednesday June 29, 2016 @11:23PM (#12006367)
And old PC hardware, where you aren't guaranteed to have an FPU, or where integer operations were a lot quicker than FP ones.