Tests and types

Brent has some thoughts on strong and weakly typed programming languages. Starting point: a simple function that needs testing:

rgbToHex(red, green, blue) {
    // …
}

Testing the result the function should return is easy. But what about edge cases?

What happens though if we pass doubles instead of integers? Or numbers outside of the allowed range? What about null? Or strings Or the wrong amount of arguments? Or a combination of the above?

Ah, the starting point for a nice article … (and no, requiring ints is not a bulletproof solution)

Tests and types →

🔥 Be sure to also check out Brent’s podcast Rant With Brent.

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.