Learn More
Please note that GitHub no longer supports Internet Explorer versions 7 or 8.

We recommend upgrading to Internet Explorer 9, Google Chrome, or Firefox.

If you are using IE 9 already, make sure you turn off "Compatibility View".

ntak
file 53 lines (40 sloc) 0.929 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include "unittest.h"
#include <sstream>

namespace cons {

unittest unittests;

namespace {
template<typename T> std::string make_error_message(T x) {
std::stringstream out;
out << x->classname();
out << "(" << x->description() << ")";
out << ": ";
return out.str();
}
}

failure::failure(const char * x) : std::logic_error(x) {
}

failure::failure(const std::string & x) : std::logic_error(x) {
}

void throw_if_true(bool flag, std::string desc) {
if(flag) throw failure(desc);
}

void throw_if_false(bool flag, std::string desc) {
if(!flag) throw failure(desc);
}

std::vector<test_base *> & tests() {
static std::vector<test_base *> dst;
return dst;
}

std::vector<std::string> unittest::run() {
std::vector<std::string> dst;
for(auto I : tests()) {
try {
I->invoke();
} catch(const failure & x) {
dst.push_back(make_error_message(I) + x.what());
}
}
return dst;
}

}

// (c) 2012 Strictsoft

Markdown Cheat Sheet

Format Text

Headers

# This is an <h1> tag
## This is an <h2> tag
###### This is an <h6> tag

Text styles

*This text will be italic*
_This will also be italic_
**This text will be bold**
__This will also be bold__

*You **can** combine them*

Lists

Unordered

* Item 1
* Item 2
  * Item 2a
  * Item 2b

Ordered

1. Item 1
2. Item 2
3. Item 3
   * Item 3a
   * Item 3b

Miscellaneous

Images

![GitHub Logo](/images/logo.png)
Format: ![Alt Text](url)

Links

http://github.com - automatic!
[GitHub](http://github.com)

Blockquotes

As Kanye West said:

> We're living the future so
> the present is our past.

Code Examples in Markdown

Syntax highlighting with GFM

```javascript
function fancyAlert(arg) {
  if(arg) {
    $.facebox({div:'#foo'})
  }
}
```

Or, indent your code 4 spaces

Here is a Python code example
without syntax highlighting:

    def foo:
      if not bar:
        return true

Inline code for comments

I think you should use an
`<addr>` element here instead.
Something went wrong with that request. Please try again.