Commits

Matt Oswald committed 2c1bd20

Edited online

Comments (0)

Files changed (1)

-== Welcome ==
+= xUnit++ =
+xUnit++ is a unit testing platform for C++ inspired by [[http://xunit.codeplex.com|xUnit.Net]].
 
-Welcome to your wiki! This is the default page we've installed for your convenience. Go ahead and edit it.
+== About ==
+xUnit++ borrows heavily from xUnit.net, which means it has the same strengths. It is built to support Test Driven Development, with a goal of being as simple and flexible as possible, without sacrificing features found in modern unit testing platforms. It is compatible with Visual Studio 2012 (and includes integration with the IDE's test explorer window) and gcc (tested on Ubuntu Linux).
 
-=== Wiki features ===
+=== Quick Start ===
+Let's look at a simple example:
+{{{
+#!c++
+#include "xUnit++.h"
 
-This wiki uses the [[http://www.wikicreole.org/|Creole]] syntax, and is fully compatible with the 1.0 specification.
+int Double(int x)
+{
+   return x * 2;
+}
 
-The wiki itself is actually a mercurial repository, which means you can clone it, edit it locally/offline, add images or any other file type, and push it back to us. It will be live immediately.
+FACT(DoublingTwoReturnsFour)
+{
+   auto expected = 4;
+   Assert.Equal(expected, Double(2));
+}
+}}}
 
-Go ahead and try:
+Now, this is obviously a contrived example, not to mention the code under test is //incorrect//. A typical suite of unit tests for a C++ function like this would want to include multiple checks like the following:
 
 {{{
-$ hg clone https://bitbucket.org/moswald/xunit/wiki
+#!c++
+
+FACT(DoublingOneReturnsTwo)
+{
+   auto expected = 2;
+   Assert.Equal(expected, Double(1));
+}
+
+FACT(DoublingNegativeOneReturnsNegativeTwo)
+{
+   auto expected = -2;
+   Assert.Equal(expected, Double(-1));
+}
 }}}
 
-Wiki pages are normal files, with the .wiki extension. You can edit them locally, as well as creating new ones.
-
-=== Syntax highlighting ===
-
-You can also highlight snippets of text, we use the excellent [[http://www.pygments.org/|Pygments]] library.
-
-Here's an example of some Python code:
+Now you've got a couple of tests that are going to expose the error in the function {{{Double}}}, but boy is that annoying to have to write all those different tests that are pretty much the same thing repeated over and over. There's got to be a better way, and with xUnit++, there is:
 
 {{{
-#!python
+#!c++
+#include "xUnit++.h"
 
-def wiki_rocks(text):
-    formatter = lambda t: "funky"+t
-    return formatter(text)
-}}}
+int Double(int x)
+{
+   return x * x;
+}
 
-You can check out the source of this page to see how that's done, and make sure to bookmark [[http://pygments.org/docs/lexers/|the vast library of Pygment lexers]], we accept the 'short name' or the 'mimetype' of anything in there.
+THEORY_PROVIDER(DoubleTestData, int, int)
+   THEORY_DATA(1, 2)
+   THEORY_DATA(2, 4)
+   THEORY_DATA(-1, -2)
+   THEORY_DATA(0, 0)
+THEORY_PROVIDER_END
 
-Have fun!
+THEORY(DoubleTest, (int value, int expected), DoubleTestData)
+{
+   Assert.Equal(expected, Double(value));
+}
+}}}