Over the weekend I published an update to my Floating Point to Hex calculator that allows you to swap the endianness of the hex bytes! Pretty exciting, no? (the answer is: meh)
It was actually more work than it looks like, because I decided to go ahead and update the backing script to Python 3, which meant I had to recompile the C module it uses. When I was about to start doing this I was disappointed to see that I didn’t have any tests in the project, so I went ahead and wrote those before changing everything. And even before I started changing things I found a few bugs (oh negative zero, you are tricky), so it was time well-spent!
I did have to refactor a few things to make the script testable, but I can’t imagine doing a refactor with only the help of spot-checking things, which is what I used to do. Just like writing clean code, writing tests is useful for future you as well as others!