Code Duel to learn more about Pex and Code Contracts
Tuesday, June 28, 2011 10:05 AM
Here is a fun little C# Duel:
http://pexforfun.com/Default.aspx (click Random Puzzle)
I solved my first one in just 1 try (compilations) so it doesn’t take long to try.
What is Pex and how does it work?
Basically Pex is a tool to help you write Unit Tests by actually calculating all of the permutations of a function and assisting you in creating unit tests that should deterministically “prove” that function. When used in conjunction with another tool called Code Contracts (a little bit down on the page) more information can be expressed about the intent of the function which Pex can then use to help prove by unit tests. The neat thing about Code Contracts is that it’s part documentation, part unit test in its self.
If you want to see it in action, you can try it here:
This is a branch of computer science called Static Analysis & Verification and is the future of computing in our field.