Counting opcodes

A friend of mine recently asked me to write a disassembler for the hd6309 microprocessor. Since I had already taken the m6809 disassembler in MAME and reconfigured it into a 6309 disassembler I decided to start with that work.
It turned out to be pretty easy to deMAMEify the disassembler. But after I was done, how did I know I didn’t break it? So I decided to write some test code to disassemble every 6309 opcode, including every variation of 6309 opcode. I use the unix regex library to determine if the disassembly was correct. For every opcode of every addressing mode I write a pattern, and then compare it to the resulting disassemble.
So far I have 12 opcodes begin disassembled and this results in 4,011,927 different tests. And I already found numerous bugs from the original work. They’ll need to be back ported into the hd6309 MAME disassembler.
Now I am finishing this task just to see how many opcode variations there are!