Re:There Are Only Four Billion Floats–So Test Them All (2014)
by ben0x539 on Thursday February 09, 2023 @04:57PM
(#34732154)
A while back for some videogame related data processing I ended up writing a "regular number to roman numeral" (or maybe the other way around) function in idk ruby or something. Not super convinced that I had gotten it right, I sat down to write a few tests, and then I realized I only needed it to work for numbers up to like 16. So I deleted the actual code, extended the table of test cases to cover 1 through 20 just in case, and just did a lookup in that.
[ Parent
| on HN ]
Re:There Are Only Four Billion Floats–So Test Them All (2014)
by SnowHill9902 on Thursday February 09, 2023 @05:35PM
(#34732655)
That’s actually the right solution to that specific problem.
Re:There Are Only Four Billion Floats–So Test Them All (2014)
by giraffe_lady on Thursday February 09, 2023 @05:02PM
(#34732234)
true senior eng shit right there.
Re:There Are Only Four Billion Floats–So Test Them All (2014)
by travisjungroth on Thursday February 09, 2023 @08:14PM
(#34734314)
It happens. Writing the test puts you in the headspace of “assume the problem is already solved”, which is sometimes wildly more effective. There’s some story (that I hope an archivist can link) of someone writing a shell script to verify some giant program. Well, turns out the script could just _replace_ the program. Ran way faster. Sales wouldn’t have that, though.