Do you have a problem? Write a compiler
Years ago I was at a trading firm where I needed to write a test suite for our <i>order entry</i> system (the software that sends orders to a stock exchange). Tests could become quite large because I had to track the sequence of acknowledgments and executions from the test exchange.<p>The tests would have been a real pain to write in C++, so I created my own language! It was inspired by both Expect and Cucumber.<p><a href="https://en.wikipedia.org/wiki/Expect" rel="nofollow">https://en.wikipedia.org/wiki/Expect</a><p><a href="https://cucumber.io/docs" rel="nofollow">https://cucumber.io/docs</a><p>That allowed me to write a simple script of expected behavior, like:<p><pre><code>    test "Cross own order"
    -> new buy IBM 100 $141.01 1
      <- ack 1
    -> new sell IBM 200 $141.00 2
      <- ack 2
      <- trade 1 100 $141.01
      <- trade 2 100 $141.01
</code></pre>
My interpreter would run the above script against the exchange's UAT environment.<p>The tests could get pretty sophisticated. I could investigate swanky exchange-specific order types by verifying queue position, liquidity flags, etc. By writing these test scripts, I could verify (1) that my order entry code was correct and (2) that I actually understood what the exchanges were doing with my orders.<p>These test scripts had another added benefit in that traders now had executable documentation. So whenever a hypothetical scenario came up, I could write a script to verify that our assumptions were correct and then email the script's code as a precise set of steps that the exchange was taking.<p>I ended up writing the whole language in Boost.Spirit, which admittedly was a beast. But I still believe that creating a testing language was the right thing to do.