-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfeatures.html
More file actions
129 lines (115 loc) · 4.75 KB
/
features.html
File metadata and controls
129 lines (115 loc) · 4.75 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
---
title: CUTE Features
layout: default
active: features
permalink: /features/
---
<div class="jumbotron">
<div class="container">
<h1>Features <small>– what's inside?</small></h1>
</div>
</div>
<div class="container">
<div class="row featurette">
<div class="col-md-8">
<h1>Tests with Relational Inequality Operators</h1>
<p>CUTE provides macros for comparing for inequality that will populate the nice diff view in the plug-in with the values compared. Look for example at the following test:</p>
{% highlight c++ %}
void test_cute_assert_greater_equal_success() {
int const x = 4;
int const y = 4;
ASSERT_GREATER_EQUAL(x, y);
}{% endhighlight %}
<p>Other examples are:</p>
<ul>
<li>ASSERT_EQUAL, ASSERT_EQUAL_DELTA, ASSERT_EQUAL_RANGES</li>
<li>ASSERT_GREATER, ASSERT_GREATER_EQUAL</li>
<li>ASSERT_LESS, ASSERT_LESS_EQUAL</li>
<li>ASSERT_THROWS, FAIL</li>
<li>ASSERT_NOT_EQUAL_TO</li>
</ul>
</div>
<div class="col-md-4">
<img class="featurette-image img-responsive" src="../img/cute-diff-view.png" alt="CUTE Eclipse Plug-in Diff View" style="margin-top: 50px;">
<p class="img-caption">The CUTE Eclipse Plug-in results and diff view.</p>
</div>
</div>
<hr class="featurette-divider">
<div class="row featurette">
<div class="col-md-4">
<h1>Data-Driven Tests</h1>
<p>Write table-driven tests that tell you the location of the table input in addition to the tests function name. Clicking on a failed test will put you into the table entry that caused the failure. If everything works fine, you end up on the table-interpreting function.</p>
<ul>
<li>DDT, DDTM</li>
<li>ASSERT_EQUAL_DDT</li>
</ul>
</div>
<div class="col-md-8">
{% highlight c++ %}
struct testInputData {
double input;
double expected;
cute::test_failure failure;
} const dataTable [] = {
{ 4 , 16 , DDT() },
{ 2.5, 6.25, DDTM("compare well?") }
};
double square(double x) {
return x * x;
}
void test_cute_data_driven_equality_demo() {
for (auto const & testEntry : dataTable) {
ASSERT_EQUAL_DDT(testEntry.expected, square(testEntry.input), testEntry.failure);
}
}{% endhighlight %}
</div>
</div>
<hr class="featurette-divider">
<div class="row featurette">
<div class="col-md-8">
<img class="featurette-image img-responsive" src="../img/rerun-selected-test.png" alt="Rerun Selected Test" style="margin-top: 30px;">
<p class="img-caption">Rerun a selected test in the CUTE Eclipse Plug-in.</p>
</div>
<div class="col-md-4">
<h1>Test Filtering</h1>
<p>Run or rerun single tests by providing a suite name, a hash symbol # and the test name as arguments to the command line. For example:</p>
{% highlight bash %}
$ cutest 'AllTests#thisIsATest'{% endhighlight %}
<p>Of course, the Eclipse plug-in provides a more convenient method to rerun failing tests.</p>
</div>
</div>
<hr class="featurette-divider">
<div class="row featurette">
<div class="col-md-3">
<h1>XML Output</h1>
<p>CUTE creates XML files named like the test program. If you pass argc as zero, the filename will be testresult.xml. This makes it more convenient to put your test executable into the build process of a build server that expects JUnit-compatible XML format, such as Jenkins.</p>
</div>
<div class="col-md-9">
{% highlight xml %}
<testsuites>
<testsuite name="AllTests" tests="2">
<testcase classname="AllTests" name="thisIsATest">
<failure message="../src/Test.cpp:7 thisIsATest: start writing tests">
thisIsATest: start writing tests
</failure>
</testcase>
<testcase classname="AllTests" name="thisIsAnotherTest">
<failure message="../src/Test.cpp:11 thisIsAnotherTest: start writing tests">
thisIsAnotherTest: start writing tests
</failure>
</testcase>
</testsuite>
</testsuites>{% endhighlight %}
</div>
</div>
<hr class="featurette-divider">
<div class="row featurette">
<div class="col-md-12">
<h1>CUTE Tests on Small Embedded Devices</h1>
<p>This is an experimental feature to allow running CUTE tests using ASSERT_EQUAL to run on limited hardware, where using iostream for numeric conversions is too expensive. If you compile your CUTE tests using...</p>
{% highlight bash %}
#define DONT_USE_IOSTREAM 1{% endhighlight %}
<p>...respectively the compiler command-line setting of the macro with "-DDONT_USE_IOSTREAM=1" then CUTE shouldn't include iostream headers. However, you might need to adjust your main function or runner as well, for example, to pass the output of the tests over a serial line instead. Feedback on the feasibility of that feature is highly welcome.</p>
</div>
</div>
</div>