One of the hardest problems in software testing is finding convenient, strong oracles—programs that can tell us whether the software under test worked correctly. Weak oracles, such as checking to make sure a program doesn’t crash, are always available, but not always of much use. An example of a strong oracle would be a reference implementation.
Here’s a list of common function/inverse pairs that I came up with:
- pickle/unpickle, or save/load, of in-memory data
- checkpoint/restore of process or virtual machine state
- assemble/disassemble and compile/decompile
- encode/decode of data for transmission
- compress/decompress, either lossless or lossy
The thing I would like to learn from you readers is what other function/inverse pairs you can think of. I feel like I must be missing many.
This topic was suggested by Alastair Reid who additionally suggested that an assembler/disassembler pair for an architecture such as ARM could be exhaustively tested in this fashion since there are only 232 possible instruction words. Very cool!