VTest

Program testing can be a very effective way to show the presence of bugs, but it is hopelessly inadequate for showing their absence.

Edsger Dijkstra - The Humble Programmer (1972)

VTest is designed to allow you to see bugs that you did not anticipate. It does this by visualizing the results of function, and clustering their results. The goal is to show you the absence of bugs, in order to do this, the functions being tested have to be pure, and testing may be slow for functions that take complex objects. For the time being, I’m focusing on primitives only.

This pulls together Haskell’s QuickCheck, and a few other testing frameworks. In the future I’d like to have it set so you can specify invariants, for easier checking but that’s not a priority. The use case is a testing system to go along with your normal testing framework.

Part of the reason for this is that generating random data for testing requires time, especially for through testing, then we have to run a dimensionality reduction program to visualize the results.

Simple Example

Here we’re looking at the python function startswith. Yes, this is incredibly simplistic. 1 represents truth and 0 falsity. We’re testing the function on all possible 3 length strings, in order to see how it behaves. The particular function here is s.startswith("g") or s.startswith("&"), we can see here that it returns true from &!! to &~~ and g!! to g~~. Great thats exactly what we wanted.

Simple Demo

This obviously works for math as well. Here’s x^3/3

Math Demo