Tools such as NCover and the Haskell Program Coverage tool, it can ensure our honesty when it comes to tests, and we get a glaring reminder when we don't. These tools, when combined with our traditional xUnit and property-based tests with saturation test generation can be a satisfying experience. We've now covered the creation and combination of traditional xUnit tests with property-based tests and how to leverage code coverage as a tool for refining. There is still more to be covered in this series which includes refactoring.
In the functional programming world, we have two main ways of testing our code, either through the traditional xUnit tests or the more powerful QuickCheck property-based tests. Each of these are powerful in their own right, but made more powerful when combined into a single unit. When combined we have the power of integrating them into our CI process through some of the build/package tools in our tool belt.
Avalda FPGA Developer compiles "quoted" F# programs. Quotations are a feature in F# in which you wrap an F# expression in the quotation operators "<@@" and "@@>" so that the expression is treated like data and can be manipulated as such. The Avalda FPGA Developer api then allows the quoted expression to be translated to an XML encoding suitable for the core Avalda FPGA Developer compiler tool. So, write the following program and go to "Build" -> "Build GCDTutorial" to build a dll called gcdtutorial.dll: #light "off" namespace GCDTutorial type GCD = class static member gcdprogram = <@@ let rec gcd( (m : int), (n : int) ) = if m = 0 then n else gcd( n % m, m) in () @@> end