/usr/share/doc/libjuce/apiref/classUnitTest.html is in libjuce-doc 4.3.0~repack-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.12"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>JUCE: UnitTest Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">JUCE
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.12 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#pub-methods">Public Member Functions</a> |
<a href="#pub-static-methods">Static Public Member Functions</a> |
<a href="classUnitTest-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">UnitTest Class Reference<span class="mlabels"><span class="mlabel">abstract</span></span></div> </div>
</div><!--header-->
<div class="contents">
<p>This is a base class for classes that perform a unit test.
<a href="classUnitTest.html#details">More...</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a3fb00e56f1df45efabba981f84e5a578"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classUnitTest.html#a3fb00e56f1df45efabba981f84e5a578">UnitTest</a> (const <a class="el" href="classString.html">String</a> &name)</td></tr>
<tr class="memdesc:a3fb00e56f1df45efabba981f84e5a578"><td class="mdescLeft"> </td><td class="mdescRight">Creates a test with the given name. <a href="#a3fb00e56f1df45efabba981f84e5a578">More...</a><br /></td></tr>
<tr class="separator:a3fb00e56f1df45efabba981f84e5a578"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a5a57054084ce200e1e92ff3eecc8420a"><td class="memItemLeft" align="right" valign="top">virtual </td><td class="memItemRight" valign="bottom"><a class="el" href="classUnitTest.html#a5a57054084ce200e1e92ff3eecc8420a">~UnitTest</a> ()</td></tr>
<tr class="memdesc:a5a57054084ce200e1e92ff3eecc8420a"><td class="mdescLeft"> </td><td class="mdescRight">Destructor. <a href="#a5a57054084ce200e1e92ff3eecc8420a">More...</a><br /></td></tr>
<tr class="separator:a5a57054084ce200e1e92ff3eecc8420a"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a2a670b333cacbe8056ebb64881009d86"><td class="memItemLeft" align="right" valign="top">const <a class="el" href="classString.html">String</a> & </td><td class="memItemRight" valign="bottom"><a class="el" href="classUnitTest.html#a2a670b333cacbe8056ebb64881009d86">getName</a> () const noexcept</td></tr>
<tr class="memdesc:a2a670b333cacbe8056ebb64881009d86"><td class="mdescLeft"> </td><td class="mdescRight">Returns the name of the test. <a href="#a2a670b333cacbe8056ebb64881009d86">More...</a><br /></td></tr>
<tr class="separator:a2a670b333cacbe8056ebb64881009d86"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a45ac76c71297c8d336e1503515e34232"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classUnitTest.html#a45ac76c71297c8d336e1503515e34232">performTest</a> (<a class="el" href="classUnitTestRunner.html">UnitTestRunner</a> *runner)</td></tr>
<tr class="memdesc:a45ac76c71297c8d336e1503515e34232"><td class="mdescLeft"> </td><td class="mdescRight">Runs the test, using the specified <a class="el" href="classUnitTestRunner.html" title="Runs a set of unit tests. ">UnitTestRunner</a>. <a href="#a45ac76c71297c8d336e1503515e34232">More...</a><br /></td></tr>
<tr class="separator:a45ac76c71297c8d336e1503515e34232"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ade18a56bfb0df028c03c21c158eb80d7"><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="classUnitTest.html#ade18a56bfb0df028c03c21c158eb80d7">initialise</a> ()</td></tr>
<tr class="memdesc:ade18a56bfb0df028c03c21c158eb80d7"><td class="mdescLeft"> </td><td class="mdescRight">You can optionally implement this method to set up your test. <a href="#ade18a56bfb0df028c03c21c158eb80d7">More...</a><br /></td></tr>
<tr class="separator:ade18a56bfb0df028c03c21c158eb80d7"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a72b58cb2de72f299949f710a70ef5d11"><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="classUnitTest.html#a72b58cb2de72f299949f710a70ef5d11">shutdown</a> ()</td></tr>
<tr class="memdesc:a72b58cb2de72f299949f710a70ef5d11"><td class="mdescLeft"> </td><td class="mdescRight">You can optionally implement this method to clear up after your test has been run. <a href="#a72b58cb2de72f299949f710a70ef5d11">More...</a><br /></td></tr>
<tr class="separator:a72b58cb2de72f299949f710a70ef5d11"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a1a95d7f09eb80442a8099663dfb92628"><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="classUnitTest.html#a1a95d7f09eb80442a8099663dfb92628">runTest</a> ()=0</td></tr>
<tr class="memdesc:a1a95d7f09eb80442a8099663dfb92628"><td class="mdescLeft"> </td><td class="mdescRight">Implement this method in your subclass to actually run your tests. <a href="#a1a95d7f09eb80442a8099663dfb92628">More...</a><br /></td></tr>
<tr class="separator:a1a95d7f09eb80442a8099663dfb92628"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ae21d8c58358819742f379706b6b34753"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classUnitTest.html#ae21d8c58358819742f379706b6b34753">beginTest</a> (const <a class="el" href="classString.html">String</a> &testName)</td></tr>
<tr class="memdesc:ae21d8c58358819742f379706b6b34753"><td class="mdescLeft"> </td><td class="mdescRight">Tells the system that a new subsection of tests is beginning. <a href="#ae21d8c58358819742f379706b6b34753">More...</a><br /></td></tr>
<tr class="separator:ae21d8c58358819742f379706b6b34753"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a83e2912ee18731e0bfaf1c21a50b1131"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classUnitTest.html#a83e2912ee18731e0bfaf1c21a50b1131">expect</a> (bool testResult, const <a class="el" href="classString.html">String</a> &failureMessage=<a class="el" href="classString.html">String</a>())</td></tr>
<tr class="memdesc:a83e2912ee18731e0bfaf1c21a50b1131"><td class="mdescLeft"> </td><td class="mdescRight">Checks that the result of a test is true, and logs this result. <a href="#a83e2912ee18731e0bfaf1c21a50b1131">More...</a><br /></td></tr>
<tr class="separator:a83e2912ee18731e0bfaf1c21a50b1131"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a580cd21eec8cae621eceb531eec711d3"><td class="memTemplParams" colspan="2">template<class ValueType > </td></tr>
<tr class="memitem:a580cd21eec8cae621eceb531eec711d3"><td class="memTemplItemLeft" align="right" valign="top">void </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classUnitTest.html#a580cd21eec8cae621eceb531eec711d3">expectEquals</a> (ValueType actual, ValueType expected, <a class="el" href="classString.html">String</a> failureMessage=<a class="el" href="classString.html">String</a>())</td></tr>
<tr class="memdesc:a580cd21eec8cae621eceb531eec711d3"><td class="mdescLeft"> </td><td class="mdescRight">Compares a value to an expected value. <a href="#a580cd21eec8cae621eceb531eec711d3">More...</a><br /></td></tr>
<tr class="separator:a580cd21eec8cae621eceb531eec711d3"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a88277b29ca7179e4da719098c43d08c9"><td class="memTemplParams" colspan="2">template<class ValueType > </td></tr>
<tr class="memitem:a88277b29ca7179e4da719098c43d08c9"><td class="memTemplItemLeft" align="right" valign="top">void </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classUnitTest.html#a88277b29ca7179e4da719098c43d08c9">expectNotEquals</a> (ValueType value, ValueType valueToCompareTo, <a class="el" href="classString.html">String</a> failureMessage=<a class="el" href="classString.html">String</a>())</td></tr>
<tr class="memdesc:a88277b29ca7179e4da719098c43d08c9"><td class="mdescLeft"> </td><td class="mdescRight">Checks whether a value is not equal to a comparison value. <a href="#a88277b29ca7179e4da719098c43d08c9">More...</a><br /></td></tr>
<tr class="separator:a88277b29ca7179e4da719098c43d08c9"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:aef466ffd07c2677e636e2c0292605f62"><td class="memTemplParams" colspan="2">template<class ValueType > </td></tr>
<tr class="memitem:aef466ffd07c2677e636e2c0292605f62"><td class="memTemplItemLeft" align="right" valign="top">void </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classUnitTest.html#aef466ffd07c2677e636e2c0292605f62">expectGreaterThan</a> (ValueType value, ValueType valueToCompareTo, <a class="el" href="classString.html">String</a> failureMessage=<a class="el" href="classString.html">String</a>())</td></tr>
<tr class="memdesc:aef466ffd07c2677e636e2c0292605f62"><td class="mdescLeft"> </td><td class="mdescRight">Checks whether a value is greater than a comparison value. <a href="#aef466ffd07c2677e636e2c0292605f62">More...</a><br /></td></tr>
<tr class="separator:aef466ffd07c2677e636e2c0292605f62"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ac1fd4a33b1ca2db3a32a05d739087879"><td class="memTemplParams" colspan="2">template<class ValueType > </td></tr>
<tr class="memitem:ac1fd4a33b1ca2db3a32a05d739087879"><td class="memTemplItemLeft" align="right" valign="top">void </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classUnitTest.html#ac1fd4a33b1ca2db3a32a05d739087879">expectLessThan</a> (ValueType value, ValueType valueToCompareTo, <a class="el" href="classString.html">String</a> failureMessage=<a class="el" href="classString.html">String</a>())</td></tr>
<tr class="memdesc:ac1fd4a33b1ca2db3a32a05d739087879"><td class="mdescLeft"> </td><td class="mdescRight">Checks whether a value is less than a comparison value. <a href="#ac1fd4a33b1ca2db3a32a05d739087879">More...</a><br /></td></tr>
<tr class="separator:ac1fd4a33b1ca2db3a32a05d739087879"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a0744ec69e299f5ff9ab5e881446eaf94"><td class="memTemplParams" colspan="2">template<class ValueType > </td></tr>
<tr class="memitem:a0744ec69e299f5ff9ab5e881446eaf94"><td class="memTemplItemLeft" align="right" valign="top">void </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classUnitTest.html#a0744ec69e299f5ff9ab5e881446eaf94">expectGreaterOrEqual</a> (ValueType value, ValueType valueToCompareTo, <a class="el" href="classString.html">String</a> failureMessage=<a class="el" href="classString.html">String</a>())</td></tr>
<tr class="memdesc:a0744ec69e299f5ff9ab5e881446eaf94"><td class="mdescLeft"> </td><td class="mdescRight">Checks whether a value is greater or equal to a comparison value. <a href="#a0744ec69e299f5ff9ab5e881446eaf94">More...</a><br /></td></tr>
<tr class="separator:a0744ec69e299f5ff9ab5e881446eaf94"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a8a149547bc7180b943d1f8379e1d834d"><td class="memTemplParams" colspan="2">template<class ValueType > </td></tr>
<tr class="memitem:a8a149547bc7180b943d1f8379e1d834d"><td class="memTemplItemLeft" align="right" valign="top">void </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classUnitTest.html#a8a149547bc7180b943d1f8379e1d834d">expectLessOrEqual</a> (ValueType value, ValueType valueToCompareTo, <a class="el" href="classString.html">String</a> failureMessage=<a class="el" href="classString.html">String</a>())</td></tr>
<tr class="memdesc:a8a149547bc7180b943d1f8379e1d834d"><td class="mdescLeft"> </td><td class="mdescRight">Checks whether a value is less or equal to a comparison value. <a href="#a8a149547bc7180b943d1f8379e1d834d">More...</a><br /></td></tr>
<tr class="separator:a8a149547bc7180b943d1f8379e1d834d"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a53c512c74a94c08ab8d465848bbba2a2"><td class="memTemplParams" colspan="2">template<class ValueType > </td></tr>
<tr class="memitem:a53c512c74a94c08ab8d465848bbba2a2"><td class="memTemplItemLeft" align="right" valign="top">void </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classUnitTest.html#a53c512c74a94c08ab8d465848bbba2a2">expectWithinAbsoluteError</a> (ValueType actual, ValueType expected, ValueType maxAbsoluteError, <a class="el" href="classString.html">String</a> failureMessage=<a class="el" href="classString.html">String</a>())</td></tr>
<tr class="memdesc:a53c512c74a94c08ab8d465848bbba2a2"><td class="mdescLeft"> </td><td class="mdescRight">Computes the difference between a value and a comparison value, and if it is larger than a specified maximum value, prints out a message containing the actual and comparison values and the maximum allowed error. <a href="#a53c512c74a94c08ab8d465848bbba2a2">More...</a><br /></td></tr>
<tr class="separator:a53c512c74a94c08ab8d465848bbba2a2"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a1c91c1b7758fffd3536042238f00005b"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classUnitTest.html#a1c91c1b7758fffd3536042238f00005b">logMessage</a> (const <a class="el" href="classString.html">String</a> &message)</td></tr>
<tr class="memdesc:a1c91c1b7758fffd3536042238f00005b"><td class="mdescLeft"> </td><td class="mdescRight">Writes a message to the test log. <a href="#a1c91c1b7758fffd3536042238f00005b">More...</a><br /></td></tr>
<tr class="separator:a1c91c1b7758fffd3536042238f00005b"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ada7833a473d2c8fe2a821ce3c3de7130"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classRandom.html">Random</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classUnitTest.html#ada7833a473d2c8fe2a821ce3c3de7130">getRandom</a> () const</td></tr>
<tr class="memdesc:ada7833a473d2c8fe2a821ce3c3de7130"><td class="mdescLeft"> </td><td class="mdescRight">Returns a shared RNG that all unit tests should use. <a href="#ada7833a473d2c8fe2a821ce3c3de7130">More...</a><br /></td></tr>
<tr class="separator:ada7833a473d2c8fe2a821ce3c3de7130"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-static-methods"></a>
Static Public Member Functions</h2></td></tr>
<tr class="memitem:a2e5b516d7976360c375e5c870e52798f"><td class="memItemLeft" align="right" valign="top">static <a class="el" href="classArray.html">Array</a>< <a class="el" href="classUnitTest.html">UnitTest</a> * > & </td><td class="memItemRight" valign="bottom"><a class="el" href="classUnitTest.html#a2e5b516d7976360c375e5c870e52798f">getAllTests</a> ()</td></tr>
<tr class="memdesc:a2e5b516d7976360c375e5c870e52798f"><td class="mdescLeft"> </td><td class="mdescRight">Returns the set of all <a class="el" href="classUnitTest.html" title="This is a base class for classes that perform a unit test. ">UnitTest</a> objects that currently exist. <a href="#a2e5b516d7976360c375e5c870e52798f">More...</a><br /></td></tr>
<tr class="separator:a2e5b516d7976360c375e5c870e52798f"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>This is a base class for classes that perform a unit test. </p>
<p>To write a test using this class, your code should look something like this:</p>
<div class="fragment"><div class="line"><span class="keyword">class </span>MyTest : <span class="keyword">public</span> <a class="code" href="classUnitTest.html">UnitTest</a></div><div class="line">{</div><div class="line"><span class="keyword">public</span>:</div><div class="line"> MyTest() : <a class="code" href="classUnitTest.html">UnitTest</a> (<span class="stringliteral">"Foobar testing"</span>) {}</div><div class="line"></div><div class="line"> <span class="keywordtype">void</span> <a class="code" href="classUnitTest.html#a1a95d7f09eb80442a8099663dfb92628">runTest</a>()<span class="keyword"> override</span></div><div class="line"><span class="keyword"> </span>{</div><div class="line"> <a class="code" href="classUnitTest.html#ae21d8c58358819742f379706b6b34753">beginTest</a> (<span class="stringliteral">"Part 1"</span>);</div><div class="line"></div><div class="line"> <a class="code" href="classUnitTest.html#a83e2912ee18731e0bfaf1c21a50b1131">expect</a> (myFoobar.doesSomething());</div><div class="line"> <a class="code" href="classUnitTest.html#a83e2912ee18731e0bfaf1c21a50b1131">expect</a> (myFoobar.doesSomethingElse());</div><div class="line"></div><div class="line"> <a class="code" href="classUnitTest.html#ae21d8c58358819742f379706b6b34753">beginTest</a> (<span class="stringliteral">"Part 2"</span>);</div><div class="line"></div><div class="line"> <a class="code" href="classUnitTest.html#a83e2912ee18731e0bfaf1c21a50b1131">expect</a> (myOtherFoobar.doesSomething());</div><div class="line"> <a class="code" href="classUnitTest.html#a83e2912ee18731e0bfaf1c21a50b1131">expect</a> (myOtherFoobar.doesSomethingElse());</div><div class="line"></div><div class="line"> ...etc..</div><div class="line"> }</div><div class="line">};</div><div class="line"></div><div class="line"><span class="comment">// Creating a static instance will automatically add the instance to the array</span></div><div class="line"><span class="comment">// returned by UnitTest::getAllTests(), so the test will be included when you call</span></div><div class="line"><span class="comment">// UnitTestRunner::runAllTests()</span></div><div class="line"><span class="keyword">static</span> MyTest test;</div></div><!-- fragment --><p>To run a test, use the <a class="el" href="classUnitTestRunner.html" title="Runs a set of unit tests. ">UnitTestRunner</a> class.</p>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="classUnitTestRunner.html" title="Runs a set of unit tests. ">UnitTestRunner</a> </dd></dl>
</div><h2 class="groupheader">Constructor & Destructor Documentation</h2>
<a id="a3fb00e56f1df45efabba981f84e5a578"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a3fb00e56f1df45efabba981f84e5a578">§ </a></span>UnitTest()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">UnitTest::UnitTest </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="classString.html">String</a> & </td>
<td class="paramname"><em>name</em></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">explicit</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Creates a test with the given name. </p>
</div>
</div>
<a id="a5a57054084ce200e1e92ff3eecc8420a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a5a57054084ce200e1e92ff3eecc8420a">§ </a></span>~UnitTest()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">virtual UnitTest::~UnitTest </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Destructor. </p>
</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a id="a2a670b333cacbe8056ebb64881009d86"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a2a670b333cacbe8056ebb64881009d86">§ </a></span>getName()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">const <a class="el" href="classString.html">String</a>& UnitTest::getName </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">noexcept</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns the name of the test. </p>
</div>
</div>
<a id="a45ac76c71297c8d336e1503515e34232"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a45ac76c71297c8d336e1503515e34232">§ </a></span>performTest()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void UnitTest::performTest </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classUnitTestRunner.html">UnitTestRunner</a> * </td>
<td class="paramname"><em>runner</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Runs the test, using the specified <a class="el" href="classUnitTestRunner.html" title="Runs a set of unit tests. ">UnitTestRunner</a>. </p>
<p>You shouldn't need to call this method directly - use <a class="el" href="classUnitTestRunner.html#aa8f05857f111627b6b2d80a5816417b1" title="Runs a set of tests. ">UnitTestRunner::runTests()</a> instead. </p>
</div>
</div>
<a id="a2e5b516d7976360c375e5c870e52798f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a2e5b516d7976360c375e5c870e52798f">§ </a></span>getAllTests()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">static <a class="el" href="classArray.html">Array</a><<a class="el" href="classUnitTest.html">UnitTest</a>*>& UnitTest::getAllTests </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns the set of all <a class="el" href="classUnitTest.html" title="This is a base class for classes that perform a unit test. ">UnitTest</a> objects that currently exist. </p>
</div>
</div>
<a id="ade18a56bfb0df028c03c21c158eb80d7"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ade18a56bfb0df028c03c21c158eb80d7">§ </a></span>initialise()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">virtual void UnitTest::initialise </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>You can optionally implement this method to set up your test. </p>
<p>This method will be called before <a class="el" href="classUnitTest.html#a1a95d7f09eb80442a8099663dfb92628" title="Implement this method in your subclass to actually run your tests. ">runTest()</a>. </p>
</div>
</div>
<a id="a72b58cb2de72f299949f710a70ef5d11"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a72b58cb2de72f299949f710a70ef5d11">§ </a></span>shutdown()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">virtual void UnitTest::shutdown </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>You can optionally implement this method to clear up after your test has been run. </p>
<p>This method will be called after <a class="el" href="classUnitTest.html#a1a95d7f09eb80442a8099663dfb92628" title="Implement this method in your subclass to actually run your tests. ">runTest()</a> has returned. </p>
</div>
</div>
<a id="a1a95d7f09eb80442a8099663dfb92628"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a1a95d7f09eb80442a8099663dfb92628">§ </a></span>runTest()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">virtual void UnitTest::runTest </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">pure virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Implement this method in your subclass to actually run your tests. </p>
<p>The content of your implementation should call <a class="el" href="classUnitTest.html#ae21d8c58358819742f379706b6b34753" title="Tells the system that a new subsection of tests is beginning. ">beginTest()</a> and <a class="el" href="classUnitTest.html#a83e2912ee18731e0bfaf1c21a50b1131" title="Checks that the result of a test is true, and logs this result. ">expect()</a> to perform the tests. </p>
</div>
</div>
<a id="ae21d8c58358819742f379706b6b34753"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae21d8c58358819742f379706b6b34753">§ </a></span>beginTest()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void UnitTest::beginTest </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="classString.html">String</a> & </td>
<td class="paramname"><em>testName</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Tells the system that a new subsection of tests is beginning. </p>
<p>This should be called from your <a class="el" href="classUnitTest.html#a1a95d7f09eb80442a8099663dfb92628" title="Implement this method in your subclass to actually run your tests. ">runTest()</a> method, and may be called as many times as you like, to demarcate different sets of tests. </p>
</div>
</div>
<a id="a83e2912ee18731e0bfaf1c21a50b1131"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a83e2912ee18731e0bfaf1c21a50b1131">§ </a></span>expect()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void UnitTest::expect </td>
<td>(</td>
<td class="paramtype">bool </td>
<td class="paramname"><em>testResult</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const <a class="el" href="classString.html">String</a> & </td>
<td class="paramname"><em>failureMessage</em> = <code><a class="el" href="classString.html">String</a>()</code> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Checks that the result of a test is true, and logs this result. </p>
<p>In your <a class="el" href="classUnitTest.html#a1a95d7f09eb80442a8099663dfb92628" title="Implement this method in your subclass to actually run your tests. ">runTest()</a> method, you should call this method for each condition that you want to check, e.g.</p>
<div class="fragment"><div class="line"><span class="keywordtype">void</span> <a class="code" href="classUnitTest.html#a1a95d7f09eb80442a8099663dfb92628">runTest</a>()</div><div class="line">{</div><div class="line"> <a class="code" href="classUnitTest.html#ae21d8c58358819742f379706b6b34753">beginTest</a> (<span class="stringliteral">"basic tests"</span>);</div><div class="line"> <a class="code" href="classUnitTest.html#a83e2912ee18731e0bfaf1c21a50b1131">expect</a> (x + y == 2);</div><div class="line"> <a class="code" href="classUnitTest.html#a83e2912ee18731e0bfaf1c21a50b1131">expect</a> (getThing() == someThing);</div><div class="line"> ...etc...</div><div class="line">}</div></div><!-- fragment --><p>If testResult is true, a pass is logged; if it's false, a failure is logged. If the failure message is specified, it will be written to the log if the test fails. </p>
</div>
</div>
<a id="a580cd21eec8cae621eceb531eec711d3"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a580cd21eec8cae621eceb531eec711d3">§ </a></span>expectEquals()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template<class ValueType > </div>
<table class="memname">
<tr>
<td class="memname">void UnitTest::expectEquals </td>
<td>(</td>
<td class="paramtype">ValueType </td>
<td class="paramname"><em>actual</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">ValueType </td>
<td class="paramname"><em>expected</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="classString.html">String</a> </td>
<td class="paramname"><em>failureMessage</em> = <code><a class="el" href="classString.html">String</a>()</code> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Compares a value to an expected value. </p>
<p>If they are not equal, prints out a message containing the expected and actual values. </p>
</div>
</div>
<a id="a88277b29ca7179e4da719098c43d08c9"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a88277b29ca7179e4da719098c43d08c9">§ </a></span>expectNotEquals()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template<class ValueType > </div>
<table class="memname">
<tr>
<td class="memname">void UnitTest::expectNotEquals </td>
<td>(</td>
<td class="paramtype">ValueType </td>
<td class="paramname"><em>value</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">ValueType </td>
<td class="paramname"><em>valueToCompareTo</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="classString.html">String</a> </td>
<td class="paramname"><em>failureMessage</em> = <code><a class="el" href="classString.html">String</a>()</code> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Checks whether a value is not equal to a comparison value. </p>
<p>If this check fails, prints out a message containing the actual and comparison values. </p>
</div>
</div>
<a id="aef466ffd07c2677e636e2c0292605f62"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aef466ffd07c2677e636e2c0292605f62">§ </a></span>expectGreaterThan()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template<class ValueType > </div>
<table class="memname">
<tr>
<td class="memname">void UnitTest::expectGreaterThan </td>
<td>(</td>
<td class="paramtype">ValueType </td>
<td class="paramname"><em>value</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">ValueType </td>
<td class="paramname"><em>valueToCompareTo</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="classString.html">String</a> </td>
<td class="paramname"><em>failureMessage</em> = <code><a class="el" href="classString.html">String</a>()</code> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Checks whether a value is greater than a comparison value. </p>
<p>If this check fails, prints out a message containing the actual and comparison values. </p>
</div>
</div>
<a id="ac1fd4a33b1ca2db3a32a05d739087879"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac1fd4a33b1ca2db3a32a05d739087879">§ </a></span>expectLessThan()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template<class ValueType > </div>
<table class="memname">
<tr>
<td class="memname">void UnitTest::expectLessThan </td>
<td>(</td>
<td class="paramtype">ValueType </td>
<td class="paramname"><em>value</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">ValueType </td>
<td class="paramname"><em>valueToCompareTo</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="classString.html">String</a> </td>
<td class="paramname"><em>failureMessage</em> = <code><a class="el" href="classString.html">String</a>()</code> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Checks whether a value is less than a comparison value. </p>
<p>If this check fails, prints out a message containing the actual and comparison values. </p>
</div>
</div>
<a id="a0744ec69e299f5ff9ab5e881446eaf94"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a0744ec69e299f5ff9ab5e881446eaf94">§ </a></span>expectGreaterOrEqual()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template<class ValueType > </div>
<table class="memname">
<tr>
<td class="memname">void UnitTest::expectGreaterOrEqual </td>
<td>(</td>
<td class="paramtype">ValueType </td>
<td class="paramname"><em>value</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">ValueType </td>
<td class="paramname"><em>valueToCompareTo</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="classString.html">String</a> </td>
<td class="paramname"><em>failureMessage</em> = <code><a class="el" href="classString.html">String</a>()</code> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Checks whether a value is greater or equal to a comparison value. </p>
<p>If this check fails, prints out a message containing the actual and comparison values. </p>
</div>
</div>
<a id="a8a149547bc7180b943d1f8379e1d834d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a8a149547bc7180b943d1f8379e1d834d">§ </a></span>expectLessOrEqual()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template<class ValueType > </div>
<table class="memname">
<tr>
<td class="memname">void UnitTest::expectLessOrEqual </td>
<td>(</td>
<td class="paramtype">ValueType </td>
<td class="paramname"><em>value</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">ValueType </td>
<td class="paramname"><em>valueToCompareTo</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="classString.html">String</a> </td>
<td class="paramname"><em>failureMessage</em> = <code><a class="el" href="classString.html">String</a>()</code> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Checks whether a value is less or equal to a comparison value. </p>
<p>If this check fails, prints out a message containing the actual and comparison values. </p>
</div>
</div>
<a id="a53c512c74a94c08ab8d465848bbba2a2"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a53c512c74a94c08ab8d465848bbba2a2">§ </a></span>expectWithinAbsoluteError()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template<class ValueType > </div>
<table class="memname">
<tr>
<td class="memname">void UnitTest::expectWithinAbsoluteError </td>
<td>(</td>
<td class="paramtype">ValueType </td>
<td class="paramname"><em>actual</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">ValueType </td>
<td class="paramname"><em>expected</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">ValueType </td>
<td class="paramname"><em>maxAbsoluteError</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="classString.html">String</a> </td>
<td class="paramname"><em>failureMessage</em> = <code><a class="el" href="classString.html">String</a>()</code> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Computes the difference between a value and a comparison value, and if it is larger than a specified maximum value, prints out a message containing the actual and comparison values and the maximum allowed error. </p>
</div>
</div>
<a id="a1c91c1b7758fffd3536042238f00005b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a1c91c1b7758fffd3536042238f00005b">§ </a></span>logMessage()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void UnitTest::logMessage </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="classString.html">String</a> & </td>
<td class="paramname"><em>message</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Writes a message to the test log. </p>
<p>This can only be called from within your <a class="el" href="classUnitTest.html#a1a95d7f09eb80442a8099663dfb92628" title="Implement this method in your subclass to actually run your tests. ">runTest()</a> method. </p>
</div>
</div>
<a id="ada7833a473d2c8fe2a821ce3c3de7130"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ada7833a473d2c8fe2a821ce3c3de7130">§ </a></span>getRandom()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classRandom.html">Random</a> UnitTest::getRandom </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns a shared RNG that all unit tests should use. </p>
<p>If a test needs random numbers, it's important that when an error is found, the exact circumstances can be re-created in order to re-test the problem, by repeating the test with the same random seed value. To make this possible, the <a class="el" href="classUnitTestRunner.html" title="Runs a set of unit tests. ">UnitTestRunner</a> class creates a master seed value for the run, writes this number to the log, and then this method returns a <a class="el" href="classRandom.html" title="A random number generator. ">Random</a> object based on that seed. All tests should only use this method to create any <a class="el" href="classRandom.html" title="A random number generator. ">Random</a> objects that they need.</p>
<p>Note that this method will return an identical object each time it's called for a given run, so if you need several different <a class="el" href="classRandom.html" title="A random number generator. ">Random</a> objects, the best way to do that is to call <a class="el" href="classRandom.html#af8a7c8f1f8aa96b761c441f34382cd4a" title="Merges this object's seed with another value. ">Random::combineSeed()</a> on the result to permute it with a constant value. </p>
</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="juce__UnitTest_8h.html">juce_UnitTest.h</a></li>
</ul>
</div><!-- contents -->
<hr class="footer"/>
<address class="footer"><small>All content © ROLI Ltd.</small></address><br/>
</body>
</html>
|