aboutsummaryrefslogtreecommitdiffstats
path: root/vespalib/src/tests/tutorial/tutorial.html
blob: 5a9f9cb8a8a2c8f9f2ba0f7253f555318dd0035e (plain) (blame)
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
<!DOCTYPE html>
<!-- Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
<html lang="en">
<head>
  <meta charset="utf-8" />
  <title>Vespa Test Framework Tutorial</title>
# Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
  <style type="text/css">

    body {
        margin: 3em;
    }

    body, p, div, div, span, dl, li, pre {
        font-size: 16px;
        line-height: 22px;
    }

    header h1 {
        font-size: 54px;
        line-height: 1;
    }

    section {
        padding-top: 60px;
    }

    ol.linenums {
        padding-left: 20px;
    }

    pre, pre * {
        font-size: 14px !important;
    }

    li.L0, li.L1, li.L2, li.L3, li.L4, li.L5, li.L6, li.L7, li.L8, li.L9
    {
        color: #bbb;
        list-style-type: decimal;
    }

    h2 {
        padding-top: 20px;
        padding-bottom: 10px;
    }
    
    pre.output {
        border: 1px solid #888;
    }

    code {
        color: #444;
        border: 0;
        background-color: transparent;
    }

  </style>
</head>
<body>

<header>
<h1>Vespa Test Framework Tutorial</h1>
</header>

<section>
<div class="page-header">
<h1>Introduction</h1>
</div>

<p>
The Vespa test framework helps you write small applications to test
C++ code. All interaction with the test framework is done with the use
of macros.
</p>

<p>
The minimal test application looks like this:
</p>

<div class="example" id="minimal">
<h2>minimal_test.cpp</h2>
<pre class="prettyprint linenums">
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include &lt;vespa/vespalib/testkit/test_kit.h&gt;

TEST_MAIN() {}
</pre>
<pre class="output">
minimal_test.cpp: info:  running test suite 'minimal_test.cpp'
minimal_test.cpp: info:  summary --- 0 check(s) passed --- 0 check(s) failed
minimal_test.cpp: info:  CONCLUSION: PASS
</pre>
</div>

<p>
The runnable application itself is called a <strong>test
suite</strong> and inherits its name from the cpp file containing the
TEST_MAIN macro. Each individual verification of some value is called
a <strong>check</strong>. Checks can be put anywhere, but it is highly
recommended that you put them inside <strong>tests</strong>. Tests are
created by a family of macros. Another macro (TEST_RUN_ALL) is used to
execute them.
</p>

<p>
Example with two tests, each containing a single check:
</p>

<div class="example" id="simple">
<h2>simple_test.cpp</h2>
<pre class="prettyprint linenums">
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include &lt;vespa/vespalib/testkit/test_kit.h&gt;

TEST(&quot;require something&quot;) {
    EXPECT_TRUE(true);
}

TEST(&quot;require something else&quot;) {
    EXPECT_TRUE(true);
}

TEST_MAIN() { TEST_RUN_ALL(); }
</pre>
<pre class="output">
simple_test.cpp: info:  running test suite 'simple_test.cpp'
simple_test.cpp: info:  status_for_test 'require something': PASS
simple_test.cpp: info:  status_for_test 'require something else': PASS
simple_test.cpp: info:  test summary --- 2 test(s) passed --- 0 test(s) failed
simple_test.cpp: info:  imported 2 passed check(s) from 1 thread(s)
simple_test.cpp: info:  summary --- 2 check(s) passed --- 0 check(s) failed
simple_test.cpp: info:  CONCLUSION: PASS
</pre>
</div>
</section>


<section>
<div class="page-header">
<h1>Checks</h1>
</div>

<p>
All checks are available in two variants. Those with the
<strong>EXPECT_</strong> prefix allow execution to continue even if a
check fails. Those with the <strong>ASSERT_</strong> prefix will
terminate execution of the current test if it fails.
</p>

<div class="example" id="checks">
<h2>checks_test.cpp</h2>
<pre class="prettyprint linenums">
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include &lt;vespa/vespalib/testkit/test_kit.h&gt;
#include &lt;stdexcept&gt;

void willThrow() {
    throw std::runtime_error(&quot;This failed&quot;);
}

TEST(&quot;require that checks work&quot;) {
    EXPECT_TRUE(true);
    EXPECT_FALSE(false);
    EXPECT_EQUAL(3, 3);
    EXPECT_NOT_EQUAL(3, 4);
    EXPECT_APPROX(3.0, 3.1, 0.2);
    EXPECT_NOT_APPROX(3.0, 3.5, 0.2);
    EXPECT_LESS(3, 4);
    EXPECT_LESS_EQUAL(3, 3);
    EXPECT_GREATER(4, 3);
    EXPECT_GREATER_EQUAL(4, 4);
    EXPECT_EXCEPTION(willThrow(), std::runtime_error, &quot;fail&quot;);
}

TEST(&quot;this test will fail&quot;) {
    EXPECT_EQUAL(3, 4);
}

TEST_MAIN() { TEST_RUN_ALL(); }
</pre>
<pre class="output">
checks_test.cpp: info:  running test suite 'checks_test.cpp'
checks_test.cpp: info:  status_for_test 'require that checks work': PASS
checks_test.cpp: ERROR: check failure #1: '3 == 4' in thread '0(1)' (checks_test.cpp:24)
    STATE[0]: 'this test will fail' (checks_test.cpp:23)
lhs: 3
rhs: 4
checks_test.cpp: ERROR: status_for_test 'this test will fail': FAIL
checks_test.cpp: info:  test summary --- 1 test(s) passed --- 1 test(s) failed
checks_test.cpp: info:  imported 11 passed check(s) from 1 thread(s)
checks_test.cpp: info:  summary --- 11 check(s) passed --- 1 check(s) failed
checks_test.cpp: info:  CONCLUSION: FAIL
</pre>
</div>

<p>
Checks involving comparison of values typically use == and &lt;
operators to compare values. Also; in order to be part of a comparison
check, the value must support the &lt;&lt; operator to print the value
to a string stream in case the check fails.
</p>
</section>


<section>
<div class="page-header">
<h1>Test Fixtures</h1>
</div>
<p>
Sometimes multiple tests wish to use the same predefined state as a
starting point. This state is called a test fixture. Test fixtures are
untangled from the actual tests and construction/destruction is used
to handle their lifetime. When thinking of what can be used as a
fixture, think of what can be put after <strong>new</strong> to create
an object.
</p>

<ul>
<li>A single test can have multiple test fixtures.</li>
<li>The number of <strong>F</strong>s in the test macro denotes the number of fixtures.</li>
<li>Inside the test, fixtures are available as <strong>f1</strong>, <strong>f2</strong> and so forth.</li>
<li>Test fixtures can be parameterized with constructor parameters.</li>
<li>Checks can be performed inside test fixture constructors.</li>
<li>A test fixture constructor can take other test fixtures as input.</li>
</ul>

<div class="example" id="fixtures">
<h2>fixtures_test.cpp</h2>
<pre class="prettyprint linenums">
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include &lt;vespa/vespalib/testkit/test_kit.h&gt;

struct Fixture {
    int value;
    Fixture() : value(5) {}
};

TEST_F(&quot;basic fixture&quot;, Fixture) {
    EXPECT_EQUAL(5, f1.value);
}

TEST_FFF(&quot;fancy fixtures&quot;, size_t(10), int(5), std::vector&lt;int&gt;(f1, f2)) {
    EXPECT_EQUAL(10u, f1);
    EXPECT_EQUAL(5, f2);
    ASSERT_EQUAL(10u, f3.size());
    EXPECT_EQUAL(5, f3[7]);
}

TEST_MAIN() { TEST_RUN_ALL(); }
</pre>
<pre class="output">
fixtures_test.cpp: info:  running test suite 'fixtures_test.cpp'
fixtures_test.cpp: info:  status_for_test 'basic fixture': PASS
fixtures_test.cpp: info:  status_for_test 'fancy fixtures': PASS
fixtures_test.cpp: info:  test summary --- 2 test(s) passed --- 0 test(s) failed
fixtures_test.cpp: info:  imported 5 passed check(s) from 1 thread(s)
fixtures_test.cpp: info:  summary --- 5 check(s) passed --- 0 check(s) failed
fixtures_test.cpp: info:  CONCLUSION: PASS
</pre>
</div>
</section>


<section>
<div class="page-header">
<h1>Multi-Threaded Tests</h1>
</div>
<p>
One of the most novel features of the test framework is the ability to
write multi-threaded tests. Multi-threaded tests are created by using
test macros containing <strong>_MT</strong> and supplying a thread
count. All threads will execute the block of code encapsulated by the
test. The test fixtures are shared among all threads. In addition,
each thread has a variable named <strong>num_threads</strong>
containing the total number of threads running the test and a variable
named <strong>thread_id</strong> identifying the thread.
</p>

<p>
The <strong>TEST_BARRIER()</strong> macro can be used inside the test
to synchronize the threads. The macro will block execution of each
thread invoking it until all threads have invoked it.
</p>

<div class="example" id="threads">
<h2>threads_test.cpp</h2>
<pre class="prettyprint linenums">
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include &lt;vespa/vespalib/testkit/test_kit.h&gt;

TEST_MT_F(&quot;multiple threads&quot;, 2, std::vector&lt;size_t&gt;(num_threads)) {
    ASSERT_EQUAL(num_threads, f1.size());
    f1[thread_id] = thread_id;
    TEST_BARRIER();
    if (thread_id == 0) {
        TEST_TRACE();
        EXPECT_EQUAL(1u, f1[1]);
    } else {
        TEST_TRACE();
        EXPECT_EQUAL(0u, f1[0]);
    }
}

TEST_MAIN() { TEST_RUN_ALL(); }
</pre>
<pre class="output">
threads_test.cpp: info:  running test suite 'threads_test.cpp'
threads_test.cpp: info:  trace: thread '0(2)' (threads_test.cpp:9)
threads_test.cpp: info:  trace: thread '1(2)' (threads_test.cpp:12)
threads_test.cpp: info:  status_for_test 'multiple threads': PASS
threads_test.cpp: info:  test summary --- 1 test(s) passed --- 0 test(s) failed
threads_test.cpp: info:  imported 4 passed check(s) from 2 thread(s)
threads_test.cpp: info:  summary --- 4 check(s) passed --- 0 check(s) failed
threads_test.cpp: info:  CONCLUSION: PASS
</pre>
</div>
</section>


<section>
<div class="page-header">
<h1>Real World Examples</h1>
</div>
<div class="example" id="../box">
<h2>box_test.cpp</h2>
<pre class="prettyprint linenums">
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include &lt;vespa/vespalib/testkit/test_kit.h&gt;
#include &lt;vespa/vespalib/util/box.h&gt;

using namespace vespalib;

void checkValues(const std::vector&lt;int&gt; &amp;values, size_t n) {
    ASSERT_EQUAL(n, values.size());
    for (size_t i = 0; i &lt; n; ++i) {
        EXPECT_EQUAL(int(10 + (10 * i)), values[i]);
    }
}

TEST(&quot;require that boxes can be created and converted to vector&quot;) {
    Box&lt;int&gt; box;
    box.add(10).add(20).add(30);
    checkValues(box, 3);
}

TEST(&quot;require that boxes can be created in place&quot;) {
    checkValues(Box&lt;int&gt;().add(10).add(20).add(30), 3);
}

TEST(&quot;require that make_box works&quot;) {
    checkValues(make_box(10), 1);
    checkValues(make_box(10, 20), 2);
    checkValues(make_box(10, 20, 30), 3);
    checkValues(make_box(10, 20, 30, 40), 4);
    checkValues(make_box(10, 20, 30, 40, 50), 5);
}

TEST_MAIN() { TEST_RUN_ALL(); }
</pre>
<pre class="output">
box_test.cpp: info:  running test suite 'box_test.cpp'
box_test.cpp: info:  status_for_test 'require that boxes can be created and converted to vector': PASS
box_test.cpp: info:  status_for_test 'require that boxes can be created in place': PASS
box_test.cpp: info:  status_for_test 'require that make_box works': PASS
box_test.cpp: info:  test summary --- 3 test(s) passed --- 0 test(s) failed
box_test.cpp: info:  imported 28 passed check(s) from 1 thread(s)
box_test.cpp: info:  summary --- 28 check(s) passed --- 0 check(s) failed
box_test.cpp: info:  CONCLUSION: PASS
</pre>
</div>
<div class="example" id="../barrier">
<h2>barrier_test.cpp</h2>
<pre class="prettyprint linenums">
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include &lt;vespa/vespalib/testkit/test_kit.h&gt;
#include &lt;vespa/vespalib/util/barrier.h&gt;

using namespace vespalib;

struct Fixture {
    Barrier barrier;
    CountDownLatch latch;
    Fixture(size_t n) : barrier(n), latch(n) {}
};

TEST_MT_F(&quot;require that barriers are satisfied by the appropriate number of threads&quot;, 3, Fixture(num_threads)) {
    if (thread_id == 0) {
        f1.latch.countDown();
        EXPECT_FALSE(f.latch.await(250));
        EXPECT_TRUE(f.barrier.await());
        EXPECT_TRUE(f.latch.await(25000));
    } else {
        EXPECT_TRUE(f1.barrier.await());
        f1.latch.countDown();
    }
}

TEST_MT_F(&quot;require that barriers can be used multiple times&quot;, 3, Fixture(num_threads)) {
    EXPECT_TRUE(f1.barrier.await());
    EXPECT_TRUE(f1.barrier.await());
    if (thread_id == 0) {
        f1.latch.countDown();
        EXPECT_FALSE(f.latch.await(250));
        EXPECT_TRUE(f.barrier.await());
        EXPECT_TRUE(f.latch.await(25000));
    } else {
        EXPECT_TRUE(f1.barrier.await());
        f1.latch.countDown();
    }
}

TEST_MT_F(&quot;require that barriers can be broken&quot;, 3, Fixture(num_threads)) {
    EXPECT_TRUE(f1.barrier.await());
    if (thread_id == 0) {
        f1.latch.countDown();
        EXPECT_FALSE(f.latch.await(250));
        f1.barrier.destroy();
        EXPECT_TRUE(f.latch.await(25000));
    } else {
        EXPECT_FALSE(f1.barrier.await());
        f1.latch.countDown();
    }
    EXPECT_FALSE(f1.barrier.await());
}

TEST_MT_F(&quot;require that barriers cannot be retroactively broken&quot;, 100, Barrier(num_threads)) {
    EXPECT_TRUE(f1.await());
    f1.destroy();
    EXPECT_FALSE(f1.await());
}

TEST_MAIN() { TEST_RUN_ALL(); }
</pre>
<pre class="output">
barrier_test.cpp: info:  running test suite 'barrier_test.cpp'
barrier_test.cpp: info:  status_for_test 'require that barriers are satisfied by the appropriate number of threads': PASS
barrier_test.cpp: info:  status_for_test 'require that barriers can be used multiple times': PASS
barrier_test.cpp: info:  status_for_test 'require that barriers can be broken': PASS
barrier_test.cpp: info:  status_for_test 'require that barriers cannot be retroactively broken': PASS
barrier_test.cpp: info:  test summary --- 4 test(s) passed --- 0 test(s) failed
barrier_test.cpp: info:  imported 226 passed check(s) from 100 thread(s)
barrier_test.cpp: info:  summary --- 226 check(s) passed --- 0 check(s) failed
barrier_test.cpp: info:  CONCLUSION: PASS
</pre>
</div>
<div class="example" id="../dual_merge_director">
<h2>dual_merge_director_test.cpp</h2>
<pre class="prettyprint linenums">
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include &lt;vespa/vespalib/testkit/test_kit.h&gt;
#include &lt;vespa/vespalib/util/dual_merge_director.h&gt;

using namespace vespalib;

struct MySource : public DualMergeDirector::Source {

    bool typeA;
    std::string data;
    std::string diff;

    MySource(bool a, size_t num_sources, size_t source_id)
        : typeA(a),
          data(num_sources, '0'),
          diff(num_sources, '5')
    {
        if (source_id &lt; num_sources) {
            data[source_id] = '1';
            diff[source_id] = '6';
        }
    }
    virtual void merge(Source &amp;mt) {
        MySource &amp;rhs = static_cast&lt;MySource&amp;&gt;(mt);
        ASSERT_EQUAL(typeA, rhs.typeA);
        ASSERT_EQUAL(data.size(), rhs.data.size());
        for (size_t i = 0; i &lt; data.size(); ++i) {
            int d = (rhs.data[i] - '0');
            data[i] += d;
            diff[i] += d;
            rhs.diff[i] -= d;
        }
    }
    void verifyFinal() const {
        EXPECT_EQUAL(std::string(data.size(), '1'), data);
        EXPECT_EQUAL(std::string(diff.size(), '6'), diff);
    }
    void verifyIntermediate() const {
        EXPECT_EQUAL(std::string(diff.size(), '5'), diff);
    }
};

TEST_MT_F(&quot;require that merging works&quot;, 64, std::unique_ptr&lt;DualMergeDirector&gt;()) {
    for (size_t use_threads = 1; use_threads &lt;= num_threads; ++use_threads) {
        MySource sourceA(true, use_threads, thread_id);
        MySource sourceB(false, use_threads, thread_id);
        if (thread_id == 0) {
            f1.reset(new DualMergeDirector(use_threads));
        }
        TEST_BARRIER();
        if (thread_id &lt; use_threads) {
            f1-&gt;dualMerge(thread_id, sourceA, sourceB);
        }
        TEST_BARRIER();
        if (thread_id == 0) {
            sourceA.verifyFinal();
            sourceB.verifyFinal();
        } else if (thread_id &lt; use_threads) {
            sourceA.verifyIntermediate();
            sourceB.verifyIntermediate();
        }
    }
}

TEST_MAIN() { TEST_RUN_ALL(); }
</pre>
<pre class="output">
dual_merge_director_test.cpp: info:  running test suite 'dual_merge_director_test.cpp'
dual_merge_director_test.cpp: info:  status_for_test 'require that merging works': PASS
dual_merge_director_test.cpp: info:  test summary --- 1 test(s) passed --- 0 test(s) failed
dual_merge_director_test.cpp: info:  imported 12352 passed check(s) from 64 thread(s)
dual_merge_director_test.cpp: info:  summary --- 12352 check(s) passed --- 0 check(s) failed
dual_merge_director_test.cpp: info:  CONCLUSION: PASS
</pre>
</div>
</section>


<section>
<div class="page-header">
<h1>Macro Summary</h1>
</div>

<h2>Overall Execution Macros</h2>
<ul>
<li><code>TEST_MAIN()</code></li>
<li><code>TEST_RUN_ALL()</code></li>
</ul>

<h2>Test Creation Macros</h2>
<ul>
<li><code>TEST(name)</code></li>
<li><code>TEST_F(name, fixture)</code></li>
<li><code>TEST_FF(name, fixture1, fixture2)</code></li>
<li><code>TEST_FFF(name, fixture1, fixture2, fixture3)</code></li>
</ul>

<ul>
<li><code>TEST_MT(name, threads)</code></li>
<li><code>TEST_MT_F(name, threads, fixture)</code></li>
<li><code>TEST_MT_FF(name, threads, fixture1, fixture2)</code></li>
<li><code>TEST_MT_FFF(name, threads, fixture1, fixture2, fixture3)</code></li>
</ul>

<ul>
<li><code>IGNORE_TEST(name)</code></li>
<li><code>IGNORE_TEST_F(name, fixture)</code></li>
<li><code>IGNORE_TEST_FF(name, fixture1, fixture2)</code></li>
<li><code>IGNORE_TEST_FFF(name, fixture1, fixture2, fixture3)</code></li>
</ul>

<ul>
<li><code>IGNORE_TEST_MT(name, threads)</code></li>
<li><code>IGNORE_TEST_MT_F(name, threads, fixture)</code></li>
<li><code>IGNORE_TEST_MT_FF(name, threads, fixture1, fixture2)</code></li>
<li><code>IGNORE_TEST_MT_FFF(name, threads, fixture1, fixture2, fixture3)</code></li>
</ul>

<h2>Check Macros</h2>
<ul>
<li><code>ASSERT_TRUE(rc)</code></li>
<li><code>ASSERT_FALSE(rc)</code></li>
<li><code>ASSERT_EQUAL(a, b)</code></li>
<li><code>ASSERT_NOT_EQUAL(a, b)</code></li>
<li><code>ASSERT_APPROX(a, b, eps)</code></li>
<li><code>ASSERT_NOT_APPROX(a, b, eps)</code></li>
<li><code>ASSERT_LESS(a, b)</code></li>
<li><code>ASSERT_LESS_EQUAL(a, b)</code></li>
<li><code>ASSERT_GREATER(a, b)</code></li>
<li><code>ASSERT_GREATER_EQUAL(a, b)</code></li>
<li><code>ASSERT_EXCEPTION(statement, exception_type, msg_substr)</code></li>
<li><code>TEST_FATAL(msg)</code></li>
</ul>

<ul>
<li><code>EXPECT_TRUE(rc)</code></li>
<li><code>EXPECT_FALSE(rc)</code></li>
<li><code>EXPECT_EQUAL(a, b)</code></li>
<li><code>EXPECT_NOT_EQUAL(a, b)</code></li>
<li><code>EXPECT_APPROX(a, b, eps)</code></li>
<li><code>EXPECT_NOT_APPROX(a, b, eps)</code></li>
<li><code>EXPECT_LESS(a, b)</code></li>
<li><code>EXPECT_LESS_EQUAL(a, b)</code></li>
<li><code>EXPECT_GREATER(a, b)</code></li>
<li><code>EXPECT_GREATER_EQUAL(a, b)</code></li>
<li><code>EXPECT_EXCEPTION(statement, exception_type, msg_substr)</code></li>
<li><code>TEST_ERROR(msg)</code></li>
</ul>

<h2>Thread Macros</h2>
<ul>
<li><code>TEST_BARRIER()</code></li>
</ul>

<h2>State Tracking Macros</h2>
<ul>
<li><code>TEST_DO(doit)</code></li>
<li><code>TEST_STATE(msg)</code></li>
</ul>

<h2>Macros of Limited Use</h2>
<ul>
<li><code>TEST_TRACE()</code></li>
<li><code>TEST_FLUSH()</code></li>
<li><code>TEST_THREAD(name)</code></li>
<li><code>TEST_DEBUG(lhsFile, rhsFile)</code></li>
<li><code>TEST_MAIN_WITH_PROCESS_PROXY()</code></li>
</ul>
</section>

<script type="text/javascript">
$(function(){
    window.prettyPrint && prettyPrint();
});

</script>

</body>
</html>