This file is indexed.

/usr/share/doc/cxxtest/guide.html is in cxxtest 4.3-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
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="generator" content="AsciiDoc 8.6.9">
<title>CxxTest User Guide</title>
</head>
<body>
<h1>CxxTest User Guide</h1>
<p>
</p>
<hr>
<h2><a name="_abstract"></a>Abstract</h2>
<p>CxxTest is a unit testing framework for C++ that is similar in
spirit to <a href="http://junit.org/">JUnit</a>,
<a href="http://cppunit.sourceforge.net">CppUnit</a>, and
<a href="http://xprogramming.com/software.html">xUnit</a>.  CxxTest is easy to
use because it does not require precompiling a CxxTest testing
library, it employs no advanced features of C++ (e.g. RTTI) and it
supports a very flexible form of test discovery.  This documentation
describes CxxTest 4.3, which is an incremental release that includes
better test discovery features and new test skipping features.</p>
<hr>
<h2><a name="_overview"></a>1. Overview</h2>
<p>CxxTest is a unit testing framework for C++ that is similar in
spirit to <a href="http://junit.org/">JUnit</a>,
<a href="http://cppunit.sourceforge.net">CppUnit</a>, and
<a href="http://xprogramming.com/software.html">xUnit</a>.
CxxTest is designed to be as portable as possible;  it does not require</p>
<ul>
<li>
<p>
RTTI
</p>
</li>
<li>
<p>
Member template functions
</p>
</li>
<li>
<p>
Exception handling
</p>
</li>
<li>
<p>
External libraries (including memory management, file/console I/O, graphics libraries)
</p>
</li>
</ul>
<p>In particular, the design of CxxTest was tailored for C++ compilers
on embedded systems, for which many of these features are not
supported.  However, CxxTest can also leverage standard C++ features
when they are supported by a compiler (e.g. catch unhandled
exceptions).</p>
<p>Additionally, CxxTest supports <em>test discovery</em>.  Tests are defined
in C++ header files, which are parsed by CxxTest to automatically
generate a test runner.  Thus, CxxTest is somewhat easier to use
than alternative C++ testing frameworks, since you do not need to
<em>register</em> tests.</p>
<p>The <a href="http://cxxtest.com">CxxTest Home Page</a> is
<a href="http://cxxtest.com">http://cxxtest.com</a>.  This webpage contains links
for <a href="https://sourceforge.net/projects/cxxtest/files/">release downloads</a>,
the <a href="https://groups.google.com/forum/?hl=en#!forum/cxxtest-forum">CxxTest
discussion list</a>, and documentation in
<a href="http://cxxtest.com/guide.html">HTML</a>,
<a href="http://cxxtest.com/guide.pdf">PDF</a>, and
<a href="http://cxxtest.com/guide.epub">EPUB</a> formats.  The
<a href="http://cxxtest.com">CxxTest Home Page</a> also includes developer
resources (e.g. <a href="https://software.sandia.gov/hudson/view/CxxTest/">automated
test results</a>).  CxxTest is available under the
<a href="http://www.gnu.org/licenses/lgpl.html">GNU Lesser General Public</a>
license.</p>
<p>The CxxTest User Guide provides the following documentation:</p>
<ul>
<li>
<p>
<a href="#gettingStarted">Getting Started</a>: Some simple examples that illustrate how to use CxxTest
</p>
</li>
<li>
<p>
<a href="#testAssertions">Test Assertions</a>: The test assertions supported by CxxTest
</p>
</li>
<li>
<p>
<a href="#cxxtestgen">The CxxTestGen Command</a>: Documentation for the <code>cxxtestgen</code> command
</p>
</li>
<li>
<p>
<a href="#runner">Test Runner Syntax</a>: Discussion of command line options for test runners
</p>
</li>
<li>
<p>
<a href="#advanced">Advanced Testing Features</a>: Advanced features of CxxTest
</p>
</li>
<li>
<p>
<a href="#traits">Value Traits</a>: Customizing data traits for error messages
</p>
</li>
<li>
<p>
<a href="#mock">Testing with Mock Objects</a>: How to test with mock global functions
</p>
</li>
<li>
<p>
<a href="#installation">Installation</a>: How to install CxxTest
</p>
</li>
<li>
<p>
<a href="#discussion">Status and Future Plans</a>: Comments on the past, present and future of CxxTest
</p>
</li>
</ul>
<hr>
<h2><a name="gettingStarted"></a>2. Getting Started</h2>
<p>Testing is performed with CxxTest in a four-step process:</p>
<ol type="1">
<li>
<p>
Tests are defined in C++ header files
</p>
</li>
<li>
<p>
The <code>cxxtestgen</code> command processes header files to generate files for the test runner.
</p>
</li>
<li>
<p>
Compile the test runner.
</p>
</li>
<li>
<p>
Execute the test runner to run all test suites.
</p>
</li>
</ol>
<p>CxxTest supports test automation, sharing of setup
and shutdown code for tests, aggregation of tests into collections,
and independence of the tests from the reporting framework.  To
achieve this, CxxTest supports some important concepts that are common to xUnit frameworks (
e.g. <a href="http://junit.org/">JUnit</a>, <a href="http://cppunit.sourceforge.net">CppUnit</a>, and
<a href="http://xprogramming.com/software.html">xUnit</a>):</p>
<dl>
<dt>
test fixture
</dt>
<dd>
<p>
   A <em>test fixture</em> represents the preparation needed to perform one or more
   tests, and any associate cleanup actions.  This may involve, for example,
   creating temporary or proxy databases, directories, or starting a server
   process.
</p>
</dd>
</dl>
<dl>
<dt>
test suite
</dt>
<dd>
<p>
   A <em>test suite</em> is a collection of test cases, which represent
   the smallest unit of testing.  A test suite is defined by a class
   that inherits from the <code>CxxTest::TestSuite</code> class, and the tests
   in a test suite are executed together.
</p>
</dd>
<dt>
test
</dt>
<dd>
<p>
    A test is a public member function of a test suite whose name
    starts with <code>test</code>, e.g. <code>testDirectoryScanner()</code>,
    <code>test_cool_feature()</code> and <code>TestImportantBugFix()</code>.
</p>
</dd>
<dt>
test runner
</dt>
<dd>
<p>
   A <em>test runner</em> is a component which orchestrates the execution
   of tests across one or more test suites and provides the outcome
   to the user.
</p>
</dd>
</dl>
<p>When building test fixtures using <code>TestSuite</code>, the <code>TestSuite.setUp</code>
and <code>TestSuite.tearDown</code> methods can be overridden to provide
initialization and cleanup for the fixture.  The <code>TestSuite.setUp</code>
method is run before each test is executed, and the <code>TestSuite.tearDown</code>
method is run after each test is executed.</p>
<h3><a name="_a_first_example"></a>2.1. A First Example</h3>
<p>The following is a simple example of a
test suite with a single test, <code>testAddition</code>, which perform two test assertions:</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><i><font color="#9A1900">// MyTestSuite1.h</font></i>
<b><font color="#000080">#include</font></b> <font color="#FF0000">&lt;cxxtest/TestSuite.h&gt;</font>

<b><font color="#0000FF">class</font></b> <font color="#008080">MyTestSuite1</font> <font color="#990000">:</font> <b><font color="#0000FF">public</font></b> CxxTest<font color="#990000">::</font>TestSuite
<font color="#FF0000">{</font>
<b><font color="#0000FF">public</font></b><font color="#990000">:</font>
    <font color="#009900">void</font> <b><font color="#000000">testAddition</font></b><font color="#990000">(</font><font color="#009900">void</font><font color="#990000">)</font>
    <font color="#FF0000">{</font>
        <b><font color="#000000">TS_ASSERT</font></b><font color="#990000">(</font><font color="#993399">1</font> <font color="#990000">+</font> <font color="#993399">1</font> <font color="#990000">&gt;</font> <font color="#993399">1</font><font color="#990000">);</font>
        <b><font color="#000000">TS_ASSERT_EQUALS</font></b><font color="#990000">(</font><font color="#993399">1</font> <font color="#990000">+</font> <font color="#993399">1</font><font color="#990000">,</font> <font color="#993399">2</font><font color="#990000">);</font>
    <font color="#FF0000">}</font>
<font color="#FF0000">}</font><font color="#990000">;</font></tt></pre></td></tr></table>
<p>You use the <code>cxxtestgen</code> script to generate a <em>test runner</em> for test suites in C++ header files:</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>cxxtestgen --error-printer -o runner<font color="#990000">.</font>cpp MyTestSuite1<font color="#990000">.</font>h</tt></pre></td></tr></table>
<p>This command generates the file <code>runner.cpp</code>, which can be compiled.</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>g<font color="#990000">++</font> -o runner -I<font color="#009900">$CXXTEST</font> runner<font color="#990000">.</font>cpp</tt></pre></td></tr></table>
<p>Note that additional compiler flags may be needed to include headers
and libraries that are used during testing.</p>
<p>This runner can be executed to perform the specified tests:</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><font color="#990000">.</font>/runner</tt></pre></td></tr></table>
<p>which generates the following output:</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="4"><tr><td>
<pre><code>Running cxxtest tests (1 test).OK!</code></pre>
</td></tr></table>
<h3><a name="_a_second_example"></a>2.2. A Second Example</h3>
<p>The following header file extends the previous example to
include a test that generates an error:</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><i><font color="#9A1900">// MyTestSuite2.h</font></i>
<b><font color="#000080">#include</font></b> <font color="#FF0000">&lt;cxxtest/TestSuite.h&gt;</font>

<b><font color="#0000FF">class</font></b> <font color="#008080">MyTestSuite2</font> <font color="#990000">:</font> <b><font color="#0000FF">public</font></b> CxxTest<font color="#990000">::</font>TestSuite
<font color="#FF0000">{</font>
<b><font color="#0000FF">public</font></b><font color="#990000">:</font>
    <font color="#009900">void</font> <b><font color="#000000">testAddition</font></b><font color="#990000">(</font><font color="#009900">void</font><font color="#990000">)</font>
    <font color="#FF0000">{</font>
        <b><font color="#000000">TS_ASSERT</font></b><font color="#990000">(</font><font color="#993399">1</font> <font color="#990000">+</font> <font color="#993399">1</font> <font color="#990000">&gt;</font> <font color="#993399">1</font><font color="#990000">);</font>
        <b><font color="#000000">TS_ASSERT_EQUALS</font></b><font color="#990000">(</font><font color="#993399">1</font> <font color="#990000">+</font> <font color="#993399">1</font><font color="#990000">,</font> <font color="#993399">2</font><font color="#990000">);</font>
    <font color="#FF0000">}</font>

    <font color="#009900">void</font> <b><font color="#000000">testMultiplication</font></b><font color="#990000">(</font><font color="#009900">void</font><font color="#990000">)</font>
    <font color="#FF0000">{</font>
        <b><font color="#000000">TS_TRACE</font></b><font color="#990000">(</font><font color="#FF0000">"Starting multiplication test"</font><font color="#990000">);</font>
        <b><font color="#000000">TS_ASSERT_EQUALS</font></b><font color="#990000">(</font><font color="#993399">2</font> <font color="#990000">*</font> <font color="#993399">2</font><font color="#990000">,</font> <font color="#993399">5</font><font color="#990000">);</font>
        <b><font color="#000000">TS_TRACE</font></b><font color="#990000">(</font><font color="#FF0000">"Finishing multiplication test"</font><font color="#990000">);</font>
    <font color="#FF0000">}</font>
<font color="#FF0000">}</font><font color="#990000">;</font></tt></pre></td></tr></table>
<p>The test runner generated by <code>cxxtestgen</code> for this test suite generates the following output:</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="4"><tr><td>
<pre><code>Running cxxtest tests (2 tests).
In MyTestSuite2::testMultiplication:
/Users/wehart/home/mac/src/cxxtest/doc/examples/MyTestSuite2.h:16: Error: Expected (2 * 2 == 5), found (4 != 5)
Failed 1 and Skipped 0 of 2 tests
Success rate: 50%</code></pre>
</td></tr></table>
<h3><a name="_sample_problems"></a>2.3. Sample Problems</h3>
<p>CxxTest comes with example test suites in the <code>cxxtest/sample</code> subdirectory of
the distribution.  If you look in that directory, you will see three
Makefiles: <code>Makefile.unix</code>, <code>Makefile.msvc</code> and
<code>Makefile.bcc32</code> which are for Linux/Unix, MS Visual C++ and Borland C++, repectively.  These files are provided as a starting point,
and some options may need to be tweaked in them for your system.</p>
<hr>
<h2><a name="testAssertions"></a>3. Test Assertions</h2>
<p>The following table summarizes the test assertions supported by CxxTest.
<a href="#appendix_A">Appendix A</a> provides examples that illustrate the use of these test assertions.</p>
<div>
<table rules="all"
width="100%"
frame="border"
cellspacing="0" cellpadding="4">
<thead>
<tr>
<th align="left" width="50%" valign="top"> Macro                                                                 </th>
<th align="left" width="50%" valign="top"> Description</th>
</tr>
</thead>
<tbody>
<tr>
<td align="left" width="50%" valign="top"><p><a href="#ts_assert"><code>TS_ASSERT(expr)</code></a></p></td>
<td align="left" width="50%" valign="top"><p>Verify <code>expr</code> is true</p></td>
</tr>
<tr>
<td align="left" width="50%" valign="top"><p><a href="#ts_assert_delta"><code>TS_ASSERT_DELTA(x,y,d)</code></a></p></td>
<td align="left" width="50%" valign="top"><p>Verify that <code>abs(x-y) &lt; d</code></p></td>
</tr>
<tr>
<td align="left" width="50%" valign="top"><p><a href="#ts_assert_differs"><code>TS_ASSERT_DIFFERS(x,y)</code></a></p></td>
<td align="left" width="50%" valign="top"><p>Verify that <code>x != y</code></p></td>
</tr>
<tr>
<td align="left" width="50%" valign="top"><p><a href="#ts_assert_equals"><code>TS_ASSERT_EQUALS(x,y)</code></a></p></td>
<td align="left" width="50%" valign="top"><p>Verify that <code>x == y</code></p></td>
</tr>
<tr>
<td align="left" width="50%" valign="top"><p><a href="#ts_assert_is_nan"><code>TS_ASSERT_IS_NAN(x)</code></a></p></td>
<td align="left" width="50%" valign="top"><p>Verify that <code>x</code> is NaN</p></td>
</tr>
<tr>
<td align="left" width="50%" valign="top"><p><a href="#ts_assert_is_infinite"><code>TS_ASSERT_IS_INFINITE(x)</code></a></p></td>
<td align="left" width="50%" valign="top"><p>Verify that <code>x</code> is infinite</p></td>
</tr>
<tr>
<td align="left" width="50%" valign="top"><p><a href="#ts_assert_less_than"><code>TS_ASSERT_LESS_THAN(x,y)</code></a></p></td>
<td align="left" width="50%" valign="top"><p>Verify that <code>x &lt; y</code></p></td>
</tr>
<tr>
<td align="left" width="50%" valign="top"><p><a href="#ts_assert_less_than_equals"><code>TS_ASSERT_LESS_THAN_EQUALS(x,y)</code></a></p></td>
<td align="left" width="50%" valign="top"><p>Verify that <code>x &#8656; y</code></p></td>
</tr>
<tr>
<td align="left" width="50%" valign="top"><p><a href="#ts_assert_predicate"><code>TS_ASSERT_PREDICATE(P,x)</code></a></p></td>
<td align="left" width="50%" valign="top"><p>Verify <code>P(x)</code></p></td>
</tr>
<tr>
<td align="left" width="50%" valign="top"><p><a href="#ts_assert_relation"><code>TS_ASSERT_RELATION(x,R,y)</code></a></p></td>
<td align="left" width="50%" valign="top"><p>Verify <code>x R y</code></p></td>
</tr>
<tr>
<td align="left" width="50%" valign="top"><p><a href="#ts_assert_same_data"><code>TS_ASSERT_SAME_DATA(x,y,size)</code></a></p></td>
<td align="left" width="50%" valign="top"><p>Verify two buffers are equal</p></td>
</tr>
<tr>
<td align="left" width="50%" valign="top"><p><a href="#ts_assert_throws"><code>TS_ASSERT_THROWS(expr,type)</code></a></p></td>
<td align="left" width="50%" valign="top"><p>Verify that <code>expr</code> throws the specified exception type</p></td>
</tr>
<tr>
<td align="left" width="50%" valign="top"><p><a href="#ts_assert_throws_anything"><code>TS_ASSERT_THROWS_ANYTHING(expr)</code></a></p></td>
<td align="left" width="50%" valign="top"><p>Verify that <code>expr</code> throws an exception</p></td>
</tr>
<tr>
<td align="left" width="50%" valign="top"><p><a href="#ts_assert_throws_assert"><code>TS_ASSERT_THROWS_ASSERT(expr,arg,assertion)</code></a></p></td>
<td align="left" width="50%" valign="top"><p>Verify type and value of what <code>expr</code> throws</p></td>
</tr>
<tr>
<td align="left" width="50%" valign="top"><p><a href="#ts_assert_throws_equals"><code>TS_ASSERT_THROWS_EQUALS(expr,arg,x,y)</code></a></p></td>
<td align="left" width="50%" valign="top"><p>Verify type and value of what <code>expr</code> throws</p></td>
</tr>
<tr>
<td align="left" width="50%" valign="top"><p><a href="#ts_assert_throws_is_nan"><code>TS_ASSERT_THROWS_IS_NAN(expr,arg,x)</code></a></p></td>
<td align="left" width="50%" valign="top"><p>Verify type and value of what <code>expr</code> throws</p></td>
</tr>
<tr>
<td align="left" width="50%" valign="top"><p><a href="#ts_assert_throws_is_infinite"><code>TS_ASSERT_THROWS_IS_INFINITE(expr,arg,x)</code></a></p></td>
<td align="left" width="50%" valign="top"><p>Verify type and value of what <code>expr</code> throws</p></td>
</tr>
<tr>
<td align="left" width="50%" valign="top"><p><a href="#ts_assert_throws_nothing"><code>TS_ASSERT_THROWS_NOTHING(expr)</code></a></p></td>
<td align="left" width="50%" valign="top"><p>Verify that <code>expr</code> doesn&#8217;t throw anything</p></td>
</tr>
<tr>
<td align="left" width="50%" valign="top"><p><a href="#ts_fail"><code>TS_FAIL(message)</code></a></p></td>
<td align="left" width="50%" valign="top"><p>Fail unconditionally</p></td>
</tr>
<tr>
<td align="left" width="50%" valign="top"><p><a href="#ts_skip"><code>TS_SKIP(message)</code></a></p></td>
<td align="left" width="50%" valign="top"><p>Skip this test</p></td>
</tr>
<tr>
<td align="left" width="50%" valign="top"><p><a href="#ts_trace"><code>TS_TRACE(message)</code></a></p></td>
<td align="left" width="50%" valign="top"><p>Print <code>message</code> as an informational message</p></td>
</tr>
<tr>
<td align="left" width="50%" valign="top"><p><a href="#ts_warn"><code>TS_WARN(message)</code></a></p></td>
<td align="left" width="50%" valign="top"><p>Print <code>message</code> as a warning</p></td>
</tr>
</tbody>
</table>
</div>
<p>The test assertions supported by CxxTest are defined as macros,
which eliminates the need for certain templates within CxxTest and
allows tests to catch exceptions.  There are four categories of
test assertions in CxxTest, which are distinguished by their prefixes:</p>
<dl>
<dt>
TS_
</dt>
<dd>
<p>
These test assertions perform a test. Catch exceptions generated
during testing will cause the test to fail, except for tests that
check for exceptions.
</p>
</dd>
<dt>
TSM_
</dt>
<dd>
<p>
These test assertions perform the same tests as the corresponding
<code>TS</code> assertions, but their first argument is a <code>const char*</code> message
buffer that is printed when the test fails.
</p>
</dd>
<dt>
ETS_
</dt>
<dd>
<p>
These test assertions perform the same tests as the corresponding
<code>TS</code> assertions.  However, these test assertions do not catch
exceptions generated during testing.
</p>
</dd>
<dt>
ETSM_
</dt>
<dd>
<p>
These test assertions perform the same tests as the
corresponding <code>TS</code> assertions, but (1) their first argument is a
<code>const char*</code> message buffer is printed when the test fails, and
(2) these assertions do not catch exceptions generated during
testing.
</p>
</dd>
</dl>
<hr>
<h2><a name="cxxtestgen"></a>4. The CxxTestGen Command</h2>
<p>The <code>cxxtestgen</code> command processes one or more C++ header files to
generate a test runner.  The <code>cxxtestgen</code> command performs test
discovery by parsing the header files to find test classes, which
inherit from the class <code>CxxTest::TestSuite</code>.</p>
<p>The <code>--help</code> option generates the following summary of the <code>cxxtestgen</code> command line options:</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="4"><tr><td>
<pre><code>Usage: cxxtestgen [options] [&lt;filename&gt; ...]

The 'cxxtestgen' command processes C++ header files to perform test discovery,
and then it creates files for the 'CxxTest' test runner.

Options:
  -h, --help            show this help message and exit
  --version             Write the CxxTest version.
  -o NAME, --output=NAME
                        Write output to file NAME.
  -w WORLD, --world=WORLD
                        The label of the tests, used to name the XML results.
  --include=HEADER      Include file HEADER in the test runner before other
                        headers.
  --abort-on-fail       Abort tests on failed asserts (like xUnit).
  --main=MAIN           Specify an alternative name for the main() function.
  --headers=HEADER_FILENAME
                        Specify a filename that contains a list of header
                        files that are processed to generate a test runner.
  --runner=CLASS        Create a test runner that processes test events using
                        the class CxxTest::CLASS.
  --gui=CLASS           Create a GUI test runner that processes test events
                        using the class CxxTest::CLASS. (deprecated)
  --error-printer       Create a test runner using the ErrorPrinter class, and
                        allow the use of the standard library.
  --xunit-printer       Create a test runner using the XUnitPrinter class.
  --xunit-file=XUNIT_FILE
                        The file to which the XML summary is written for test
                        runners using the XUnitPrinter class.  The default XML
                        filename is TEST-&lt;world&gt;.xml, where &lt;world&gt; is the
                        value of the --world option.  (default: cxxtest)
  --have-std            Use the standard library (even if not found in tests).
  --no-std              Do not use standard library (even if found in tests).
  --have-eh             Use exception handling (even if not found in tests).
  --no-eh               Do not use exception handling (even if found in
                        tests).
  --longlong=TYPE       Use TYPE as for long long integers.  (default: not
                        supported)
  --no-static-init      Do not rely on static initialization in the test
                        runner.
  --template=TEMPLATE   Generate the test runner using file TEMPLATE to define
                        a template.
  --root                Write the main() function and global data for a test
                        runner.
  --part                Write the tester classes for a test runner.
  -f, --fog-parser      Use new FOG C++ parser (disabled)</code></pre>
</td></tr></table>
<p>The following section describe illustrate the use of these command line options.</p>
<h3><a name="_general_options"></a>4.1. General Options</h3>
<p>The default behavior of <code>cxxtestgen</code> is to send the source for the
test runner to the standard output stream.  The <code>--output</code> (<code>-o</code>)
option indicates a filename for the test runner.</p>
<p>The <code>--world</code> (<code>-w</code>) option specifies the value of the <code>CxxTest::RealWorldDescription::_worldName</code>
variable.  This option also customizes the filename used for XML output files (see below).</p>
<p>The <code>--include</code> option defines a filename that is included in the runner before all other headers.</p>
<p>The <code>--abort-on-fail</code> option forces an abort if a test fails, rather than continuing execution
to the next test.</p>
<p>The <code>--main</code> option specifies an alternate name for the <code>main()</code> function.</p>
<h3><a name="_test_listener_options"></a>4.2. Test Listener Options</h3>
<p>The test runner behavior is controlled by a <em>test listener</em> class
that is used to define to the <code>main</code> function.  The test listener
class is a subclass of <code>TestListener</code> that receives notifications
about the testing process, notably which assertions failed.  The
<code>--runner</code> option is used to specify the test listener that is used
in the test runner.  The following test listeners are defined in
CxxTest:</p>
<dl>
<dt>
<code>ErrorPrinter</code>
</dt>
<dd>
<p>
    This is the standard error printer, which formats its output to the standard output stream (<code>std::cout</code>).
</p>
</dd>
<dt>
<code>StdioPrinter</code>
</dt>
<dd>
<p>
    The same as <code>ErrorPrinter</code> except that it uses <code>printf</code> instead of <code>std::cout</code>.
</p>
</dd>
<dt>
<code>ParenPrinter</code>
</dt>
<dd>
<p>
    Identical to <code>ErrorPrinter</code> except that it prints line numbers in parantheses. This is the way Visual Studio expects it.
</p>
</dd>
<dt>
<code>XmlPrinter</code>
</dt>
<dd>
<p>
    Print test results to an XML file.
</p>
</dd>
<dt>
<code>XUnitPrinter</code>
</dt>
<dd>
<p>
    This test listener generates output using both <code>ErrorPrinter</code> and <code>XmlPrinter</code>.
</p>
</dd>
</dl>
<h4><a name="_errorprinter"></a>4.2.1. ErrorPrinter</h4>
<p>The <code>--error-printer</code> option creates a runner using the <code>ErrorPrinter</code>
test listener, and it indicates that the standard library is used
in the test runner.  The <code>ErrorPrinter</code> test listener prints dots
to summarize test execution, along with a summary of the test
results.  For example, the command</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>cxxtestgen --error-printer -o runner<font color="#990000">.</font>cpp MyTestSuite2<font color="#990000">.</font>h</tt></pre></td></tr></table>
<p>generates the following output:</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="4"><tr><td>
<pre><code>Running cxxtest tests (2 tests).
In MyTestSuite2::testMultiplication:
/Users/wehart/home/mac/src/cxxtest/doc/examples/MyTestSuite2.h:16: Error: Expected (2 * 2 == 5), found (4 != 5)
Failed 1 and Skipped 0 of 2 tests
Success rate: 50%</code></pre>
</td></tr></table>
<h4><a name="_stdioprinter"></a>4.2.2. StdioPrinter</h4>
<p>If your compiler does not support <code>std::cout</code>, then the <code>ErrorPrinter</code> test listener cannot be used.
In this case, the <code>StdioPrinter</code> test listener can be used;  it provides the same output as <code>ErrorPrinter</code> but it uses the <code>printf</code> function. For example, the command line:</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>cxxtestgen --runner<font color="#990000">=</font>StdioPrinter -o runner<font color="#990000">.</font>cpp MyTestSuite2<font color="#990000">.</font>h</tt></pre></td></tr></table>
<p>generates the following output:</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="4"><tr><td>
<pre><code>Running cxxtest tests (2 tests).
In MyTestSuite2::testMultiplication:
MyTestSuite2.h:16: Error: Expected (2 * 2 == 5), found (4 != 5)
Failed 1 and Skipped 0 of 2 tests
Success rate: 50%</code></pre>
</td></tr></table>
<h4><a name="_parenprinter"></a>4.2.3. ParenPrinter</h4>
<p>The <code>--runner=ParenPrinter</code> option creates a similar test runner:</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>cxxtestgen --runner<font color="#990000">=</font>ParenPrinter -o runner<font color="#990000">.</font>cpp MyTestSuite2<font color="#990000">.</font>h</tt></pre></td></tr></table>
<p>This test runner generates output that is similar to the <code>ErrorPrinter</code> test listener:</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="4"><tr><td>
<pre><code>Running cxxtest tests (2 tests).
In MyTestSuite2::testMultiplication:
MyTestSuite2.h(16): Error: Expected (2 * 2 == 5), found (4 != 5)
Failed 1 and Skipped 0 of 2 tests
Success rate: 50%</code></pre>
</td></tr></table>
<p>The only difference is the parentheses used in the output.  This test listener provides a format that can be recognized by Visual Studio.</p>
<h4><a name="_xmlprinter"></a>4.2.4. XmlPrinter</h4>
<p>The <code>--runner=XmlPrinter</code> option creates a test runner whose output is an XML summary of the test results.  For example, the command:</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>cxxtestgen --runner<font color="#990000">=</font>XmlPrinter -o runner<font color="#990000">.</font>cpp MyTestSuite2<font color="#990000">.</font>h</tt></pre></td></tr></table>
<p>generates the following output:</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="4"><tr><td>
<pre><code>&lt;?xml version="1.0" encoding="UTF-8" ?&gt;
&lt;testsuite name="cxxtest" date="Tue Apr 23 23:28:43 2013" tests="2" errors="0" failures="1" time="0" &gt;
    &lt;testcase classname="MyTestSuite2" name="testAddition" line="7" /&gt;
    &lt;testcase classname="MyTestSuite2" name="testMultiplication" line="13"&gt;
        &lt;failure file="MyTestSuite2.h" line="16" type="failedAssertEquals" &gt;Error: Expected (2 * 2 == 5), found (4 != 5)&lt;/failure&gt;
    &lt;/testcase&gt;
&lt;/testsuite&gt;</code></pre>
</td></tr></table>
<p>This XML format is conforms to the XML standard used by other xUnit tools.  Thus, this output can be used as input in other tools, like <a href="http://jenkins-ci.org/">Jenkins</a>, to generate test summaries.</p>
<h4><a name="_xunitprinter"></a>4.2.5. XUnitPrinter</h4>
<p>The <code>XUnitPrinter</code> test listener generates output using both the
ErrorPrinter+ and <code>XmlPrinter</code> test listeners.  This allows the
user to interactively view a simple test summary, while simultaneously
generating an XML summary of the test results.  The <code>--xunit-printer</code>
option specifies the use of <code>XUnitPrinter</code>:</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>cxxtestgen --xunit-printer -o runner<font color="#990000">.</font>cpp MyTestSuite2<font color="#990000">.</font>h</tt></pre></td></tr></table>
<p>This test runner generates the following output:</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="4"><tr><td>
<pre><code>Running cxxtest tests (2 tests).
In MyTestSuite2::testMultiplication:
MyTestSuite2.h:16: Error: Expected (2 * 2 == 5), found (4 != 5)
Failed 1 and Skipped 0 of 2 tests
Success rate: 50%</code></pre>
</td></tr></table>
<p>The default filename for the XML results is <code>TEST-cxxtest.xml</code>.  The <code>--xunit-file</code> option can be used to specify an alternative filename.  Additionally, the value of the <code>--world</code> option can be used to specify the filename <code>TEST-&lt;world&gt;.xml</code>.</p>
<h3><a name="_language_options"></a>4.3. Language Options</h3>
<p>When <code>cxxtestgen</code> performs test discovery, it also performs checks
to detect whether (1) the standard library is used and (2) exceptions
are used.  These checks configure CxxTest to <em>not</em> assume that these
C++ language features are used when generating the test driver.
Thus, CxxTest can naturally be used with compilers that do not
support these features.</p>
<p>The <code>cxxtestgen</code> command includes several options that override
these checks and define features of C++ that are used by the test
runner.  The <code>--have-std</code> option indicates that the test runner
should use the standard library, and the <code>--no-std</code> option indicates
that the test runner should not use the standard library. The
--have-eh+ options indicates that the test runner should use
exception handling, and the <code>--no-eh</code> indicates that the test runner
should not not use exception handling.</p>
<p>The <code>--longlong</code> option specifies the type used for long long
integers.  The default is for <em>no</em> long long integer type to be specified,
which is consistent with the current C++ standard.</p>
<p>CxxTest test runners depend quite heavily on static initialization
of objects that are used to define and execute tests. The
--no-static-init+ option can be used to avoid static initialization
for compilers or linkers that have trouble compiling the default test runner.</p>
<h3><a name="_creating_test_runners_from_parts"></a>4.4. Creating Test Runners from Parts</h3>
<p>The default behavior of <code>cxxtestgen</code> is to generate a test runner
that directly integrates classes that define the tests along with
a <code>main()</code> function that executes all test suites.  It is often useful to
allow test suites to be processes separately and then linked together.  The <code>--root</code> and <code>--part</code> options
support this logic.  For example, suppose that we wish to define a test runner for tests in the headers
MyTestSuite1.h+ and <code>MyTestSuite2.h</code>.  We execute <code>cxxtestgen</code> with the <code>--part</code> option to generate source files for each of the test suites:</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>cxxtestgen --part --error-printer -o MyTestSuite1<font color="#990000">.</font>cpp MyTestSuite1<font color="#990000">.</font>h
cxxtestgen --part --error-printer -o MyTestSuite2<font color="#990000">.</font>cpp MyTestSuite2<font color="#990000">.</font>h</tt></pre></td></tr></table>
<p>Similarly, we execute <code>cxxtestgen</code> with the <code>--root</code> opiton to generate the <code>main()</code> routine:</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>cxxtestgen --root --error-printer -o runner<font color="#990000">.</font>cpp</tt></pre></td></tr></table>
<p>Finally, the test runner is built by compiling all of these source files together:</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>g<font color="#990000">++</font> -o runner -I<font color="#009900">$CXXTEST</font> runner<font color="#990000">.</font>cpp MyTestSuite1<font color="#990000">.</font>cpp MyTestSuite2<font color="#990000">.</font>cpp</tt></pre></td></tr></table>
<h3><a name="_template_files"></a>4.5. Template Files</h3>
<p>CxxTest supports the use of <em>template files</em> to provide a custom
main()+ function.  This may be useful when using a custom test
listener, or when using an existing CxxTest test listener in a
nonstandard manner.  A template file is an ordinary source files
with the embedded declaration <code>&lt;CxxTest world&gt;</code>, which tells
cxxtestgen+ to insert the world definition at that point.</p>
<p>The <code>--template</code> option is used to specify the use of a template file:</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>cxxtestgen -o runner<font color="#990000">.</font>cpp --template runner10<font color="#990000">.</font>tpl MyTestSuite2<font color="#990000">.</font>h</tt></pre></td></tr></table>
<p>For example, consider the following template file:</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><b><font color="#000080">#define</font></b> CXXTEST_HAVE_EH
<b><font color="#000080">#define</font></b> CXXTEST_ABORT_TEST_ON_FAIL
<b><font color="#000080">#include</font></b> <font color="#FF0000">&lt;cxxtest/ErrorPrinter.h&gt;</font>

<font color="#009900">int</font> <b><font color="#000000">main</font></b><font color="#990000">()</font>
<font color="#FF0000">{</font>
    std<font color="#990000">::</font>cout <font color="#990000">&lt;&lt;</font> <font color="#FF0000">"Starting test runner"</font> <font color="#990000">&lt;&lt;</font> std<font color="#990000">::</font>endl<font color="#990000">;</font>
    <font color="#009900">int</font> status <font color="#990000">=</font> CxxTest<font color="#990000">::</font><b><font color="#000000">ErrorPrinter</font></b><font color="#990000">().</font><b><font color="#000000">run</font></b><font color="#990000">();</font>
    std<font color="#990000">::</font>cout <font color="#990000">&lt;&lt;</font> <font color="#FF0000">"Stopping test runner"</font> <font color="#990000">&lt;&lt;</font> std<font color="#990000">::</font>endl<font color="#990000">;</font>
    <b><font color="#0000FF">return</font></b> status<font color="#990000">;</font>
<font color="#FF0000">}</font>

<i><font color="#9A1900">// The CxxTest "world"</font></i>
<font color="#990000">&lt;</font><font color="#008080">CxxTest</font> world<font color="#990000">&gt;</font></tt></pre></td></tr></table>
<p>This file specifies macros that customize the test runner, and output is generated before and after the tests are run.</p>
<p>Note that CxxTest needs to insert certain definitions and <code>#include</code>
directives in the runner file. It normally does that before the
first <code>#include &lt;cxxtest/*.h&gt;</code> found in the template file. If this
behavior is not what you need, use the directive <code>&lt;CxxTest preamble&gt;</code>
to specify where this preamble is inserted.</p>
<h3><a name="_test_discovery_options"></a>4.6. Test Discovery Options</h3>
<p>The <code>cxxtestgen</code> command performs test discovery by searching C++
header files for CxxTest test classes.  The default process for
test discovery is a simple process that analyzes each line in a
header file sequentially, looking for a sequence of lines that
represent class definitions and test method definitions.</p>
<p>There are many limitations to this simple process for test discovery,
and in CxxTest 4.0 a new test discovery mechanism was added based
on the a parser for the
<a href="http://www.computing.surrey.ac.uk/research/dsrg/fog/">Flexible Object
Generator (FOG)</a> language, which is a superset of C++.  The grammar
for the FOG language was adapted to parse C++ header files to
identify class definitions and class inheritance relationships,
class and namespace nesting of declarations, and class methods.
This allows <code>cxxtestgen</code> to identify test classes that are defined
with complex inheritance relationships.</p>
<p>The <code>--fog</code> option is used to specify the use of the FOG parser for
test discovery.  Although the FOG parser is more powerful, the
simpler <code>cxxtestgen</code> test discover process is the default because
the FOG parser is slower execute.  Additionally, the FOG parser
requires the installation of <code>ply</code> and, for Python version 2.6,
ordereddict+.  If these packages are not available, then the <code>--fog</code>
option is automatically disabled.</p>
<p>The following sections illustrate differences between these two test discovery mechanisms, along with
general limitations of the test discovery process.</p>
<h4><a name="_unexpected_test_suite_format"></a>4.6.1. Unexpected Test Suite Format</h4>
<p>The default test discovery mechanism does a very simple analysis
of the input files, which can easily fail when test classes are not
formated in a standard manner.  For example, consider the following
test suite:</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><i><font color="#9A1900">// MyTestSuite4.h</font></i>
<b><font color="#000080">#include</font></b> <font color="#FF0000">&lt;cxxtest/TestSuite.h&gt;</font>

<b><font color="#0000FF">class</font></b> <font color="#008080">MyTestSuite4</font>
    <font color="#990000">:</font>
<b><font color="#0000FF">public</font></b> CxxTest<font color="#990000">::</font>TestSuite
<font color="#FF0000">{</font>
<b><font color="#0000FF">public</font></b><font color="#990000">:</font>
    <font color="#009900">void</font> <b><font color="#000000">testAddition</font></b><font color="#990000">(</font><font color="#009900">void</font><font color="#990000">)</font>
    <font color="#FF0000">{</font>
        <b><font color="#000000">TS_ASSERT</font></b><font color="#990000">(</font><font color="#993399">1</font> <font color="#990000">+</font> <font color="#993399">1</font> <font color="#990000">&gt;</font> <font color="#993399">1</font><font color="#990000">);</font>
        <b><font color="#000000">TS_ASSERT_EQUALS</font></b><font color="#990000">(</font><font color="#993399">1</font> <font color="#990000">+</font> <font color="#993399">1</font><font color="#990000">,</font> <font color="#993399">2</font><font color="#990000">);</font>
    <font color="#FF0000">}</font>
<font color="#FF0000">}</font><font color="#990000">;</font></tt></pre></td></tr></table>
<p>This test suite is not recognized by the default test discovery
mechanism, but the FOG parser correctly parsers this file and
recognizes the test suite.  A variety of similar discovery failures
arise due to the simple process used by the test discovery mechanism.</p>
<h4><a name="_commenting_out_tests"></a>4.6.2. Commenting Out Tests</h4>
<p>Adding and disabling tests are two common steps in test development.
The process of test discovery makes adding tests very easy.  However,
disabling tests is somewhat more complicated.  Consider the following
header file, which defines four tests (three of which are disabled):</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><i><font color="#9A1900">// MyTestSuite3.h</font></i>
<b><font color="#000080">#include</font></b> <font color="#FF0000">&lt;cxxtest/TestSuite.h&gt;</font>

<b><font color="#0000FF">class</font></b> <font color="#008080">MyTestSuite3</font> <font color="#990000">:</font> <b><font color="#0000FF">public</font></b> CxxTest<font color="#990000">::</font>TestSuite
<font color="#FF0000">{</font>
<b><font color="#0000FF">public</font></b><font color="#990000">:</font>
    <font color="#009900">void</font> <b><font color="#000000">testAddition</font></b><font color="#990000">(</font><font color="#009900">void</font><font color="#990000">)</font>
    <font color="#FF0000">{</font>
        <b><font color="#000000">TS_ASSERT</font></b><font color="#990000">(</font><font color="#993399">1</font> <font color="#990000">+</font> <font color="#993399">1</font> <font color="#990000">&gt;</font> <font color="#993399">1</font><font color="#990000">);</font>
        <b><font color="#000000">TS_ASSERT_EQUALS</font></b><font color="#990000">(</font><font color="#993399">1</font> <font color="#990000">+</font> <font color="#993399">1</font><font color="#990000">,</font> <font color="#993399">2</font><font color="#990000">);</font>
    <font color="#FF0000">}</font>

<i><font color="#9A1900">//   void testMultiplication( void )</font></i>
<i><font color="#9A1900">//   {</font></i>
<i><font color="#9A1900">//      TS_ASSERT( 1 * 1 &lt; 2 );</font></i>
<i><font color="#9A1900">//      TS_ASSERT_EQUALS( 1 * 1, 2 );</font></i>
<i><font color="#9A1900">//   }</font></i>

    <i><font color="#9A1900">/*</font></i>
<i><font color="#9A1900">         void testSubtraction( void )</font></i>
<i><font color="#9A1900">         {</font></i>
<i><font color="#9A1900">            TS_ASSERT( 1 - 1 &lt; 1 );</font></i>
<i><font color="#9A1900">            TS_ASSERT_EQUALS( 1 - 1, 0 );</font></i>
<i><font color="#9A1900">         }</font></i>
<i><font color="#9A1900">    */</font></i>

    <font color="#009900">void</font> <b><font color="#000000">XtestDivision</font></b><font color="#990000">(</font><font color="#009900">void</font><font color="#990000">)</font>
    <font color="#FF0000">{</font>
        <b><font color="#000000">TS_ASSERT</font></b><font color="#990000">(</font><font color="#993399">1</font> <font color="#990000">/</font> <font color="#993399">1</font> <font color="#990000">&lt;</font> <font color="#993399">2</font><font color="#990000">);</font>
        <b><font color="#000000">TS_ASSERT_EQUALS</font></b><font color="#990000">(</font><font color="#993399">1</font> <font color="#990000">/</font> <font color="#993399">1</font><font color="#990000">,</font> <font color="#993399">1</font><font color="#990000">);</font>
    <font color="#FF0000">}</font>
<font color="#FF0000">}</font><font color="#990000">;</font></tt></pre></td></tr></table>
<p>The first is commented out with C++-style comments, the second
test is commented out with C-style comments, and the third test is
named in a manner that is not recognized through test discovery
(i.e., it does not start with <code>test</code>).</p>
<p>The default test discovery mechanism only works with the first and
third methods for disabling tests, but the FOG parser works with
all three.  The FOG parser performs a complex, multi-line parse of
the source file, so it can identify multi-line C-style comments.</p>
<p>Note, however, that the use of C macros will not work:</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><i><font color="#9A1900">// BadTestSuite1.h</font></i>
<b><font color="#000080">#include</font></b> <font color="#FF0000">&lt;cxxtest/TestSuite.h&gt;</font>

<b><font color="#0000FF">class</font></b> <font color="#008080">BadTestSuite1</font> <font color="#990000">:</font> <b><font color="#0000FF">public</font></b> CxxTest<font color="#990000">::</font>TestSuite
<font color="#FF0000">{</font>
<b><font color="#0000FF">public</font></b><font color="#990000">:</font>
    <font color="#009900">void</font> <b><font color="#000000">testAddition</font></b><font color="#990000">(</font><font color="#009900">void</font><font color="#990000">)</font>
    <font color="#FF0000">{</font>
        <b><font color="#000000">TS_ASSERT</font></b><font color="#990000">(</font><font color="#993399">1</font> <font color="#990000">+</font> <font color="#993399">1</font> <font color="#990000">&gt;</font> <font color="#993399">1</font><font color="#990000">);</font>
        <b><font color="#000000">TS_ASSERT_EQUALS</font></b><font color="#990000">(</font><font color="#993399">1</font> <font color="#990000">+</font> <font color="#993399">1</font><font color="#990000">,</font> <font color="#993399">2</font><font color="#990000">);</font>
    <font color="#FF0000">}</font>
<b><font color="#000080">#if</font></b> <font color="#993399">0</font>
    <font color="#009900">void</font> <b><font color="#000000">testSubtraction</font></b><font color="#990000">(</font><font color="#009900">void</font><font color="#990000">)</font>
    <font color="#FF0000">{</font>
        <b><font color="#000000">TS_ASSERT</font></b><font color="#990000">(</font><font color="#993399">1</font> <font color="#990000">-</font> <font color="#993399">1</font> <font color="#990000">&lt;</font> <font color="#993399">1</font><font color="#990000">);</font>
        <b><font color="#000000">TS_ASSERT_EQUALS</font></b><font color="#990000">(</font><font color="#993399">1</font> <font color="#990000">-</font> <font color="#993399">1</font><font color="#990000">,</font> <font color="#993399">0</font><font color="#990000">);</font>
    <font color="#FF0000">}</font>
<b><font color="#000080">#endif</font></b>
<font color="#FF0000">}</font><font color="#990000">;</font></tt></pre></td></tr></table>
<p>The <code>cxxtestgen</code> discovery mechanisms do not perform a C preprocessing
step, since that would generally require using externally defined
preprocessing variable definitions.   Additionally, preprocessor macros that act like functions will
cause the FOG parser to fail unless they are followed by a semicolon.</p>
<h4><a name="_test_classes_nested_in_namespaces"></a>4.6.3. Test Classes Nested in Namespaces</h4>
<p>In some contexts, it is appropriate to nest test classes in namespaces.
This allows the same class name to be used without creating conflicts
in the test runner.  The default test discovery mechanism can only do
this by declaring the namespaces with the class name, and then declaring the
class with the explicit namespace prefix.  For example:</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><i><font color="#9A1900">// Namespace2.h</font></i>
<b><font color="#000080">#include</font></b> <font color="#FF0000">&lt;cxxtest/TestSuite.h&gt;</font>

<b><font color="#0000FF">namespace</font></b> foo <font color="#FF0000">{</font> <b><font color="#0000FF">namespace</font></b> bar <font color="#FF0000">{</font> <b><font color="#0000FF">class</font></b> <font color="#008080">MyTestSuite1</font><font color="#990000">;</font> <font color="#FF0000">}</font> <font color="#FF0000">}</font>

<b><font color="#0000FF">class</font></b> <font color="#008080">foo</font><font color="#990000">::</font>bar<font color="#990000">::</font>MyTestSuite1 <font color="#990000">:</font> <b><font color="#0000FF">public</font></b> CxxTest<font color="#990000">::</font>TestSuite
<font color="#FF0000">{</font>
<b><font color="#0000FF">public</font></b><font color="#990000">:</font>
    <font color="#009900">void</font> <b><font color="#000000">testAddition</font></b><font color="#990000">(</font><font color="#009900">void</font><font color="#990000">)</font>
    <font color="#FF0000">{</font>
        <b><font color="#000000">TS_ASSERT</font></b><font color="#990000">(</font><font color="#993399">1</font> <font color="#990000">+</font> <font color="#993399">1</font> <font color="#990000">&gt;</font> <font color="#993399">1</font><font color="#990000">);</font>
        <b><font color="#000000">TS_ASSERT_EQUALS</font></b><font color="#990000">(</font><font color="#993399">1</font> <font color="#990000">+</font> <font color="#993399">1</font><font color="#990000">,</font> <font color="#993399">2</font><font color="#990000">);</font>
    <font color="#FF0000">}</font>
<font color="#FF0000">}</font><font color="#990000">;</font>


<b><font color="#0000FF">namespace</font></b> FOO <font color="#FF0000">{</font> <b><font color="#0000FF">namespace</font></b> BAR <font color="#FF0000">{</font> <b><font color="#0000FF">class</font></b> <font color="#008080">MyTestSuite1</font><font color="#990000">;</font> <font color="#FF0000">}</font> <font color="#FF0000">}</font>

<b><font color="#0000FF">class</font></b> <font color="#008080">MyTestSuite1</font> <font color="#990000">:</font> <b><font color="#0000FF">public</font></b> CxxTest<font color="#990000">::</font>TestSuite
<font color="#FF0000">{</font>
<b><font color="#0000FF">public</font></b><font color="#990000">:</font>
    <font color="#009900">void</font> <b><font color="#000000">testAddition</font></b><font color="#990000">(</font><font color="#009900">void</font><font color="#990000">)</font>
    <font color="#FF0000">{</font>
        <b><font color="#000000">TS_ASSERT</font></b><font color="#990000">(</font><font color="#993399">1</font> <font color="#990000">+</font> <font color="#993399">1</font> <font color="#990000">&gt;</font> <font color="#993399">1</font><font color="#990000">);</font>
        <b><font color="#000000">TS_ASSERT_EQUALS</font></b><font color="#990000">(</font><font color="#993399">1</font> <font color="#990000">+</font> <font color="#993399">1</font><font color="#990000">,</font> <font color="#993399">2</font><font color="#990000">);</font>
    <font color="#FF0000">}</font>
<font color="#FF0000">}</font><font color="#990000">;</font>
</tt></pre></td></tr></table>
<p>However, the default test discovery mechanism cannot recognize the more typical
declaration of test classes within nested namespaces:</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><i><font color="#9A1900">// Namespace1.h</font></i>
<b><font color="#000080">#include</font></b> <font color="#FF0000">&lt;cxxtest/TestSuite.h&gt;</font>

<b><font color="#0000FF">namespace</font></b> foo
<font color="#FF0000">{</font>
<b><font color="#0000FF">namespace</font></b> bar
<font color="#FF0000">{</font>

<b><font color="#0000FF">class</font></b> <font color="#008080">MyTestSuite1</font> <font color="#990000">:</font> <b><font color="#0000FF">public</font></b> CxxTest<font color="#990000">::</font>TestSuite
<font color="#FF0000">{</font>
<b><font color="#0000FF">public</font></b><font color="#990000">:</font>
    <font color="#009900">void</font> <b><font color="#000000">testAddition</font></b><font color="#990000">(</font><font color="#009900">void</font><font color="#990000">)</font>
    <font color="#FF0000">{</font>
        <b><font color="#000000">TS_ASSERT</font></b><font color="#990000">(</font><font color="#993399">1</font> <font color="#990000">+</font> <font color="#993399">1</font> <font color="#990000">&gt;</font> <font color="#993399">1</font><font color="#990000">);</font>
        <b><font color="#000000">TS_ASSERT_EQUALS</font></b><font color="#990000">(</font><font color="#993399">1</font> <font color="#990000">+</font> <font color="#993399">1</font><font color="#990000">,</font> <font color="#993399">2</font><font color="#990000">);</font>
    <font color="#FF0000">}</font>
<font color="#FF0000">}</font><font color="#990000">;</font>

<font color="#FF0000">}</font>
<font color="#FF0000">}</font>


<b><font color="#0000FF">namespace</font></b> FOO
<font color="#FF0000">{</font>
<b><font color="#0000FF">namespace</font></b> BAR
<font color="#FF0000">{</font>

<b><font color="#0000FF">class</font></b> <font color="#008080">MyTestSuite1</font> <font color="#990000">:</font> <b><font color="#0000FF">public</font></b> CxxTest<font color="#990000">::</font>TestSuite
<font color="#FF0000">{</font>
<b><font color="#0000FF">public</font></b><font color="#990000">:</font>
    <font color="#009900">void</font> <b><font color="#000000">testAddition</font></b><font color="#990000">(</font><font color="#009900">void</font><font color="#990000">)</font>
    <font color="#FF0000">{</font>
        <b><font color="#000000">TS_ASSERT</font></b><font color="#990000">(</font><font color="#993399">1</font> <font color="#990000">+</font> <font color="#993399">1</font> <font color="#990000">&gt;</font> <font color="#993399">1</font><font color="#990000">);</font>
        <b><font color="#000000">TS_ASSERT_EQUALS</font></b><font color="#990000">(</font><font color="#993399">1</font> <font color="#990000">+</font> <font color="#993399">1</font><font color="#990000">,</font> <font color="#993399">2</font><font color="#990000">);</font>
    <font color="#FF0000">}</font>
<font color="#FF0000">}</font><font color="#990000">;</font>

<font color="#FF0000">}</font>
<font color="#FF0000">}</font></tt></pre></td></tr></table>
<p>The FOG parser can discover tests nested within arbitrary namespaces, and unique
names are used within the test runner to distinguish the test classes in different namespaces.</p>
<hr>
<h2><a name="runner"></a>5. Test Runner Syntax</h2>
<p>The default behavior of the CxxTest test runner is to execute all
tests in all of the test suites that are linked into the runner.
However, CxxTest test runners process command line options that
allow individual tests and test suites to be selected.</p>
<p>For example, consider a test runner defined as follows:</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>cxxtestgen -f --error-printer -o runner<font color="#990000">.</font>cpp MyTestSuite1<font color="#990000">.</font>h MyTestSuite2<font color="#990000">.</font>h MyTestSuite4<font color="#990000">.</font>h</tt></pre></td></tr></table>
<p>The <code>--help</code> (<code>-h</code>) option can be used to print the command line options for a test runner.  The command</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="4"><tr><td>
<pre><code>./runner --help</code></pre>
</td></tr></table>
<p>generates the following output:</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="4"><tr><td>
<pre><code>./runner &lt;suitename&gt;
./runner &lt;suitename&gt; &lt;testname&gt;
./runner -h
./runner --help
./runner --help-tests
./runner -v             Enable tracing output.</code></pre>
</td></tr></table>
<p>The <code>--help-tests</code> option is used to list all test suites that are defined in a test runner.  The command</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><font color="#990000">.</font>/runner --help-tests</tt></pre></td></tr></table>
<p>generates the following output:</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="4"><tr><td>
<pre><code>Suite/Test Names
---------------------------------------------------------------------------
MyTestSuite1 testAddition
MyTestSuite2 testAddition
MyTestSuite2 testMultiplication
MyTestSuite4 testAddition</code></pre>
</td></tr></table>
<p>The first column is the test suite name, and the second column is the test name.</p>
<p>All tests in a test suite can be executed by simply specifying the test suite name.  For example</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><font color="#990000">.</font>/runner MyTestSuite2</tt></pre></td></tr></table>
<p>executes the tests in test suite <code>MyTestSuite2</code>:</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="4"><tr><td>
<pre><code>Running cxxtest tests (2 tests).
In MyTestSuite2::testMultiplication:
/Users/wehart/home/mac/src/cxxtest/doc/examples/MyTestSuite2.h:16: Error: Expected (2 * 2 == 5), found (4 != 5)
Failed 1 and Skipped 0 of 2 tests
Success rate: 50%</code></pre>
</td></tr></table>
<p>Similarly, a single test can be executed by specifying the test suite followed by the test name.  For example</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><font color="#990000">.</font>/runner MyTestSuite2 testMultiplication</tt></pre></td></tr></table>
<p>executes the <code>testMultiplication</code> test in test suite <code>MyTestSuite2</code>:</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="4"><tr><td>
<pre><code>Running cxxtest tests (1 test)
In MyTestSuite2::testMultiplication:
/Users/wehart/home/mac/src/cxxtest/doc/examples/MyTestSuite2.h:16: Error: Expected (2 * 2 == 5), found (4 != 5)
Failed 1 and Skipped 0 of 1 test
Success rate: 0%</code></pre>
</td></tr></table>
<p>The <code>-v</code> option enables the printing of trace information generated
by the <code>TS_TRACE</code> function.  For example, the <code>testMultiplication</code> test contains trace declarations
before and after the multiplication test.  Thus, the command</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><font color="#990000">.</font>/runner -v MyTestSuite2 testMultiplication</tt></pre></td></tr></table>
<p>generates this trace output before and after the test:</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="4"><tr><td>
<pre><code>Running cxxtest tests (1 test)
In MyTestSuite2::testMultiplication:
/Users/wehart/home/mac/src/cxxtest/doc/examples/MyTestSuite2.h:15: Trace: Starting multiplication test
/Users/wehart/home/mac/src/cxxtest/doc/examples/MyTestSuite2.h:16: Error: Expected (2 * 2 == 5), found (4 != 5)
/Users/wehart/home/mac/src/cxxtest/doc/examples/MyTestSuite2.h:17: Trace: Finishing multiplication test
Failed 1 and Skipped 0 of 1 test
Success rate: 0%</code></pre>
</td></tr></table>
<hr>
<h2><a name="advanced"></a>6. Advanced Testing Features</h2>
<h3><a name="_preprocessor_macros"></a>6.1. Preprocessor Macros</h3>
<p>CxxTest recognizes a variety of preprocessor macros that can be used to modify the behavior of a test runner.  Many of these mimic the options of the <code>cxxtestgen</code> command.</p>
<div>
<table rules="all"
width="100%"
frame="border"
cellspacing="0" cellpadding="4">
<thead>
<tr>
<th align="left" width="50%" valign="top"> Preprocessor Macro  </th>
<th align="left" width="50%" valign="top"> Description</th>
</tr>
</thead>
<tbody>
<tr>
<td align="left" width="50%" valign="top"><p><code>CXXTEST_HAVE_STD</code></p></td>
<td align="left" width="50%" valign="top"><p>Use the standard library.</p></td>
</tr>
<tr>
<td align="left" width="50%" valign="top"><p><code>CXXTEST_HAVE_EH</code></p></td>
<td align="left" width="50%" valign="top"><p>Use exception handling.</p></td>
</tr>
<tr>
<td align="left" width="50%" valign="top"><p><code>CXXTEST_ABORT_TEST_ON_FAIL</code></p></td>
<td align="left" width="50%" valign="top"><p>Abort tests on failed asserts.</p></td>
</tr>
<tr>
<td align="left" width="50%" valign="top"><p><code>CXXTEST_USER_VALUE_TRAITS</code></p></td>
<td align="left" width="50%" valign="top"><p>Enable user-defined value traits.  The default traits dump up to 8 bytes of the data as hex values.</p></td>
</tr>
<tr>
<td align="left" width="50%" valign="top"><p><code>CXXTEST_OLD_TEMPLATE_SYNTAX</code></p></td>
<td align="left" width="50%" valign="top"><p>Use old template syntax that is used by some compilers (e.g. Borland C++ 5).</p></td>
</tr>
<tr>
<td align="left" width="50%" valign="top"><p><code>CXXTEST_OLD_STD</code></p></td>
<td align="left" width="50%" valign="top"><p>Use old syntax for libraries where <code>std::</code> is not recognized.</p></td>
</tr>
<tr>
<td align="left" width="50%" valign="top"><p><code>CXXTEST_MAX_DUMP_SIZE</code></p></td>
<td align="left" width="50%" valign="top"><p>The value of this macro defines the maximum number of bytes to dump if <code>TS_ASSERT_SAME_DATA()</code> fails. The default is 0, which indicates no limit.</p></td>
</tr>
<tr>
<td align="left" width="50%" valign="top"><p><code>CXXTEST_DEFAULT_ABORT</code></p></td>
<td align="left" width="50%" valign="top"><p>The value of this macro is the default value of the dynamic <em>abort on fail</em> flag.</p></td>
</tr>
<tr>
<td align="left" width="50%" valign="top"><p><code>CXXTEST_LONGLONG</code></p></td>
<td align="left" width="50%" valign="top"><p>The value of this macro is used to define long long integers.</p></td>
</tr>
</tbody>
</table>
</div>
<p>These preprocessor macros must be defined before the CxxTest header
files are included in the test runner.  For example, the following
template file defines <code>CXXTEST_HAVE_EH</code> and <code>CXXTEST_ABORT_TEST_ON_FAIL</code>
before other headers are included:</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><b><font color="#000080">#define</font></b> CXXTEST_HAVE_EH
<b><font color="#000080">#define</font></b> CXXTEST_ABORT_TEST_ON_FAIL
<b><font color="#000080">#include</font></b> <font color="#FF0000">&lt;cxxtest/ErrorPrinter.h&gt;</font>

<font color="#009900">int</font> <b><font color="#000000">main</font></b><font color="#990000">()</font>
<font color="#FF0000">{</font>
    std<font color="#990000">::</font>cout <font color="#990000">&lt;&lt;</font> <font color="#FF0000">"Starting test runner"</font> <font color="#990000">&lt;&lt;</font> std<font color="#990000">::</font>endl<font color="#990000">;</font>
    <font color="#009900">int</font> status <font color="#990000">=</font> CxxTest<font color="#990000">::</font><b><font color="#000000">ErrorPrinter</font></b><font color="#990000">().</font><b><font color="#000000">run</font></b><font color="#990000">();</font>
    std<font color="#990000">::</font>cout <font color="#990000">&lt;&lt;</font> <font color="#FF0000">"Stopping test runner"</font> <font color="#990000">&lt;&lt;</font> std<font color="#990000">::</font>endl<font color="#990000">;</font>
    <b><font color="#0000FF">return</font></b> status<font color="#990000">;</font>
<font color="#FF0000">}</font>

<i><font color="#9A1900">// The CxxTest "world"</font></i>
<font color="#990000">&lt;</font><font color="#008080">CxxTest</font> world<font color="#990000">&gt;</font></tt></pre></td></tr></table>
<p>Several of these macros concern whether modern C++ conventions are
supported by the compiler.  If tests need to be ported to multiple
compilers, then one important convention is whether the namespace
<code>std::</code> is supported.  For example, switching between <code>cout</code> and
<code>std::cout</code> typically needs to be done throughout a code.  CxxTest
supports this with the <code>CXXTEST_STD()</code> macro.  For example,
<code>CXXTEST_STD(cout)</code> can be used within a test suite, and CxxTest
handles the mapping of this to <code>cout</code> or <code>std::cout</code> depending on
options provided to <code>cxxtestgen</code>.</p>
<p>Finally, CxxTest defines the <code>CXXTEST_RUNNING</code> preprocessor macro.
This can be used in a test header file to define code that is
executed when the header is not used in a test runner.  For example:</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><i><font color="#9A1900">// MyTestSuite12.h</font></i>
<b><font color="#000080">#include</font></b> <font color="#FF0000">&lt;cxxtest/TestSuite.h&gt;</font>

<b><font color="#0000FF">class</font></b> <font color="#008080">MyTestSuite1</font> <font color="#990000">:</font> <b><font color="#0000FF">public</font></b> CxxTest<font color="#990000">::</font>TestSuite
<font color="#FF0000">{</font>
<b><font color="#0000FF">public</font></b><font color="#990000">:</font>
    <font color="#009900">void</font> <b><font color="#000000">testAddition</font></b><font color="#990000">(</font><font color="#009900">void</font><font color="#990000">)</font>
    <font color="#FF0000">{</font>
        <b><font color="#000000">TS_ASSERT</font></b><font color="#990000">(</font><font color="#993399">1</font> <font color="#990000">+</font> <font color="#993399">1</font> <font color="#990000">&gt;</font> <font color="#993399">1</font><font color="#990000">);</font>
        <b><font color="#000000">TS_ASSERT_EQUALS</font></b><font color="#990000">(</font><font color="#993399">1</font> <font color="#990000">+</font> <font color="#993399">1</font><font color="#990000">,</font> <font color="#993399">2</font><font color="#990000">);</font>
    <font color="#FF0000">}</font>
<font color="#FF0000">}</font><font color="#990000">;</font>


<b><font color="#000080">#ifndef</font></b> CXXTEST_RUNNING
<b><font color="#000080">#include</font></b> <font color="#FF0000">&lt;iostream&gt;</font>

<font color="#009900">int</font> <b><font color="#000000">main</font></b><font color="#990000">(</font><font color="#009900">int</font> argc<font color="#990000">,</font> <font color="#009900">char</font> <font color="#990000">*</font>argv<font color="#990000">[])</font>
<font color="#FF0000">{</font>

    std<font color="#990000">::</font>cout <font color="#990000">&lt;&lt;</font> <font color="#FF0000">"Non-CxxTest stuff is happening now."</font> <font color="#990000">&lt;&lt;</font> std<font color="#990000">::</font>endl<font color="#990000">;</font>

<font color="#FF0000">}</font>
<b><font color="#000080">#endif</font></b></tt></pre></td></tr></table>
<p>Note that test suites derived from <code>CxxTest::TestSuite</code> class cannot
easily be built outside of the test runner.</p>
<h3><a name="_customizing_test_fixtures"></a>6.2. Customizing Test Fixtures</h3>
<h4><a name="_setup_and_teardown"></a>6.2.1. Setup and Teardown</h4>
<p>CxxTest test fixtures can be customized in several ways to manage
the environment for test suites and individual tests.  A common
feature of test suites is that they share a common logic for setting
up data used in the tests.  Thus, there may be duplicate code for
creating objects, files, inputs, etc.  Similarly, the tests may
share common logic for cleaning up after the test is finished (e.g. deleting temporary objects).</p>
<p>You can put this shared code in a common place by overriding the
virtual functions <code>TestSuite::setUp()</code> and <code>TestSuite::tearDown()</code>.
The <code>setUp()</code> function is called before each test, and <code>tearDown()</code>
is called after each test.</p>
<p>For example, the following test suite employs <code>setUp()</code> and <code>tearDown()</code> methods to
allocate and deallocate memory for a string buffer:</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><i><font color="#9A1900">// MyTestSuite5.h</font></i>
<b><font color="#000080">#include</font></b> <font color="#FF0000">&lt;cxxtest/TestSuite.h&gt;</font>
<b><font color="#000080">#include</font></b> <font color="#FF0000">&lt;string.h&gt;</font>

<b><font color="#0000FF">class</font></b> <font color="#008080">MyTestSuite5</font> <font color="#990000">:</font> <b><font color="#0000FF">public</font></b> CxxTest<font color="#990000">::</font>TestSuite
<font color="#FF0000">{</font>
    <font color="#009900">char</font> <font color="#990000">*</font>_buffer<font color="#990000">;</font>

<b><font color="#0000FF">public</font></b><font color="#990000">:</font>

    <font color="#009900">void</font> <b><font color="#000000">setUp</font></b><font color="#990000">()</font>
    <font color="#FF0000">{</font>
        _buffer <font color="#990000">=</font> <b><font color="#0000FF">new</font></b> <font color="#009900">char</font><font color="#990000">[</font><font color="#993399">1024</font><font color="#990000">];</font>
    <font color="#FF0000">}</font>

    <font color="#009900">void</font> <b><font color="#000000">tearDown</font></b><font color="#990000">()</font>
    <font color="#FF0000">{</font>
        <b><font color="#0000FF">delete</font></b> <font color="#990000">[]</font> _buffer<font color="#990000">;</font>
    <font color="#FF0000">}</font>

    <font color="#009900">void</font> <b><font color="#000000">test_strcpy</font></b><font color="#990000">()</font>
    <font color="#FF0000">{</font>
        <b><font color="#000000">strcpy</font></b><font color="#990000">(</font>_buffer<font color="#990000">,</font> <font color="#FF0000">"Hello, world!"</font><font color="#990000">);</font>
        <b><font color="#000000">TS_ASSERT_EQUALS</font></b><font color="#990000">(</font>_buffer<font color="#990000">[</font><font color="#993399">0</font><font color="#990000">],</font> <font color="#FF0000">'H'</font><font color="#990000">);</font>
        <b><font color="#000000">TS_ASSERT_EQUALS</font></b><font color="#990000">(</font>_buffer<font color="#990000">[</font><font color="#993399">1</font><font color="#990000">],</font> <font color="#FF0000">'e'</font><font color="#990000">);</font>
    <font color="#FF0000">}</font>

    <font color="#009900">void</font> <b><font color="#000000">test_memcpy</font></b><font color="#990000">()</font>
    <font color="#FF0000">{</font>
        <b><font color="#000000">memcpy</font></b><font color="#990000">(</font>_buffer<font color="#990000">,</font> <font color="#FF0000">"Hello, world!"</font><font color="#990000">,</font> <b><font color="#0000FF">sizeof</font></b><font color="#990000">(</font><font color="#009900">char</font><font color="#990000">));</font>
        <b><font color="#000000">TS_ASSERT_EQUALS</font></b><font color="#990000">(</font>_buffer<font color="#990000">[</font><font color="#993399">0</font><font color="#990000">],</font> <font color="#FF0000">'H'</font><font color="#990000">);</font>
        <b><font color="#000000">TS_ASSERT_EQUALS</font></b><font color="#990000">(</font>_buffer<font color="#990000">[</font><font color="#993399">1</font><font color="#990000">],</font> <font color="#FF0000">'e'</font><font color="#990000">);</font>
    <font color="#FF0000">}</font>
<font color="#FF0000">}</font><font color="#990000">;</font>
</tt></pre></td></tr></table>
<p>Note that test assertions cannot be used in within the <code>setUp()</code>
or <code>tearDown()</code> methods.  The scope of these methods is outside any
test case, so an assertion failure does not have a clear semantics.
Similarly, test assertions cannot be used in
world setup and teardown or in <code>createSuite()</code> or <code>destroySuite()</code> methods for for
dynamicly created test suites (see below).</p>
<h4><a name="_dynamically_created_test_suites"></a>6.2.2. Dynamically Created Test Suites</h4>
<p>CxxTest test fixtures can also be customized during the construction
and deconstruction of test suites.  By default, CxxTest test suites
are instantiated statically in the test runner.  However, dynamically
created test suites can be used to perform suite-level setup and
teardown operations, verify the environment needed to execute a
test suite, and construct test suites that require a nontrivial
constructor.</p>
<p>CxxTest instantiates a test suite dynamically if the <code>createSuite()</code>
or <code>destroySuite()</code> methods are defined.  For example, the following
test suite checks to see if it is being compiled with Microsoft
Visual Studio.  If not, the <code>createSuite()</code> returns a null pointer,
indicating that the test suite was not created.</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><i><font color="#9A1900">// MyTestSuite6.h</font></i>
<b><font color="#000080">#include</font></b> <font color="#FF0000">&lt;cxxtest/TestSuite.h&gt;</font>

<b><font color="#0000FF">class</font></b> <font color="#008080">MyTestSuite6</font> <font color="#990000">:</font> <b><font color="#0000FF">public</font></b> CxxTest<font color="#990000">::</font>TestSuite
<font color="#FF0000">{</font>
<b><font color="#0000FF">public</font></b><font color="#990000">:</font>

    <b><font color="#0000FF">static</font></b> MyTestSuite6<font color="#990000">*</font> <b><font color="#000000">createSuite</font></b><font color="#990000">()</font>
    <font color="#FF0000">{</font>
<b><font color="#000080">#ifdef</font></b> _MSC_VER
        <b><font color="#0000FF">return</font></b> <b><font color="#0000FF">new</font></b> <b><font color="#000000">MyTestSuite6</font></b><font color="#990000">();</font>
<b><font color="#000080">#else</font></b>
        <b><font color="#0000FF">return</font></b> <font color="#993399">0</font><font color="#990000">;</font>
<b><font color="#000080">#endif</font></b>
    <font color="#FF0000">}</font>

    <b><font color="#0000FF">static</font></b> <font color="#009900">void</font> <b><font color="#000000">destroySuite</font></b><font color="#990000">(</font>MyTestSuite6<font color="#990000">*</font> suite<font color="#990000">)</font>
    <font color="#FF0000">{</font> <b><font color="#0000FF">delete</font></b> suite<font color="#990000">;</font> <font color="#FF0000">}</font>

    <font color="#009900">void</font> <b><font color="#000000">test_nothing</font></b><font color="#990000">()</font>
    <font color="#FF0000">{</font>
        <b><font color="#000000">TS_FAIL</font></b><font color="#990000">(</font><font color="#FF0000">"Nothing to test"</font><font color="#990000">);</font>
    <font color="#FF0000">}</font>
<font color="#FF0000">}</font><font color="#990000">;</font></tt></pre></td></tr></table>
<h4><a name="_global_and_world_fixtures"></a>6.2.3. Global and World Fixtures</h4>
<p>CxxTest supports two related mechanisms for performing <em>global</em>
setup and teardown operations.  <em>Global fixtures</em> are classes that
inherit from <code>CxxTest::GlobalFixture</code>, and they define <code>setUp</code> and
<code>tearDown</code> methods.  The <code>setUp</code> method for all global fixtures is
called before each test is executed, and the <code>tearDown</code> method for
all global fixtures is called after each test is completed.  Thus,
this mechanism provides a convenient way of defining setup and
teardown operations that apply to all test suites.</p>
<p>For example, consider the following test suite:</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><i><font color="#9A1900">// MyTestSuite8.h</font></i>
<b><font color="#000080">#include</font></b> <font color="#FF0000">&lt;cstdio&gt;</font>
<b><font color="#000080">#include</font></b> <font color="#FF0000">&lt;cxxtest/TestSuite.h&gt;</font>
<b><font color="#000080">#include</font></b> <font color="#FF0000">&lt;cxxtest/GlobalFixture.h&gt;</font>

<i><font color="#9A1900">//</font></i>
<i><font color="#9A1900">// Fixture1 counts its setUp()s and tearDown()s</font></i>
<i><font color="#9A1900">//</font></i>
<b><font color="#0000FF">class</font></b> <font color="#008080">Fixture1</font> <font color="#990000">:</font> <b><font color="#0000FF">public</font></b> CxxTest<font color="#990000">::</font>GlobalFixture
<font color="#FF0000">{</font>
<b><font color="#0000FF">public</font></b><font color="#990000">:</font>
    <font color="#009900">unsigned</font> setUpCount<font color="#990000">;</font>
    <font color="#009900">unsigned</font> tearDownCount<font color="#990000">;</font>

    <b><font color="#000000">Fixture1</font></b><font color="#990000">()</font> <font color="#FF0000">{</font> setUpCount <font color="#990000">=</font> tearDownCount <font color="#990000">=</font> <font color="#993399">0</font><font color="#990000">;</font> <font color="#FF0000">}</font>

    <font color="#009900">bool</font> <b><font color="#000000">setUp</font></b><font color="#990000">()</font> <font color="#FF0000">{</font> <font color="#990000">++</font> setUpCount<font color="#990000">;</font> <b><font color="#0000FF">return</font></b> <b><font color="#0000FF">true</font></b><font color="#990000">;</font> <font color="#FF0000">}</font>
    <font color="#009900">bool</font> <b><font color="#000000">tearDown</font></b><font color="#990000">()</font> <font color="#FF0000">{</font> <font color="#990000">++</font> tearDownCount<font color="#990000">;</font> <b><font color="#0000FF">return</font></b> <b><font color="#0000FF">true</font></b><font color="#990000">;</font> <font color="#FF0000">}</font>

    <font color="#009900">bool</font> <b><font color="#000000">setUpWorld</font></b><font color="#990000">()</font> <font color="#FF0000">{</font> <b><font color="#000000">printf</font></b><font color="#990000">(</font><font color="#FF0000">"Starting a test suite</font><font color="#CC33CC">\n</font><font color="#FF0000">"</font><font color="#990000">);</font> <b><font color="#0000FF">return</font></b> <b><font color="#0000FF">true</font></b><font color="#990000">;</font><font color="#FF0000">}</font>
    <font color="#009900">bool</font> <b><font color="#000000">tearDownWorld</font></b><font color="#990000">()</font> <font color="#FF0000">{</font> <b><font color="#000000">printf</font></b><font color="#990000">(</font><font color="#FF0000">"Finishing a test suite</font><font color="#CC33CC">\n</font><font color="#FF0000">"</font><font color="#990000">);</font> <b><font color="#0000FF">return</font></b> <b><font color="#0000FF">true</font></b><font color="#990000">;</font><font color="#FF0000">}</font>
<font color="#FF0000">}</font><font color="#990000">;</font>
<b><font color="#0000FF">static</font></b> <font color="#008080">Fixture1</font> fixture1<font color="#990000">;</font>


<i><font color="#9A1900">//</font></i>
<i><font color="#9A1900">// Fixture2 counts its setUp()s and tearDown()s and makes sure</font></i>
<i><font color="#9A1900">// its setUp() is called after Fixture1 and its tearDown() before.</font></i>
<i><font color="#9A1900">//</font></i>
<b><font color="#0000FF">class</font></b> <font color="#008080">Fixture2</font> <font color="#990000">:</font> <b><font color="#0000FF">public</font></b> Fixture1
<font color="#FF0000">{</font>
<b><font color="#0000FF">public</font></b><font color="#990000">:</font>
    <font color="#009900">bool</font> <b><font color="#000000">setUp</font></b><font color="#990000">()</font>
    <font color="#FF0000">{</font>
        <b><font color="#000000">TS_ASSERT_EQUALS</font></b><font color="#990000">(</font>setUpCount<font color="#990000">,</font> fixture1<font color="#990000">.</font>setUpCount <font color="#990000">-</font> <font color="#993399">1</font><font color="#990000">);</font>
        <b><font color="#000000">TS_ASSERT_EQUALS</font></b><font color="#990000">(</font>tearDownCount<font color="#990000">,</font> fixture1<font color="#990000">.</font>tearDownCount<font color="#990000">);</font>
        <b><font color="#0000FF">return</font></b> Fixture1<font color="#990000">::</font><b><font color="#000000">setUp</font></b><font color="#990000">();</font>
    <font color="#FF0000">}</font>

    <font color="#009900">bool</font> <b><font color="#000000">tearDown</font></b><font color="#990000">()</font>
    <font color="#FF0000">{</font>
        <b><font color="#000000">TS_ASSERT_EQUALS</font></b><font color="#990000">(</font>setUpCount<font color="#990000">,</font> fixture1<font color="#990000">.</font>setUpCount<font color="#990000">);</font>
        <b><font color="#000000">TS_ASSERT_EQUALS</font></b><font color="#990000">(</font>tearDownCount<font color="#990000">,</font> fixture1<font color="#990000">.</font>tearDownCount<font color="#990000">);</font>
        <b><font color="#0000FF">return</font></b> Fixture1<font color="#990000">::</font><b><font color="#000000">tearDown</font></b><font color="#990000">();</font>
    <font color="#FF0000">}</font>
<font color="#FF0000">}</font><font color="#990000">;</font>
<b><font color="#0000FF">static</font></b> <font color="#008080">Fixture2</font> fixture2<font color="#990000">;</font>


<i><font color="#9A1900">//</font></i>
<i><font color="#9A1900">// Verify the counts for the global fixtures</font></i>
<i><font color="#9A1900">//</font></i>
<b><font color="#0000FF">class</font></b> <font color="#008080">MyTestSuite8</font> <font color="#990000">:</font> <b><font color="#0000FF">public</font></b> CxxTest<font color="#990000">::</font>TestSuite
<font color="#FF0000">{</font>
<b><font color="#0000FF">public</font></b><font color="#990000">:</font>
    <font color="#009900">void</font> <b><font color="#000000">testCountsFirstTime</font></b><font color="#990000">()</font>
    <font color="#FF0000">{</font>
        <b><font color="#000000">TS_ASSERT_EQUALS</font></b><font color="#990000">(</font>fixture1<font color="#990000">.</font>setUpCount<font color="#990000">,</font>    <font color="#993399">1</font><font color="#990000">);</font>
        <b><font color="#000000">TS_ASSERT_EQUALS</font></b><font color="#990000">(</font>fixture1<font color="#990000">.</font>tearDownCount<font color="#990000">,</font> <font color="#993399">0</font><font color="#990000">);</font>
        <b><font color="#000000">TS_ASSERT_EQUALS</font></b><font color="#990000">(</font>fixture2<font color="#990000">.</font>setUpCount<font color="#990000">,</font>    <font color="#993399">1</font><font color="#990000">);</font>
        <b><font color="#000000">TS_ASSERT_EQUALS</font></b><font color="#990000">(</font>fixture2<font color="#990000">.</font>tearDownCount<font color="#990000">,</font> <font color="#993399">0</font><font color="#990000">);</font>
    <font color="#FF0000">}</font>

    <font color="#009900">void</font> <b><font color="#000000">testCountsSecondTime</font></b><font color="#990000">()</font>
    <font color="#FF0000">{</font>
        <b><font color="#000000">TS_ASSERT_EQUALS</font></b><font color="#990000">(</font>fixture1<font color="#990000">.</font>setUpCount<font color="#990000">,</font>    <font color="#993399">2</font><font color="#990000">);</font>
        <b><font color="#000000">TS_ASSERT_EQUALS</font></b><font color="#990000">(</font>fixture1<font color="#990000">.</font>tearDownCount<font color="#990000">,</font> <font color="#993399">1</font><font color="#990000">);</font>
        <b><font color="#000000">TS_ASSERT_EQUALS</font></b><font color="#990000">(</font>fixture2<font color="#990000">.</font>setUpCount<font color="#990000">,</font>    <font color="#993399">2</font><font color="#990000">);</font>
        <b><font color="#000000">TS_ASSERT_EQUALS</font></b><font color="#990000">(</font>fixture2<font color="#990000">.</font>tearDownCount<font color="#990000">,</font> <font color="#993399">1</font><font color="#990000">);</font>
    <font color="#FF0000">}</font>
<font color="#FF0000">}</font><font color="#990000">;</font></tt></pre></td></tr></table>
<p>This test suite defines a runner that generates the following output:</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="4"><tr><td>
<pre><code>Running cxxtest tests (2 tests)Starting a test suite
Starting a test suite
..Finishing a test suite
Finishing a test suite
OK!</code></pre>
</td></tr></table>
<p>Note that the global fixtures are instantiated with static global
values.  This ensures that these fixtures are created before the
runner is initialized.  Also, note that the <code>setUp</code> methods are
called in the same sequence that the global fixtures are instantiated,
and the <code>tearDown</code> methods are called in the reverse sequence.
Finally, note that the <code>setUp</code> and <code>tearDown</code> methods in global
fixtures return a boolean value, which indicates success or failure
of that operation.</p>
<p>This example also illustrates the use of <em>world fixtures</em>, which
perform setup and teardown operations that are executed once each
when beginning and finishing tests in each test suite.  World
fixtures are defined with the <code>setUpWorld</code> and <code>tearDownWorld</code>
methods in a global fixture.</p>
<h4><a name="_runtime_test_customization"></a>6.2.4. Runtime Test Customization</h4>
<p>CxxTest defines several functions that can be called in a test suite to modify the default behavior of CxxTest.</p>
<div>
<table rules="all"
width="100%"
frame="border"
cellspacing="0" cellpadding="4">
<thead>
<tr>
<th align="left" width="50%" valign="top"> Test Suite Method </th>
<th align="left" width="50%" valign="top"> Description</th>
</tr>
</thead>
<tbody>
<tr>
<td align="left" width="50%" valign="top"><p><code>setAbortTestOnFail(bool)</code></p></td>
<td align="left" width="50%" valign="top"><p>This function specifies whether tests abort after a failure.  The default value of the flag is <code>false</code>.  This function only has an effect if exception handling is enabled.</p></td>
</tr>
<tr>
<td align="left" width="50%" valign="top"><p><code>setMaxDumpSize(unsigned)</code></p></td>
<td align="left" width="50%" valign="top"><p>This function sets the maximum number of bytes that are dumped when
<code>TS_ASSERT_SAME_DATA()</code> fails. The default is 0, which indicates no limit.</p></td>
</tr>
</tbody>
</table>
</div>
<p>Note that the the configuration parameters are reset to their default
values after each test is executed (more precisely, after <code>tearDown()</code>
is called).  Consequently, calling these functions in the <code>setUp()</code>
function has the effect of setting that value for the entire test
suite.</p>
<hr>
<h2><a name="traits"></a>7. Value Traits</h2>
<p>CxxTest&#8217;s test assertions like <a href="#ts_assert_equals">TS_ASSERT_EQUALS</a>
work for built-in types, but they will not likely work for user-defined
data types.  This is because CxxTest needs a way to compare objects
and to convert them to strings when printing test failure summaries.
Thus, user-defined data types need to have the <code>operator=</code> method
defined to ensure that test assertions can be applied.</p>
<p>For example, the following code</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><i><font color="#9A1900">// MyTestSuite7.h</font></i>
<b><font color="#000080">#include</font></b> <font color="#FF0000">&lt;cxxtest/TestSuite.h&gt;</font>
<b><font color="#000080">#include</font></b> <font color="#FF0000">&lt;iostream&gt;</font>

<b><font color="#0000FF">class</font></b> <font color="#008080">MyTestSuite7</font> <font color="#990000">:</font> <b><font color="#0000FF">public</font></b> CxxTest<font color="#990000">::</font>TestSuite
<font color="#FF0000">{</font>
<b><font color="#0000FF">public</font></b><font color="#990000">:</font>

    <b><font color="#0000FF">struct</font></b> <font color="#008080">Data</font>
    <font color="#FF0000">{</font>
        <font color="#009900">char</font> data<font color="#990000">[</font><font color="#993399">3</font><font color="#990000">];</font>
        <font color="#009900">bool</font> <b><font color="#0000FF">operator</font></b><font color="#990000">==(</font><font color="#008080">Data</font> o<font color="#990000">)</font>
        <font color="#FF0000">{</font>
            <b><font color="#0000FF">return</font></b> <font color="#990000">(</font><b><font color="#000000">memcmp</font></b><font color="#990000">(</font><b><font color="#0000FF">this</font></b><font color="#990000">,</font> <font color="#990000">&amp;</font>o<font color="#990000">,</font> <b><font color="#0000FF">sizeof</font></b><font color="#990000">(</font>o<font color="#990000">))</font> <font color="#990000">==</font> <font color="#993399">0</font><font color="#990000">);</font>
        <font color="#FF0000">}</font>
    <font color="#FF0000">}</font><font color="#990000">;</font>

    <b><font color="#0000FF">struct</font></b> <font color="#008080">Data2</font>
    <font color="#FF0000">{</font>
        <font color="#009900">char</font> data<font color="#990000">[</font><font color="#993399">3</font><font color="#990000">];</font>
    <font color="#FF0000">}</font><font color="#990000">;</font>

    <font color="#009900">void</font> <b><font color="#000000">testCompareData</font></b><font color="#990000">()</font>
    <font color="#FF0000">{</font>
        <font color="#008080">Data</font> x<font color="#990000">,</font> y<font color="#990000">;</font>
        <b><font color="#000000">memset</font></b><font color="#990000">(</font>x<font color="#990000">.</font>data<font color="#990000">,</font> <font color="#993399">0x12</font><font color="#990000">,</font> <b><font color="#0000FF">sizeof</font></b><font color="#990000">(</font>x<font color="#990000">.</font>data<font color="#990000">));</font>
        <b><font color="#000000">memset</font></b><font color="#990000">(</font>y<font color="#990000">.</font>data<font color="#990000">,</font> <font color="#993399">0xF6</font><font color="#990000">,</font> <b><font color="#0000FF">sizeof</font></b><font color="#990000">(</font>y<font color="#990000">.</font>data<font color="#990000">));</font>
        <b><font color="#000000">TS_ASSERT_EQUALS</font></b><font color="#990000">(</font>x<font color="#990000">,</font> y<font color="#990000">);</font>

        <font color="#008080">Data2</font> z<font color="#990000">,</font> w<font color="#990000">;</font>
        <b><font color="#000000">memset</font></b><font color="#990000">(</font>z<font color="#990000">.</font>data<font color="#990000">,</font> <font color="#993399">0x12</font><font color="#990000">,</font> <b><font color="#0000FF">sizeof</font></b><font color="#990000">(</font>x<font color="#990000">.</font>data<font color="#990000">));</font>
        <b><font color="#000000">memset</font></b><font color="#990000">(</font>w<font color="#990000">.</font>data<font color="#990000">,</font> <font color="#993399">0xF6</font><font color="#990000">,</font> <b><font color="#0000FF">sizeof</font></b><font color="#990000">(</font>y<font color="#990000">.</font>data<font color="#990000">));</font>
        <b><font color="#000000">TS_ASSERT_SAME_DATA</font></b><font color="#990000">(&amp;</font>z<font color="#990000">,</font> <font color="#990000">&amp;</font>w<font color="#990000">,</font> <b><font color="#0000FF">sizeof</font></b><font color="#990000">(</font>z<font color="#990000">))</font>
    <font color="#FF0000">}</font>
<font color="#FF0000">}</font><font color="#990000">;</font>
</tt></pre></td></tr></table>
<p>defines a test runner that generates the following output</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="4"><tr><td>
<pre><code>Running cxxtest tests (1 test)
In MyTestSuite7::testCompareData:
MyTestSuite7.h:28: Error: Expected (x == y), found ({ 12 12 12  } != { F6 F6 F6  })
MyTestSuite7.h:33: Error: Expected sizeof(z) (3) bytes to be equal at (&amp;z) and (&amp;w), found:
   { 12 12 12 }
     differs from
   { F6 F6 F6 }
Failed 1 and Skipped 0 of 1 test
Success rate: 0%</code></pre>
</td></tr></table>
<p>The <code>operator=</code> method is required to apply
<a href="#ts_assert_equals">TS_ASSERT_EQUALS</a> to <code>Data</code> objects.  However,
the <a href="#ts_assert_same_data">TS_ASSERT_SAME_DATA</a> assertion can be
applied to <code>Data2</code> objects that do not have <code>operator=</code> defined.</p>
<p>Since CxxTest does not rely on any external library, conversion
from arbitrary data types to strings is done using <em>value traits</em>.
For example, to convert an integer to a string, CxxTest does the following:</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><font color="#009900">int</font> i <font color="#990000">=</font> <font color="#993399">10</font><font color="#990000">;</font>
CxxTest<font color="#990000">::</font><font color="#008080">ValueTraits&lt;int&gt;</font> <b><font color="#000000">converter</font></b><font color="#990000">(</font>i<font color="#990000">);</font>
<b><font color="#0000FF">const</font></b> <font color="#009900">char</font><font color="#990000">*</font> string <font color="#990000">=</font> converter<font color="#990000">.</font><b><font color="#000000">asString</font></b><font color="#990000">();</font></tt></pre></td></tr></table>
<p>The CxxTest header file <code>cxxtest/ValueTraits.h</code> defines value traits
for standard types like <code>int</code>, <code>char</code>, <code>double</code>, etc.  The default
<code>ValueTraits</code> class for unknown types dumps up to 8 bytes of the value
in hex format.</p>
<p>If the macro <code>CXXTEST_USER_VALUE_TRAITS</code> is defined, then CxxTest will
omit the default definitions for <code>ValueTraits</code>.  This allows a user to define their own trait specifications to customize the display of trait information.</p>
<h3><a name="_enumeration_traits"></a>7.1. Enumeration Traits</h3>
<p>CxxTest provides a simple way to define value traits for enumeration
types.  The <code>CXXTEST_ENUM_TRAITS</code> macro is used to define value
traits for all members of an enumeration set.</p>
<p>For example, the following code</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><i><font color="#9A1900">// MyTestSuite9.h</font></i>
<b><font color="#000080">#include</font></b> <font color="#FF0000">&lt;cxxtest/TestSuite.h&gt;</font>

<b><font color="#0000FF">enum</font></b> Answer
<font color="#FF0000">{</font>
    Yes<font color="#990000">,</font>
    No<font color="#990000">,</font>
    Maybe<font color="#990000">,</font>
    DontKnow<font color="#990000">,</font>
    DontCare
<font color="#FF0000">}</font><font color="#990000">;</font>

<i><font color="#9A1900">// Declare value traits for the Answer enumeration</font></i>
<b><font color="#000000">CXXTEST_ENUM_TRAITS</font></b><font color="#990000">(</font>Answer<font color="#990000">,</font>
                    <b><font color="#000000">CXXTEST_ENUM_MEMBER</font></b><font color="#990000">(</font>Yes<font color="#990000">)</font>
                    <b><font color="#000000">CXXTEST_ENUM_MEMBER</font></b><font color="#990000">(</font>No<font color="#990000">)</font>
                    <b><font color="#000000">CXXTEST_ENUM_MEMBER</font></b><font color="#990000">(</font>Maybe<font color="#990000">)</font>
                    <b><font color="#000000">CXXTEST_ENUM_MEMBER</font></b><font color="#990000">(</font>DontKnow<font color="#990000">)</font>
                    <b><font color="#000000">CXXTEST_ENUM_MEMBER</font></b><font color="#990000">(</font>DontCare<font color="#990000">));</font>

<i><font color="#9A1900">// Test the trait values</font></i>
<b><font color="#0000FF">class</font></b> <font color="#008080">EnumTraits</font> <font color="#990000">:</font> <b><font color="#0000FF">public</font></b> CxxTest<font color="#990000">::</font>TestSuite
<font color="#FF0000">{</font>
<b><font color="#0000FF">public</font></b><font color="#990000">:</font>
    <font color="#009900">void</font> <b><font color="#000000">test_Enum_traits</font></b><font color="#990000">()</font>
    <font color="#FF0000">{</font>
        <b><font color="#000000">TS_FAIL</font></b><font color="#990000">(</font>Yes<font color="#990000">);</font>
        <b><font color="#000000">TS_FAIL</font></b><font color="#990000">(</font>No<font color="#990000">);</font>
        <b><font color="#000000">TS_FAIL</font></b><font color="#990000">(</font>Maybe<font color="#990000">);</font>
        <b><font color="#000000">TS_FAIL</font></b><font color="#990000">(</font>DontKnow<font color="#990000">);</font>
        <b><font color="#000000">TS_FAIL</font></b><font color="#990000">(</font>DontCare<font color="#990000">);</font>
        <b><font color="#000000">TS_FAIL</font></b><font color="#990000">((</font>Answer<font color="#990000">)</font><font color="#993399">1000</font><font color="#990000">);</font>
    <font color="#FF0000">}</font>
<font color="#FF0000">}</font><font color="#990000">;</font></tt></pre></td></tr></table>
<p>defines a test runner that generates the following output</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="4"><tr><td>
<pre><code>Running cxxtest tests (1 test)
In EnumTraits::test_Enum_traits:
MyTestSuite9.h:27: Error: Test failed: Yes
MyTestSuite9.h:28: Error: Test failed: No
MyTestSuite9.h:29: Error: Test failed: Maybe
MyTestSuite9.h:30: Error: Test failed: DontKnow
MyTestSuite9.h:31: Error: Test failed: DontCare
MyTestSuite9.h:32: Error: Test failed: (Answer)1000
Failed 1 and Skipped 0 of 1 test
Success rate: 0%</code></pre>
</td></tr></table>
<p>The enumeration value traits print strings that represent the elements of the enumeration, except where a numeric value is provided.</p>
<p>Note that the <code>CXXTEST_ENUM_TRAITS</code> macros has two arguments;  the list of <code>CXXTEST_ENUM_MEMBER</code> macros is not separated by commas!</p>
<h3><a name="_defining_new_value_traits"></a>7.2. Defining New Value Traits</h3>
<p>Defining value traits for a new class is done by providing a class
specialization of <code>ValueTraits</code> that converts an object of the new
class to a string.  For example, consider the definition of the
<code>MyClass</code> class:</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><i><font color="#9A1900">// MyClass.h</font></i>

<b><font color="#0000FF">class</font></b> <font color="#008080">MyClass</font>
<font color="#FF0000">{</font>
<b><font color="#0000FF">public</font></b><font color="#990000">:</font>

    <font color="#009900">int</font> value<font color="#990000">;</font>

    <b><font color="#000000">MyClass</font></b><font color="#990000">(</font><font color="#009900">int</font> value_<font color="#990000">)</font> <font color="#990000">:</font> <b><font color="#000000">value</font></b><font color="#990000">(</font>value_<font color="#990000">)</font> <font color="#FF0000">{}</font>

    <i><font color="#9A1900">// CxxTest requires a copy constructor</font></i>
    <b><font color="#000000">MyClass</font></b><font color="#990000">(</font><b><font color="#0000FF">const</font></b> MyClass<font color="#990000">&amp;</font> other<font color="#990000">)</font> <font color="#990000">:</font> <b><font color="#000000">value</font></b><font color="#990000">(</font>other<font color="#990000">.</font>value<font color="#990000">)</font> <font color="#FF0000">{}</font>

    <i><font color="#9A1900">// This is required if you want to use TS_ASSERT_EQUALS</font></i>
    <font color="#009900">bool</font> <b><font color="#0000FF">operator</font></b><font color="#990000">==(</font><b><font color="#0000FF">const</font></b> MyClass<font color="#990000">&amp;</font> other<font color="#990000">)</font> <b><font color="#0000FF">const</font></b> <font color="#FF0000">{</font> <b><font color="#0000FF">return</font></b> value <font color="#990000">==</font> other<font color="#990000">.</font>value<font color="#990000">;</font> <font color="#FF0000">}</font>

    <i><font color="#9A1900">// If you want to use TS_ASSERT_LESS_THAN</font></i>
    <font color="#009900">bool</font> <b><font color="#0000FF">operator</font></b><font color="#990000">&lt;(</font><b><font color="#0000FF">const</font></b> MyClass<font color="#990000">&amp;</font> other<font color="#990000">)</font> <b><font color="#0000FF">const</font></b> <font color="#FF0000">{</font> <b><font color="#0000FF">return</font></b> value <font color="#990000">&lt;</font> other<font color="#990000">.</font>value<font color="#990000">;</font> <font color="#FF0000">}</font>
<font color="#FF0000">}</font><font color="#990000">;</font>

<b><font color="#000080">#ifdef</font></b> CXXTEST_RUNNING
<i><font color="#9A1900">// This declaration is only activated when building a CxxTest test suite</font></i>
<b><font color="#000080">#include</font></b> <font color="#FF0000">&lt;cxxtest/ValueTraits.h&gt;</font>
<b><font color="#000080">#include</font></b> <font color="#FF0000">&lt;stdio.h&gt;</font>

<b><font color="#0000FF">namespace</font></b> CxxTest
<font color="#FF0000">{</font>
CXXTEST_TEMPLATE_INSTANTIATION
<b><font color="#0000FF">class</font></b> <font color="#008080">ValueTraits</font><font color="#990000">&lt;</font>MyClass<font color="#990000">&gt;</font>
<font color="#FF0000">{</font>
    <font color="#009900">char</font> _s<font color="#990000">[</font><font color="#993399">256</font><font color="#990000">];</font>

<b><font color="#0000FF">public</font></b><font color="#990000">:</font>
    <b><font color="#000000">ValueTraits</font></b><font color="#990000">(</font><b><font color="#0000FF">const</font></b> MyClass<font color="#990000">&amp;</font> m<font color="#990000">)</font> <font color="#FF0000">{</font> <b><font color="#000000">sprintf</font></b><font color="#990000">(</font>_s<font color="#990000">,</font> <font color="#FF0000">"MyClass( %i )"</font><font color="#990000">,</font> m<font color="#990000">.</font>value<font color="#990000">);</font> <font color="#FF0000">}</font>
    <b><font color="#0000FF">const</font></b> <font color="#009900">char</font> <font color="#990000">*</font><b><font color="#000000">asString</font></b><font color="#990000">()</font> <b><font color="#0000FF">const</font></b> <font color="#FF0000">{</font> <b><font color="#0000FF">return</font></b> _s<font color="#990000">;</font> <font color="#FF0000">}</font>
<font color="#FF0000">}</font><font color="#990000">;</font>
<font color="#FF0000">}</font><font color="#990000">;</font>
<b><font color="#000080">#endif</font></b> <i><font color="#9A1900">// CXXTEST_RUNNING</font></i></tt></pre></td></tr></table>
<p>This class includes definitions of <code>operator==</code> and <code>operator&lt;</code>
that support comparisons with <a href="#ts_assert_equals">TS_ASSERT_EQUALS</a>
and <a href="#ts_assert_less_than">TS_ASSERT_LESS_THAN</a>.  Additionally,
this header contains a specialization of <code>ValueTraits</code> (in the
<code>CxxTest</code> namespace) that generates a string description of a <code>MyClass</code>
instance.</p>
<p>The following test suite illustrates how these definitions can be
used to define a test runner:</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><i><font color="#9A1900">// MyTestSuite10.h</font></i>
<b><font color="#000080">#include</font></b> <font color="#FF0000">&lt;cxxtest/TestSuite.h&gt;</font>
<b><font color="#000080">#include</font></b> <font color="#FF0000">&lt;MyClass.h&gt;</font>

<b><font color="#0000FF">class</font></b> <font color="#008080">MyTestSuite10</font> <font color="#990000">:</font> <b><font color="#0000FF">public</font></b> CxxTest<font color="#990000">::</font>TestSuite
<font color="#FF0000">{</font>
<b><font color="#0000FF">public</font></b><font color="#990000">:</font>
    <font color="#009900">void</font> <b><font color="#000000">test_le</font></b><font color="#990000">()</font>
    <font color="#FF0000">{</font>
        <font color="#008080">MyClass</font> <b><font color="#000000">x</font></b><font color="#990000">(</font><font color="#993399">1</font><font color="#990000">),</font> <b><font color="#000000">y</font></b><font color="#990000">(</font><font color="#993399">2</font><font color="#990000">);</font>
        <b><font color="#000000">TS_ASSERT_LESS_THAN</font></b><font color="#990000">(</font>x<font color="#990000">,</font> y<font color="#990000">);</font>
    <font color="#FF0000">}</font>

    <font color="#009900">void</font> <b><font color="#000000">test_eq</font></b><font color="#990000">()</font>
    <font color="#FF0000">{</font>
        <font color="#008080">MyClass</font> <b><font color="#000000">x</font></b><font color="#990000">(</font><font color="#993399">1</font><font color="#990000">),</font> <b><font color="#000000">y</font></b><font color="#990000">(</font><font color="#993399">2</font><font color="#990000">);</font>
        <b><font color="#000000">TS_ASSERT_EQUALS</font></b><font color="#990000">(</font>x<font color="#990000">,</font> y<font color="#990000">);</font>
    <font color="#FF0000">}</font>
<font color="#FF0000">}</font><font color="#990000">;</font>
</tt></pre></td></tr></table>
<p>This runner for this test suite generates the following output:</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="4"><tr><td>
<pre><code>Running cxxtest tests (2 tests).
In MyTestSuite10::test_eq:
MyTestSuite10.h:17: Error: Expected (x == y), found (MyClass( 1 ) != MyClass( 2 ))
Failed 1 and Skipped 0 of 2 tests
Success rate: 50%</code></pre>
</td></tr></table>
<p>The test failure print logic uses the specialization of <code>ValueTraits</code> to create
the string description of <code>MyClass</code> that appears in the output.</p>
<h3><a name="_defining_value_traits_for_template_classes"></a>7.3. Defining Value Traits for Template Classes</h3>
<p>A simple modification to the above example illustrates how a trait can be defined for a
template class:</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><i><font color="#9A1900">// MyTestSuite11.h</font></i>
<b><font color="#000080">#include</font></b> <font color="#FF0000">&lt;cxxtest/TestSuite.h&gt;</font>
<b><font color="#000080">#include</font></b> <font color="#FF0000">&lt;TMyClass.h&gt;</font>

<b><font color="#0000FF">class</font></b> <font color="#008080">MyTestSuite11</font> <font color="#990000">:</font> <b><font color="#0000FF">public</font></b> CxxTest<font color="#990000">::</font>TestSuite
<font color="#FF0000">{</font>
<b><font color="#0000FF">public</font></b><font color="#990000">:</font>
    <font color="#009900">void</font> <b><font color="#000000">test_le</font></b><font color="#990000">()</font>
    <font color="#FF0000">{</font>
        <font color="#008080">TMyClass&lt;int&gt;</font> <b><font color="#000000">x</font></b><font color="#990000">(</font><font color="#993399">1</font><font color="#990000">),</font> <b><font color="#000000">y</font></b><font color="#990000">(</font><font color="#993399">2</font><font color="#990000">);</font>
        <b><font color="#000000">TS_ASSERT_LESS_THAN</font></b><font color="#990000">(</font>x<font color="#990000">,</font> y<font color="#990000">);</font>
    <font color="#FF0000">}</font>

    <font color="#009900">void</font> <b><font color="#000000">test_eq</font></b><font color="#990000">()</font>
    <font color="#FF0000">{</font>
        <font color="#008080">TMyClass&lt;int&gt;</font> <b><font color="#000000">x</font></b><font color="#990000">(</font><font color="#993399">1</font><font color="#990000">),</font> <b><font color="#000000">y</font></b><font color="#990000">(</font><font color="#993399">2</font><font color="#990000">);</font>
        <b><font color="#000000">TS_ASSERT_EQUALS</font></b><font color="#990000">(</font>x<font color="#990000">,</font> y<font color="#990000">);</font>
    <font color="#FF0000">}</font>
<font color="#FF0000">}</font><font color="#990000">;</font>
</tt></pre></td></tr></table>
<p>Unfortunately, this example employs partial template specialization, which  is not supported by all C++ compilers.</p>
<hr>
<h2><a name="mock"></a>8. Testing with Mock Objects</h2>
<p>Mock Objects are a very useful concept for testing complex software.
The key idea is to pass special objects to tested code that facilitates
the testing process.  For instance, a class that implements a
protocol over TCP might rely on an abstract <code>ISocket</code> interface.
Then a mock testing strategy could pass a <code>MockSocket</code> object that
does anything that is useful for testing (e.g., keep a log of all
data &#8220;sent&#8221; to verify later).</p>
<p>However, when a challenge for C/C++ developers is that you may need
to call <em>global</em> functions which you cannot override.  Consider any
code that uses <code>fopen()</code>, <code>fwrite()</code> and <code>fclose()</code>.  It is not
very elegant to have this code actually create files while being
tested.  Even more importantly, you need to test how the code behaves
when &#8220;bad&#8221; things happen (e.g., when <code>fopen()</code> fails).  Handling
these types of exceptional conditions is often a very challenging
issue for software testing.</p>
<p>CxxTest addresses this challenge by providing a generic mechanism for
defining mock global functions.  The next section illustrates this mechanism for a single
global function.  The following section provides more detail about specific features of CxxTest&#8217;s
support for mock testing.</p>
<h3><a name="_example_a_mock_code_time_code_function"></a>8.1. Example: A Mock <code>time()</code> Function</h3>
<p>Suppose that we want to perform mock testing using the well known
standard library function <code>time()</code>.  Setting up a test suite with
a mock global function for <code>time()</code> can be broken down into the
following steps.</p>
<h4><a name="_declare_mock_functions"></a>8.1.1. Declare Mock Functions</h4>
<p>The <code>CXXTEST_MOCK_GLOBAL</code> macro is used to declare mock global functions.  It is often convenient to include
these declarations in a header file, which is used in both the test suite as well as the code that is being tested:</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><i><font color="#9A1900">// time_mock.h</font></i>
<b><font color="#000080">#include</font></b> <font color="#FF0000">&lt;time.h&gt;</font>
<b><font color="#000080">#include</font></b> <font color="#FF0000">&lt;cxxtest/Mock.h&gt;</font>

<b><font color="#000000">CXXTEST_MOCK_GLOBAL</font></b><font color="#990000">(</font>time_t<font color="#990000">,</font>         <i><font color="#9A1900">/* Return type          */</font></i>
                    time<font color="#990000">,</font>          <i><font color="#9A1900">/* Name of the function */</font></i>
                    <font color="#990000">(</font><font color="#008080">time_t</font> <font color="#990000">*</font>t<font color="#990000">),</font>   <i><font color="#9A1900">/* Prototype            */</font></i>
                    <font color="#990000">(</font>t<font color="#990000">)</font>          <i><font color="#9A1900">/* Argument list        */</font></i><font color="#990000">);</font></tt></pre></td></tr></table>
<h4><a name="_mock_functions_in_tested_code"></a>8.1.2. Mock Functions in Tested Code</h4>
<p>The tested code uses mock global functions, rather than using the global functions directly.
You access mock functions in the <code>T</code> (for <em>Test</em>) namespace, so the tested code calls <code>T::time()</code> instead of
<code>time()</code>. This is the equivalent of using abstract interfaces
instead of concrete classes.</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><i><font color="#9A1900">// rand_example.cpp</font></i>
<b><font color="#000080">#include</font></b> <font color="#FF0000">&lt;time_mock.h&gt;</font>

<font color="#009900">int</font> <b><font color="#000000">generateRandomNumber</font></b><font color="#990000">()</font>
<font color="#FF0000">{</font>
    <b><font color="#0000FF">return</font></b> T<font color="#990000">::</font><b><font color="#000000">time</font></b><font color="#990000">(</font>NULL<font color="#990000">)</font> <font color="#990000">*</font> <font color="#993399">3</font><font color="#990000">;</font>
<font color="#FF0000">}</font></tt></pre></td></tr></table>
<h4><a name="_mock_source_files"></a>8.1.3. Mock Source Files</h4>
<p>A source file needs to be defined that implements <code>T::time()</code> by
calling the real global function.  This definition is performed automatically by
defining <code>CXXTEST_MOCK_REAL_SOURCE_FILE</code> before the header file is defined:</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><i><font color="#9A1900">// time_real.cpp</font></i>
<b><font color="#000080">#define</font></b> CXXTEST_MOCK_REAL_SOURCE_FILE
<b><font color="#000080">#include</font></b> <font color="#FF0000">&lt;time_mock.h&gt;</font></tt></pre></td></tr></table>
<p>This source file is not used for testing, but instead it supports normal use of the tested code.</p>
<p>Similarly, a source file needs to be defined that implements <code>T::time()</code> by calling the mock
global function.  This definition is performed automatically by defining <code>CXXTEST_MOCK_TEST_SOURCE_FILE</code> before the header file is defined:</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><i><font color="#9A1900">// time_mock.cpp</font></i>
<b><font color="#000080">#define</font></b> CXXTEST_MOCK_TEST_SOURCE_FILE
<b><font color="#000080">#include</font></b> <font color="#FF0000">&lt;time_mock.h&gt;</font></tt></pre></td></tr></table>
<h4><a name="_test_suites_using_mock_functions"></a>8.1.4. Test Suites using Mock Functions</h4>
<p>A mock object for the <code>time()</code> function is created using the <code>T::Base_time</code> class,
which is automatically created by CxxTest.  This class includes a <code>time()</code> method whose
API is the same as the global <code>time()</code> function.  Thus, this method can be defined to have
whatever behavior is desired during testing.  For example, the following example defines a
mock object that increments a counter to define an incremental value for <code>time()</code>.</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><i><font color="#9A1900">// MockTestSuite.h</font></i>
<b><font color="#000080">#include</font></b> <font color="#FF0000">&lt;cxxtest/TestSuite.h&gt;</font>
<b><font color="#000080">#include</font></b> <font color="#FF0000">&lt;time_mock.h&gt;</font>

<font color="#009900">int</font> <b><font color="#000000">generateRandomNumber</font></b><font color="#990000">();</font>


<b><font color="#0000FF">class</font></b> <font color="#008080">MockObject</font> <font color="#990000">:</font> <b><font color="#0000FF">public</font></b> T<font color="#990000">::</font>Base_time
<font color="#FF0000">{</font>
<b><font color="#0000FF">public</font></b><font color="#990000">:</font>
    <b><font color="#000000">MockObject</font></b><font color="#990000">(</font><font color="#009900">int</font> initial<font color="#990000">)</font> <font color="#990000">:</font> <b><font color="#000000">counter</font></b><font color="#990000">(</font>initial<font color="#990000">)</font> <font color="#FF0000">{}</font>
    <font color="#009900">int</font> counter<font color="#990000">;</font>
    <font color="#008080">time_t</font> <b><font color="#000000">time</font></b><font color="#990000">(</font>time_t <font color="#990000">*)</font> <font color="#FF0000">{</font> <b><font color="#0000FF">return</font></b> counter<font color="#990000">++;</font> <font color="#FF0000">}</font>
<font color="#FF0000">}</font><font color="#990000">;</font>

<b><font color="#0000FF">class</font></b> <font color="#008080">TestRandom</font> <font color="#990000">:</font> <b><font color="#0000FF">public</font></b> CxxTest<font color="#990000">::</font>TestSuite
<font color="#FF0000">{</font>
<b><font color="#0000FF">public</font></b><font color="#990000">:</font>
    <font color="#009900">void</font> <b><font color="#000000">test_generateRandomNumber</font></b><font color="#990000">()</font>
    <font color="#FF0000">{</font>
        <font color="#008080">MockObject</font> <b><font color="#000000">t</font></b><font color="#990000">(</font><font color="#993399">1</font><font color="#990000">);</font>
        <b><font color="#000000">TS_ASSERT_EQUALS</font></b><font color="#990000">(</font><b><font color="#000000">generateRandomNumber</font></b><font color="#990000">(),</font> <font color="#993399">3</font><font color="#990000">);</font>
        <b><font color="#000000">TS_ASSERT_EQUALS</font></b><font color="#990000">(</font><b><font color="#000000">generateRandomNumber</font></b><font color="#990000">(),</font> <font color="#993399">6</font><font color="#990000">);</font>
        <b><font color="#000000">TS_ASSERT_EQUALS</font></b><font color="#990000">(</font><b><font color="#000000">generateRandomNumber</font></b><font color="#990000">(),</font> <font color="#993399">9</font><font color="#990000">);</font>
    <font color="#FF0000">}</font>
<font color="#FF0000">}</font><font color="#990000">;</font></tt></pre></td></tr></table>
<p>Note that CxxTest uses global data to associate calls made with <code>T::time()</code>
to calls to <code>MockObject::time()</code>.  The <code>MockObject</code> class simply
needs to be instantiated prior to the call to <code>T::time()</code>.</p>
<h4><a name="_building_the_test_runner"></a>8.1.5. Building the Test Runner</h4>
<p>The <code>cxxtestgen</code> command is used to create a test runner with mock functions in a normal manner:</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>cxxtestgen --error-printer -o runner<font color="#990000">.</font>cpp MockTestSuite<font color="#990000">.</font>h</tt></pre></td></tr></table>
<p>The test runner source file, <code>runner.cpp</code>, needs to be compiled an linked to the mock function definition, <code>time_mock.cpp</code>, as well as the code being tested, <code>rand_example.cpp</code>:</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>g<font color="#990000">++</font> -o runner -I<font color="#990000">.</font> -I<font color="#009900">$CXXTEST</font> runner<font color="#990000">.</font>cpp time_mock<font color="#990000">.</font>cpp rand_example<font color="#990000">.</font>cpp</tt></pre></td></tr></table>
<p>This generates a test runner that generates the following output:</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="4"><tr><td>
<pre><code>Running cxxtest tests (1 test).OK!</code></pre>
</td></tr></table>
<h3><a name="_advanced_topics"></a>8.2. Advanced Topics</h3>
<h4><a name="_void_functions"></a>8.2.1. Void Functions</h4>
<p>The <code>CXXTEST_MOCK_VOID_GLOBAL</code> is used to define mock global functions that return <code>void</code>.
This is identical to
<code>CXXTEST_MOCK_GLOBAL</code> except that it does not specify the return
type.  Take a look in <code>sample/mock/T/stdlib.h</code> for a demonstation.</p>
<h4><a name="_calling_the_real_functions_while_testing"></a>8.2.2. Calling the Real Functions While Testing</h4>
<p>During testing it is sometimes necessary to call the real global
function instead of the mock global function.  CxxTest allows a
user to do this by creating a special mock object.  For a global
mock function of <code>time()</code>, the object <code>T::Real_time</code> represents the
real function.  If this class is created, then <code>T::time()</code> will be
redirected to the real function.</p>
<h4><a name="_mocking_nonexistent_functions"></a>8.2.3. Mocking Nonexistent Functions</h4>
<p>Sometimes the tested code calls functions that are not available
when testing.  For example, this can happen when testing driver
code that calls kernel functions that are not available to a user-mode
test runner.  CxxTest can provide mock global function definitions
for the test code while using the original functions in the tested code.</p>
<p>The <code>CXXTEST_SUPPLY_GLOBAL</code> and <code>CXXTEST_SUPPLY_VOID_GLOBAL</code> macros are used to provide mock global function definitions.  For example, the following declaration creates a mock global function for the Win32 kernel function <code>IoCallDriver</code>:</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><b><font color="#000000">CXXTEST_SUPPLY_GLOBAL</font></b><font color="#990000">(</font> NTSTATUS<font color="#990000">,</font>                <i><font color="#9A1900">/* Return type */</font></i>
                       IoCallDriver<font color="#990000">,</font>            <i><font color="#9A1900">/* Name        */</font></i>
                       <font color="#990000">(</font> <font color="#008080">PDEVICE_OBJECT</font> Device<font color="#990000">,</font> <i><font color="#9A1900">/* Prototype   */</font></i>
                         <font color="#008080">PIRP</font> Irp <font color="#990000">),</font>
                       <font color="#990000">(</font> Device<font color="#990000">,</font> Irp <font color="#990000">)</font>          <i><font color="#9A1900">/* How to call */</font></i> <font color="#990000">);</font></tt></pre></td></tr></table>
<p>The tested driver code calls <code>IoCallDriver()</code> normally;  there is no need for the <code>T::</code> syntax.
The test suite is defined using the <code>T::Base_IoCallDriver</code> as with normal mock objects.</p>
<p>CxxTest also provides the macros <code>CXXTEST_SUPPLY_GLOBAL_C</code> and
<code>CXXTEST_SUPPLY_GLOBAL_VOID_C</code> that declare the functions with <code>C</code>
linkage (i.e., using <code>extern "C"</code>).  These macros are used to declare
function prototypes, since you may not be able to include the header
files in the test suite that are associated with the mock global function.</p>
<h4><a name="_functions_in_namespaces"></a>8.2.4. Functions in Namespaces</h4>
<p>The <code>CXXTEST_MOCK</code> macro is used to declare a mock global function that is associated
with a function in a namespace, including static class member functions.
For example, consider the function <code>bool Files::FileExists( const
String &amp;name )</code>;  the namespace <code>Files</code> contains the function
<code>FileExists</code>.  The mock class will be called <code>T::Base_Files_FileExists</code>
and the function to implemented would be <code>fileExists</code>.  The <code>CXXTEST_MOCK</code> macro declares this mock global function as follows:</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><b><font color="#000000">CXXTEST_MOCK</font></b><font color="#990000">(</font> Files_FileExists<font color="#990000">,</font>       <i><font color="#9A1900">/* Suffix of mock class  */</font></i>
              <font color="#009900">bool</font><font color="#990000">,</font>                   <i><font color="#9A1900">/* Return type           */</font></i>
              fileExists<font color="#990000">,</font>             <i><font color="#9A1900">/* Name of mock member   */</font></i>
              <font color="#990000">(</font> <b><font color="#0000FF">const</font></b> <font color="#008080">String</font> <font color="#990000">&amp;</font>name <font color="#990000">),</font> <i><font color="#9A1900">/* Prototype             */</font></i>
              Files<font color="#990000">::</font>FileExists<font color="#990000">,</font>      <i><font color="#9A1900">/* Name of real function */</font></i>
              <font color="#990000">(</font> name <font color="#990000">)</font>                <i><font color="#9A1900">/* Parameter list        */</font></i> <font color="#990000">);</font></tt></pre></td></tr></table>
<p>Similarly, the <code>CXXTEST_MOCK_VOID</code> macro is used to declare a mock global function that returns <code>void</code>.</p>
<p>The <code>CXXTEST_SUPPLY</code> and <code>CXXTEST_SUPPLY_VOID</code> macros are used to provide mock global function definitions for nonexistent functions.  For example:</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><b><font color="#000000">CXXTEST_SUPPLY</font></b><font color="#990000">(</font> AllocateIrp<font color="#990000">,</font>         <i><font color="#9A1900">/* =&gt; T::Base_AllocateIrp */</font></i>
                PIRP<font color="#990000">,</font>                <i><font color="#9A1900">/* Return type            */</font></i>
                allocateIrp<font color="#990000">,</font>         <i><font color="#9A1900">/* Name of mock member    */</font></i>
                <font color="#990000">(</font> <font color="#008080">CCHAR</font> StackSize <font color="#990000">),</font> <i><font color="#9A1900">/* Prototype              */</font></i>
                IoAllocateIrp<font color="#990000">,</font>       <i><font color="#9A1900">/* Name of real function  */</font></i>
                <font color="#990000">(</font> StackSize <font color="#990000">)</font>        <i><font color="#9A1900">/* Parameter list         */</font></i> <font color="#990000">);</font></tt></pre></td></tr></table>
<p>Similarly, the <code>CXXTEST_SUPPLY_C</code> and <code>CXXTEST_SUPPLY_VOID_C</code> macros declare the functions with <code>C</code> linkage.</p>
<h4><a name="_overloaded_functions"></a>8.2.5. Overloaded Functions</h4>
<p>The <code>CXXTEST_MOCK</code> and <code>CXXTEST_MOCK_VOID</code> macros have a flexible
interface that can provide mock global function definitions for
overloaded functions.  The arguments simply need to specify different
mock class names, mock member names and different prototype definitions.
These different mock declarations will generate different mock objects that can be explicitly
referenced in a test suite.</p>
<h4><a name="_the_mock_namespace"></a>8.2.6. The Mock Namespace</h4>
<p>The default namespace for mock functions is <code>T::</code>.  This namespace can be changed by defining the
<code>CXXTEST_MOCK_NAMESPACE</code> macro.</p>
<hr>
<h2><a name="installation"></a>9. Installation</h2>
<p>A key feature of CxxTest is that it does has virtually no installation
process.  The <code>cxxtestgen</code> script can be directly executed from the
<code>cxxtest/bin</code> directory.  Simply adding this directory to the PATH
environment of a command shell is sufficient for many applications.
Beyond that, the build process for test runners simply needs to
reference the <code>cxxtest</code> root directory to enable proper includes
during compilation.</p>
<p>The FOG parser requires two Python packages:</p>
<ul>
<li>
<p>
<code>ply</code>
</p>
</li>
<li>
<p>
<code>ordereddict</code> (This is needed when running Python 2.4, 2.5 or 2.6)
</p>
</li>
</ul>
<p>If these packages are not available, then <code>cxxtestgen</code> will generate an error when the
FOG parser option is selected.
If you have
<a href="http://pypi.python.org/pypi/setuptools">setuptools</a> or
<a href="http://pypi.python.org/pypi/distribute">distribute</a>
installed, then
you can install these packages from PyPI by executing</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>easy_install ply
easy_install ordereddict</tt></pre></td></tr></table>
<p>The <code>cxxtestgen</code> script has been tested with many different versions
of Python:  2.4 - 3.3, though future releases will not support
Python 2.4.  Note that this script has only been tested with the
CPython implementation.  CxxTest has been tested on Linux and
Mac platforms using the <code>g++</code> and <code>clang++</code> compilers.</p>
<hr>
<h2><a name="discussion"></a>10. Status and Future Plans</h2>
<p>The CxxTest 4.3 release is an incremental release that was driven
by a variety of bug fixes and minor enhancements.  The CxxTest 4.0
release reflected major changes in the management and focus of
CxxTest:</p>
<ul>
<li>
<p>
Perl is no longer used to support CxxTest scripts.  Python is now the only scripting language used by CxxTest.
</p>
</li>
<li>
<p>
The testing scripts have been rewritten using the PyUnit framework.
</p>
</li>
<li>
<p>
The installation process for CxxTest now leverages and integrates with the system Python installation.
</p>
</li>
<li>
<p>
A more comprehensive C++ parser is now available, which supports testing of templates.
</p>
</li>
<li>
<p>
The CxxTest GUI is no longer supported, and the <a href="#ts_warn">TS_WARN</a> is deprecated.
</p>
</li>
<li>
<p>
CxxTest runners now have a command-line interface that facilitates interative use of the test runner.
</p>
</li>
<li>
<p>
A new user guide is now available in PDF, HTML and Ebook formats.
</p>
</li>
<li>
<p>
Updated the <code>cxxtestgen</code> script to work with Python 2.6 through 3.2
</p>
</li>
</ul>
<p>Additionally, CxxTest is now validated with continuous integration
tests.  Yes, the CxxTest developers eat their own dog food!</p>
<p>Although the GUI option for <code>cxxtestgen</code> appears to work fine, this
GUI is rather primitive.  It simply provides a visual summary of
the test results, and not the interactive test execution that a
user would expect.  This capability is deprecated since none of the
current developers use this feature.  CxxTest users should consider
using CxxTest with <a href="http://jenkins-ci.org/">Jenkins</a>.  The <code>XUnitPrinter</code>
test listener generates XML files that can be easily integrated by
<a href="http://jenkins-ci.org/">Jenkins</a>, which creates a visual summary of
test results with links to drill-down into test outputs.</p>
<p>This documentation has highlighted the commonly used test listeners.
There are a variety of other test listeners provided by CxxTest
that support advanced Cxxtest applications.  For example, the
<code>YesNoRunner</code> is perhaps the simplest test listener;  it simply
returns the number of test failures.  The <code>StdioFilePrinter</code> is
used by <code>StdioPrinter</code>, but it does not assume that <code>stdio</code> is the
default output stream.  This test listener can be used in contexts
where a custom output stream must be specified.</p>
<hr>
<h2><a name="acknowledgements"></a>Acknowledgements</h2>
<p>CxxTest was originally developed by Erez Volk.  The following
developers contributed to the CxxTest 4.x releases:</p>
<ul>
<li>
<p>
Gašper Ažman
</p>
</li>
<li>
<p>
Andrey Batyiev
</p>
</li>
<li>
<p>
Olivier Charloton
</p>
</li>
<li>
<p>
Dave Elcock
</p>
</li>
<li>
<p>
Kevin Fitch
</p>
</li>
<li>
<p>
William Hart
</p>
</li>
<li>
<p>
Allan Odgaard
</p>
</li>
<li>
<p>
Lionel Orry
</p>
</li>
<li>
<p>
John Siirola
</p>
</li>
<li>
<p>
Jon Schlueter
</p>
</li>
</ul>
<p>The CxxTest documentation is generated using
<a href="http://www.methods.co.nz/asciidoc/">AsciiDoc</a>.</p>
<p>A major advancement in CxxTest&#8217;s capability is the new test discovery
mechanism that is based on a parser of the Flexible Object Language
(FOG).  FOG generalizes the C++ syntax, which enables CxxTest to
extract high-level class structure for test discovery.  FOG was
developed by Edward Willink:</p>
<ul>
<li>
<p>
Edward D. Willink.  <em>Meta-Compilation for C++</em>, PhD Thesis, Computer Science Research Group, University of Surrey, January 2000.
</p>
</li>
</ul>
<p>The FOG parser in CxxTest critically relies on the excellent LALR
parser provided by Dave Beazley&#8217;s <code>ply</code> Python package.  The scalable
performance of <code>ply</code> is critical for CxxTest.</p>
<p>CxxTest has greatly benefited from the support of the open source
community.  We would like to thank the following organizations for
providing web hosting and computing resources: GitHub, SourceForge,
Tigris.org, Sandia National Laboratories, Google and COIN-OR.  The development
of CxxTest has been partially supported by Sandia National Laboratories.
Sandia National Laboratories is a multi-program laboratory managed
and operated by Sandia Corporation, a wholly owned subsidiary of
Lockheed Martin Corporation, for the U.S.  Department of Energy&#8217;s
National Nuclear Security Administration under contract DE-AC04-94AL85000.</p>
<hr>
<h2><a name="appendix_A"></a>Appendix A: Test Assertion Examples</h2>
<dl>
<dt>
<a name="ts_assert"></a> TS_ASSERT
</dt>
<dd>
<p>
This is the most basic test assertion, which simply verifies that the <code>expr</code> argument is true:
</p>
</dd>
</dl>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>    <font color="#009900">void</font> <b><font color="#000000">test_assert</font></b><font color="#990000">(</font><font color="#009900">void</font><font color="#990000">)</font>
    <font color="#FF0000">{</font>
        <b><font color="#000000">TS_ASSERT</font></b><font color="#990000">(</font><font color="#993399">1</font> <font color="#990000">+</font> <font color="#993399">1</font> <font color="#990000">&gt;</font> <font color="#993399">1</font><font color="#990000">);</font>
    <font color="#FF0000">}</font></tt></pre></td></tr></table>
<dl>
<dt>
<a name="ts_assert_delta"></a> TS_ASSERT_DELTA
</dt>
<dd>
<p>
This test assertion verifies two floating point values are within a specified absolute difference:
</p>
</dd>
</dl>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>    <font color="#009900">void</font> <b><font color="#000000">test_assert_delta</font></b><font color="#990000">(</font><font color="#009900">void</font><font color="#990000">)</font>
    <font color="#FF0000">{</font>
        <b><font color="#000000">TS_ASSERT_DELTA</font></b><font color="#990000">(</font><b><font color="#000000">sqrt</font></b><font color="#990000">(</font><font color="#993399">4.0</font><font color="#990000">),</font> <font color="#993399">2.0</font><font color="#990000">,</font> <font color="#993399">1e-7</font><font color="#990000">);</font>
    <font color="#FF0000">}</font></tt></pre></td></tr></table>
<dl>
<dt>
<a name="ts_assert_differs"></a> TS_ASSERT_DIFFERS
</dt>
<dd>
<p>
This test assertion verifies that the two arguments are not equal:
</p>
</dd>
</dl>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>    <font color="#009900">void</font> <b><font color="#000000">test_assert_differs</font></b><font color="#990000">(</font><font color="#009900">void</font><font color="#990000">)</font>
    <font color="#FF0000">{</font>
        <b><font color="#000000">TS_ASSERT_DIFFERS</font></b><font color="#990000">(</font><font color="#993399">1</font><font color="#990000">,</font> <font color="#993399">2</font><font color="#990000">);</font>
    <font color="#FF0000">}</font></tt></pre></td></tr></table>
<dl>
<dt>
<a name="ts_assert_equals"></a> TS_ASSERT_EQUALS
</dt>
<dd>
<p>
  This test assertion verifies that the two arguments are equal:
</p>
</dd>
</dl>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>    <font color="#009900">void</font> <b><font color="#000000">test_assert_equals</font></b><font color="#990000">(</font><font color="#009900">void</font><font color="#990000">)</font>
    <font color="#FF0000">{</font>
        <b><font color="#000000">TS_ASSERT_EQUALS</font></b><font color="#990000">(</font><font color="#993399">21</font> <font color="#990000">%</font> <font color="#993399">5</font><font color="#990000">,</font> <font color="#993399">1</font><font color="#990000">);</font>
    <font color="#FF0000">}</font></tt></pre></td></tr></table>
<p>Note that this test is performed using the C++ <code>==</code> operator, whose behavior may be redefined for the two argument types.</p>
<dl>
<dt>
<a name="ts_assert_is_nan"></a> TS_ASSERT_IS_NAN
</dt>
<dd>
<p>
  This test assertion verifies that the argument is NaN:
</p>
</dd>
</dl>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>    <font color="#009900">void</font> <b><font color="#000000">test_assert_is_nan</font></b><font color="#990000">(</font><font color="#009900">void</font><font color="#990000">)</font>
    <font color="#FF0000">{</font>
        <b><font color="#000000">TS_ASSERT_IS_NAN</font></b><font color="#990000">(</font> <font color="#993399">0.0</font><font color="#990000">/</font><font color="#993399">0.0</font> <font color="#990000">);</font>
    <font color="#FF0000">}</font></tt></pre></td></tr></table>
<dl>
<dt>
<a name="ts_assert_is_infinite"></a> TS_ASSERT_IS_INFINITE
</dt>
<dd>
<p>
  This test assertion verifies that the argument is infinite:
</p>
</dd>
</dl>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>    <font color="#009900">void</font> <b><font color="#000000">test_assert_is_infinite</font></b><font color="#990000">(</font><font color="#009900">void</font><font color="#990000">)</font>
    <font color="#FF0000">{</font>
        <b><font color="#000000">TS_ASSERT_IS_INFINITE</font></b><font color="#990000">(</font> <font color="#993399">1.0</font><font color="#990000">/</font><font color="#993399">0.0</font> <font color="#990000">);</font>
    <font color="#FF0000">}</font></tt></pre></td></tr></table>
<dl>
<dt>
<a name="ts_assert_less_than"></a> TS_ASSERT_LESS_THAN
</dt>
<dd>
<p>
This test assertion verifies that the first argument is strictly less than the second argument:
</p>
</dd>
</dl>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>    <font color="#009900">void</font> <b><font color="#000000">test_assert_less_than</font></b><font color="#990000">(</font><font color="#009900">void</font><font color="#990000">)</font>
    <font color="#FF0000">{</font>
        <b><font color="#000000">TS_ASSERT_LESS_THAN</font></b><font color="#990000">(</font><font color="#993399">0</font><font color="#990000">,</font> <font color="#993399">1</font><font color="#990000">);</font>
    <font color="#FF0000">}</font></tt></pre></td></tr></table>
<dl>
<dt>
<a name="ts_assert_less_than_equals"></a> TS_ASSERT_LESS_THAN_EQUALS
</dt>
<dd>
<p>
This test assertion verifies that the first argument is less than or equal to the second argument:
</p>
</dd>
</dl>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>    <font color="#009900">void</font> <b><font color="#000000">test_assert_less_than_equals</font></b><font color="#990000">(</font><font color="#009900">void</font><font color="#990000">)</font>
    <font color="#FF0000">{</font>
        <b><font color="#000000">TS_ASSERT_LESS_THAN_EQUALS</font></b><font color="#990000">(</font><font color="#993399">0</font><font color="#990000">,</font> <font color="#993399">0</font><font color="#990000">);</font>
    <font color="#FF0000">}</font></tt></pre></td></tr></table>
<dl>
<dt>
<a name="ts_assert_predicate"></a> TS_ASSERT_PREDICATE
</dt>
<dd>
<p>
This test assertion takes as an argument the name of a class, similar to a STL <code>unary_function</code>, and evaluates the <code>operator()</code> method:
</p>
</dd>
</dl>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>    <b><font color="#0000FF">class</font></b> <font color="#008080">IsOdd</font>
    <font color="#FF0000">{</font>
    <b><font color="#0000FF">public</font></b><font color="#990000">:</font>
        <font color="#009900">bool</font> <b><font color="#0000FF">operator</font></b><font color="#990000">()(</font><font color="#009900">int</font> x<font color="#990000">)</font> <b><font color="#0000FF">const</font></b> <font color="#FF0000">{</font> <b><font color="#0000FF">return</font></b> x <font color="#990000">%</font> <font color="#993399">2</font> <font color="#990000">==</font> <font color="#993399">1</font><font color="#990000">;</font> <font color="#FF0000">}</font>
    <font color="#FF0000">}</font><font color="#990000">;</font>

    <font color="#009900">void</font> <b><font color="#000000">test_assert_predicate</font></b><font color="#990000">(</font><font color="#009900">void</font><font color="#990000">)</font>
    <font color="#FF0000">{</font>
        <b><font color="#000000">TS_ASSERT_PREDICATE</font></b><font color="#990000">(</font>IsOdd<font color="#990000">,</font> <font color="#993399">29</font><font color="#990000">);</font>
    <font color="#FF0000">}</font></tt></pre></td></tr></table>
<p>This test assertion can be seen as a generalization of <a href="#ts_assert">TS_ASSERT</a>, but it
allows the tester to see the failed value.</p>
<dl>
<dt>
<a name="ts_assert_relation"></a> TS_ASSERT_RELATION
</dt>
<dd>
<p>
It takes as an argument the name of a class, similar to a STL <code>binary_function</code>, and evaluates the <code>operator()</code> method:
</p>
</dd>
</dl>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>    <font color="#009900">void</font> <b><font color="#000000">test_assert_relation</font></b><font color="#990000">(</font><font color="#009900">void</font><font color="#990000">)</font>
    <font color="#FF0000">{</font>
        <b><font color="#000000">TS_ASSERT_RELATION</font></b><font color="#990000">(</font>std<font color="#990000">::</font>greater<font color="#990000">&lt;</font><font color="#009900">double</font><font color="#990000">&gt;,</font> <font color="#993399">1e6</font><font color="#990000">,</font> <font color="#993399">1000.0</font><font color="#990000">);</font>
    <font color="#FF0000">}</font></tt></pre></td></tr></table>
<p>This test assertion can be seen as a generalization of <a href="#ts_assert_equals">TS_ASSERT_EQUALS</a>, <a href="#ts_assert_differs">TS_ASSERT_DIFFERS</a>, <a href="#ts_assert_less_than">TS_ASSERT_LESS_THAN</a> and <a href="#ts_assert_less_than_equals">TS_ASSERT_LESS_THAN_EQUALS</a>.
This can be used to assert comparisons which are not covered by the builtin test assertions.</p>
<dl>
<dt>
<a name="ts_assert_same_data"></a> TS_ASSERT_SAME_DATA
</dt>
<dd>
<p>
This test assertion is similar to <a href="#ts_assert_equals">TS_ASSERT_EQUALS</a>,
except that it compares the contents of two buffers in memory:
</p>
</dd>
</dl>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>    <font color="#009900">void</font> <b><font color="#000000">test_assert_same_data</font></b><font color="#990000">(</font><font color="#009900">void</font><font color="#990000">)</font>
    <font color="#FF0000">{</font>
        <font color="#009900">char</font> input <font color="#990000">=</font> <font color="#FF0000">"The quick brown fox ran over the lazy dog"</font><font color="#990000">;</font>
        <font color="#009900">char</font> output<font color="#990000">[</font><font color="#993399">26</font><font color="#990000">];</font>
        <b><font color="#000000">memcopy</font></b><font color="#990000">(</font>output<font color="#990000">,</font> input<font color="#990000">,</font> <font color="#993399">26</font><font color="#990000">);</font>
        <b><font color="#000000">TS_ASSERT_SAME_DATA</font></b><font color="#990000">(</font>input<font color="#990000">,</font> output<font color="#990000">,</font> <font color="#993399">26</font><font color="#990000">);</font>
    <font color="#FF0000">}</font></tt></pre></td></tr></table>
<p>The standard runner dumps the contents of both buffers as hex values when this test fails.</p>
<dl>
<dt>
<a name="ts_assert_throws"></a> TS_ASSERT_THROWS
</dt>
<dd>
<p>
This test assertion verifies that the specified exception is thrown when the first argument is executed:
</p>
</dd>
</dl>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>    <font color="#009900">void</font> <b><font color="#000000">throws_runtime_error</font></b><font color="#990000">(</font><font color="#009900">void</font><font color="#990000">)</font>
    <font color="#FF0000">{</font>
        <font color="#008080">raise</font> std<font color="#990000">::</font>runtime_error<font color="#990000">,</font> <font color="#FF0000">"This method simply generates an exception"</font><font color="#990000">;</font>
    <font color="#FF0000">}</font>

    <font color="#009900">void</font> <b><font color="#000000">test_assert_throws</font></b><font color="#990000">(</font><font color="#009900">void</font><font color="#990000">)</font>
    <font color="#FF0000">{</font>
        <b><font color="#000000">TS_ASSERT_THROWS</font></b><font color="#990000">(</font>self<font color="#990000">.</font><b><font color="#000000">throws_runtime_error</font></b><font color="#990000">(),</font> std<font color="#990000">::</font>runtime_error<font color="#990000">);</font>
    <font color="#FF0000">}</font></tt></pre></td></tr></table>
<dl>
<dt>
<a name="ts_assert_throws_anything"></a> TS_ASSERT_THROWS_ANYTHING
</dt>
<dd>
<p>
This test assertion verifies that <em>some</em> exception is thrown when the first argument is executed:
</p>
</dd>
</dl>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>    <font color="#009900">void</font> <b><font color="#000000">test_assert_throws_anything</font></b><font color="#990000">(</font><font color="#009900">void</font><font color="#990000">)</font>
    <font color="#FF0000">{</font>
        <b><font color="#000000">TS_ASSERT_THROWS_ANYTHING</font></b><font color="#990000">(</font>self<font color="#990000">.</font><b><font color="#000000">throws_runtime_error</font></b><font color="#990000">());</font>
    <font color="#FF0000">}</font></tt></pre></td></tr></table>
<dl>
<dt>
<a name="ts_assert_throws_assert"></a> TS_ASSERT_THROWS_ASSERT
</dt>
<dd>
<p>
This test assertion verifies that an exception is thrown when executing the first argument.  The second argument specifies a variable declaration for the exception, and the third argument is executed to test that
exception value:
</p>
</dd>
</dl>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>    <font color="#009900">void</font> <b><font color="#000000">throws_value</font></b><font color="#990000">(</font><font color="#009900">void</font><font color="#990000">)</font>
    <font color="#FF0000">{</font>
        raise <font color="#993399">1</font><font color="#990000">;</font>
    <font color="#FF0000">}</font>

    <font color="#009900">void</font> <b><font color="#000000">test_assert_throws_assert</font></b><font color="#990000">(</font><font color="#009900">void</font><font color="#990000">)</font>
    <font color="#FF0000">{</font>
        <b><font color="#000000">TS_ASSERT_THROWS_ASSERT</font></b><font color="#990000">(</font>self<font color="#990000">.</font><b><font color="#000000">throws_value</font></b><font color="#990000">(),</font> <b><font color="#0000FF">const</font></b> Error <font color="#990000">&amp;</font> e<font color="#990000">,</font> <b><font color="#000000">TS_ASSERT_EQUALS</font></b><font color="#990000">(</font>e<font color="#990000">,</font> <font color="#993399">1</font><font color="#990000">));</font>
    <font color="#FF0000">}</font></tt></pre></td></tr></table>
<p>Note that this can be viewed as a generalization of <a href="#ts_assert_throws_equals">TS_ASSERT_THROWS_EQUALS</a>.</p>
<dl>
<dt>
<a name="ts_assert_throws_equals"></a> TS_ASSERT_THROWS_EQUALS
</dt>
<dd>
<p>
This test assertion verifies that an exception is thrown when executing the first argument.  The second argument specifies a variable declaration for the exception, and the third and fourth arguments are values that are asserted equal after the exception is thrown:
</p>
</dd>
</dl>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>    <font color="#009900">void</font> <b><font color="#000000">test_assert_throws_equals</font></b><font color="#990000">(</font><font color="#009900">void</font><font color="#990000">)</font>
    <font color="#FF0000">{</font>
        <b><font color="#000000">TS_ASSERT_THROWS_EQUALS</font></b><font color="#990000">(</font>self<font color="#990000">.</font><b><font color="#000000">throws_value</font></b><font color="#990000">(),</font> <b><font color="#0000FF">const</font></b> Error <font color="#990000">&amp;</font> e<font color="#990000">,</font> e<font color="#990000">.</font><b><font color="#000000">what</font></b><font color="#990000">(),</font> <font color="#993399">1</font><font color="#990000">);</font>
    <font color="#FF0000">}</font></tt></pre></td></tr></table>
<dl>
<dt>
<a name="ts_assert_throws_is_nan"></a> TS_ASSERT_THROWS_IS_NAN
</dt>
<dd>
<p>
This test assertion verifies that an exception is thrown when executing the first argument.  The second argument specifies a variable declaration for the exception, and the third argument is a value that are asserted to be NaN after the exception is thrown:
</p>
</dd>
</dl>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>    <font color="#009900">void</font> <b><font color="#000000">throws_nan</font></b><font color="#990000">(</font><font color="#009900">void</font><font color="#990000">)</font>
    <font color="#FF0000">{</font>
        raise <font color="#993399">0.0</font><font color="#990000">/</font><font color="#993399">0.0</font><font color="#990000">;</font>
    <font color="#FF0000">}</font>

    <font color="#009900">void</font> <b><font color="#000000">test_assert_throws_is_nan</font></b><font color="#990000">(</font><font color="#009900">void</font><font color="#990000">)</font>
    <font color="#FF0000">{</font>
        <b><font color="#000000">TS_ASSERT_THROWS_IS_NAN</font></b><font color="#990000">(</font>self<font color="#990000">.</font><b><font color="#000000">throws_nan</font></b><font color="#990000">(),</font> <b><font color="#0000FF">const</font></b> Error <font color="#990000">&amp;</font> e<font color="#990000">,</font> e<font color="#990000">.</font><b><font color="#000000">what</font></b><font color="#990000">());</font>
    <font color="#FF0000">}</font></tt></pre></td></tr></table>
<dl>
<dt>
<a name="ts_assert_throws_is_infinite"></a> TS_ASSERT_THROWS_IS_INFINITE
</dt>
<dd>
<p>
This test assertion verifies that an exception is thrown when executing the first argument.  The second argument specifies a variable declaration for the exception, and the third argument is a value that are asserted to be infinite after the exception is thrown:
</p>
</dd>
</dl>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>    <font color="#009900">void</font> <b><font color="#000000">throws_infinite</font></b><font color="#990000">(</font><font color="#009900">void</font><font color="#990000">)</font>
    <font color="#FF0000">{</font>
        raise <font color="#993399">1.0</font><font color="#990000">/</font><font color="#993399">0.0</font><font color="#990000">;</font>
    <font color="#FF0000">}</font>

    <font color="#009900">void</font> <b><font color="#000000">test_assert_throws_is_infinite</font></b><font color="#990000">(</font><font color="#009900">void</font><font color="#990000">)</font>
    <font color="#FF0000">{</font>
        <b><font color="#000000">TS_ASSERT_THROWS_IS_INFINITE</font></b><font color="#990000">(</font>self<font color="#990000">.</font><b><font color="#000000">throws_infinite</font></b><font color="#990000">(),</font> <b><font color="#0000FF">const</font></b> Error <font color="#990000">&amp;</font> e<font color="#990000">,</font> e<font color="#990000">.</font><b><font color="#000000">what</font></b><font color="#990000">());</font>
    <font color="#FF0000">}</font></tt></pre></td></tr></table>
<dl>
<dt>
<a name="ts_assert_throws_nothing"></a> TS_ASSERT_THROWS_NOTHING
</dt>
<dd>
<p>
This test assertion verifies that an exception is <em>not</em> thrown when executing the first argument:
</p>
</dd>
</dl>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>    <font color="#009900">void</font> <b><font color="#000000">throws_nothing</font></b><font color="#990000">(</font><font color="#009900">void</font><font color="#990000">)</font>
    <font color="#FF0000">{</font> <font color="#FF0000">}</font>

    <font color="#009900">void</font> <b><font color="#000000">test_assert_throws_nothing</font></b><font color="#990000">(</font><font color="#009900">void</font><font color="#990000">)</font>
    <font color="#FF0000">{</font>
        <b><font color="#000000">TS_ASSERT_THROWS_ASSERT</font></b><font color="#990000">(</font>self<font color="#990000">.</font><b><font color="#000000">throws_nothing</font></b><font color="#990000">());</font>
    <font color="#FF0000">}</font></tt></pre></td></tr></table>
<dl>
<dt>
<a name="ts_fail"></a> TS_FAIL
</dt>
<dd>
<p>
This function triggers a test failure with an associated message:
</p>
</dd>
</dl>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>    <font color="#009900">void</font> <b><font color="#000000">test_fail</font></b><font color="#990000">(</font><font color="#009900">void</font><font color="#990000">)</font>
    <font color="#FF0000">{</font>
        <b><font color="#000000">TS_FAIL</font></b><font color="#990000">(</font><font color="#FF0000">"This test has failed."</font><font color="#990000">);</font>
    <font color="#FF0000">}</font></tt></pre></td></tr></table>
<dl>
<dt>
<a name="ts_skip"></a> TS_SKIP
</dt>
<dd>
<p>
This function causes the current test to be skipped with an associated warning message:
</p>
</dd>
</dl>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>    <font color="#009900">void</font> <b><font color="#000000">test_skip</font></b><font color="#990000">(</font><font color="#009900">void</font><font color="#990000">)</font>
    <font color="#FF0000">{</font>
        <b><font color="#000000">TS_SKIP</font></b><font color="#990000">(</font><font color="#FF0000">"This test has been skipped."</font><font color="#990000">);</font>
    <font color="#FF0000">}</font></tt></pre></td></tr></table>
<dl>
<dt>
<a name="ts_trace"></a> TS_TRACE
</dt>
<dd>
<p>
This function prints an informational message:
</p>
</dd>
</dl>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>    <font color="#009900">void</font> <b><font color="#000000">test_trace</font></b><font color="#990000">(</font><font color="#009900">void</font><font color="#990000">)</font>
    <font color="#FF0000">{</font>
        <b><font color="#000000">TS_TRACE</font></b><font color="#990000">(</font><font color="#FF0000">"This is a test tracing message."</font><font color="#990000">);</font>
    <font color="#FF0000">}</font></tt></pre></td></tr></table>
<dl>
<dt>
<a name="ts_warn"></a> TS_WARN
</dt>
<dd>
<p>
This function prints a message as a warning:
</p>
</dd>
</dl>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>    <font color="#009900">void</font> <b><font color="#000000">test_warn</font></b><font color="#990000">(</font><font color="#009900">void</font><font color="#990000">)</font>
    <font color="#FF0000">{</font>
        <b><font color="#000000">TS_WARN</font></b><font color="#990000">(</font><font color="#FF0000">"This is a warning message."</font><font color="#990000">);</font>
    <font color="#FF0000">}</font></tt></pre></td></tr></table>
<hr>
<h2><a name="appendix_B"></a>Appendix B: Integrating with Your Build Environment</h2>
<p>CxxTest can be integrated into a variety of build environments to
automate the generation, compilation and execution of test runners.
Here is a rough breakdown of this process:</p>
<ul>
<li>
<p>
Split the application into a library and a main module that just
  calls the library classes.  This way, the test runner will be
  able to access all your classes through the library.
</p>
</li>
<li>
<p>
Create another application (or target, or project, or whatever)
  for the test runner.  Make the build tool generate it automatically.
</p>
</li>
<li>
<p>
Configure the build tool to run the tests automatically.
</p>
</li>
</ul>
<p>Unfortunately, different build tools and IDEs need to setup this
process in different ways.  The following sections provide rough
guidance for doing this for some come use cases.</p>
<table frame="void" cellpadding="4">
<tr valign="top">
<td>
<img alt="Note" src="data:image/png;base64,
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">
</td>
<td style="border-left: 1px solid silver;">These examples (except for the SCons ones) are not actively maintained and
tested. Please send suggestions to the CxxTest developers for updating this
documentation.</td></tr></table>
<h3><a name="scons"></a>SCons</h3>
<p>CxxTest provides built-in support for the SCons build system. This part
documents this feature.</p>
<h4><a name="scons_installation"></a>Installation</h4>
<p>The script is located at <code>build_tools/SCons/cxxtest.py</code>.
You need SCons to be able to find this file, so do one of the following:</p>
<ul>
<li>
<p>
add the file to your project site_tools directory (default: <code>#/site_scons/site_tools/</code>)
</p>
</li>
<li>
<p>
link the file to your project site_tools directory
</p>
</li>
<li>
<p>
add <code>build_tools/SCons/cxxtest.py</code> to your SCons toolpath.
</p>
</li>
</ul>
<table frame="void" cellpadding="4">
<tr valign="top">
<td>
<img alt="Note" src="data:image/png;base64,
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">
</td>
<td style="border-left: 1px solid silver;"><em>#</em> means the project root, using the SCons convention of marking it that way.</td></tr></table>
<h4><a name="_preparing_the_tests_for_use_with_the_builder"></a>Preparing the tests for use with the builder</h4>
<p>This builder assumes that tests have a different suffix than other files in your
project (by default: <code>.t.h</code>, configure via <em>CXXTEST_SUFFIX</em>). This isn&#8217;t a bad
idea to begin with, since test "header files" are not really header files in the
traditional sense. This is how it separates files it should run through
cxxtestgen from the ones it should not.</p>
<table frame="void" cellpadding="4">
<tr valign="top">
<td>
<img alt="Note" src="data:image/png;base64,
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">
</td>
<td style="border-left: 1px solid silver;">Test header files' filenames should end with <code>.t.h</code>.</td></tr></table>
<h4><a name="_compiling_and_running_the_tests"></a>Compiling and Running the Tests</h4>
<p>By default, you build and run the tests by issuing the following command:</p>
<table frame="void" width="100%" cellpadding="4">
<tr><td style="border-left: 2px solid silver;">
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>scons check</tt></pre></td></tr></table>
</td></tr></table>
<p><b>Example 1. </b>Building and running the tests in the shell</p>
<p>Of course, the actual name of the target is configurable (<code>CXXTEST_TARGET</code>).</p>
<h4><a name="_using_the_builder"></a>Using the Builder</h4>
<p>This section describes what you do in your SConstruct file in order to be able
to use the builder.</p>
<p>First, you must tell the environment that you want to use the <em>cxxtest</em> tool and
how it should set itself up.</p>
<p>The easiest way to set the environment up is to pray the defaults are ok.
The builder does some autodetection and tries its best to figure everything out.
In the event this works, setting up the environment is as easy as telling SCons
it should use the <em>cxxtest</em> tool.</p>
<table frame="void" width="100%" cellpadding="4">
<tr><td style="border-left: 2px solid silver;">
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>env <font color="#990000">=</font> <b><font color="#000000">Environment</font></b><font color="#990000">(</font>tools <font color="#990000">=</font> <font color="#990000">[</font><font color="#FF0000">'default'</font><font color="#990000">,</font> <font color="#FF0000">'cxxtest'</font><font color="#990000">])</font></tt></pre></td></tr></table>
</td></tr></table>
<p><b>Example 2. </b>Configuring the environment if defaults are ok</p>
<p>If this doesn&#8217;t work, the builder tries its best to tell you what went wrong. In
most cases, it just wasn&#8217;t able to find where you installed cxxtest. You can fix
this like so (assuming you have CxxTest in <code>#/extern_libs/cxxtest/</code>):</p>
<table frame="void" width="100%" cellpadding="4">
<tr><td style="border-left: 2px solid silver;">
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>env <font color="#990000">=</font> <b><font color="#000000">Environment</font></b><font color="#990000">(</font>tools <font color="#990000">=</font> <font color="#990000">[</font>
        <font color="#FF0000">'default'</font><font color="#990000">,</font>
         <font color="#990000">(</font><font color="#FF0000">'cxxtest'</font><font color="#990000">,</font> <font color="#990000">{</font><font color="#FF0000">'CXXTEST_INSTALL_DIR'</font> <font color="#990000">:</font> <font color="#FF0000">'#/extern_libs/cxxtest/'</font><font color="#990000">})</font>
      <font color="#990000">])</font></tt></pre></td></tr></table>
</td></tr></table>
<p><b>Example 3. </b>Configuring the environment: telling the builder where CxxTest is installed</p>
<table frame="void" cellpadding="4">
<tr valign="top">
<td>
<img alt="Note" src="data:image/png;base64,
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">
</td>
<td style="border-left: 1px solid silver;">If you want to pass other options to the builder, just append them to the
dictionary.</td></tr></table>
<p>It is advisable to pass most options to the builder at creation time, although
the <em>CxxTest</em> call can also accept most of them if you need to do some weird
thing with a particular test.</p>
<p>You can use the builder the same way you would the <em>Program</em> builder.</p>
<table frame="void" width="100%" cellpadding="4">
<tr><td style="border-left: 2px solid silver;">
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><i><font color="#9A1900"># ... set up the environment as above, with your favorite options</font></i>
<i><font color="#9A1900"># and then tell the builder to build some tests</font></i>
env<font color="#990000">.</font><b><font color="#000000">CxxTest</font></b><font color="#990000">(</font><font color="#FF0000">'my_test_suite'</font><font color="#990000">,</font> source<font color="#990000">=</font><font color="#FF0000">'mytests.t.h'</font><font color="#990000">)</font>                      <i><font color="#9A1900">#<b>&lt;1&gt;</b></font></i>
env<font color="#990000">.</font><b><font color="#000000">CxxTest</font></b><font color="#990000">(</font><font color="#FF0000">'the_other_suite'</font><font color="#990000">,</font> <font color="#990000">[</font><font color="#FF0000">'test_header.t.h'</font><font color="#990000">,</font> <font color="#FF0000">'../utilities.cpp'</font><font color="#990000">])</font> <i><font color="#9A1900">#<b>&lt;2&gt;</b></font></i>
env<font color="#990000">.</font><b><font color="#000000">CxxTest</font></b><font color="#990000">(</font><font color="#FF0000">'the_third_suite'</font><font color="#990000">,</font>
                 <font color="#990000">[</font><font color="#FF0000">'testsuite1.t.h'</font><font color="#990000">,</font> <font color="#FF0000">'testsuite2.t.h'</font><font color="#990000">,</font>
                  <font color="#FF0000">'testsuite3.t.h'</font><font color="#990000">,</font> <font color="#FF0000">'required_libs.cpp'</font><font color="#990000">])</font>               <i><font color="#9A1900">#<b>&lt;3&gt;</b></font></i>
env<font color="#990000">.</font><b><font color="#000000">CxxTest</font></b><font color="#990000">(</font><font color="#FF0000">'the_fourth_suite'</font><font color="#990000">,</font>
                 <font color="#990000">[</font><font color="#FF0000">'reginold_never_checks_for_warnings.t.h'</font><font color="#990000">],</font>
                 CXXFLAGS<font color="#990000">=</font><font color="#FF0000">'-Wall -Wextra -Weffc++ -pedantic'</font><font color="#990000">)</font>           <i><font color="#9A1900">#<b>&lt;4&gt;</b></font></i></tt></pre></td></tr></table>
<ol>
<li>
<p>
Normal, 1-source file tests
</p>
</li>
<li>
<p>
This is how a single testsuite needing implementations is compilied
</p>
</li>
<li>
<p>
If you want multiple testsuites in a single runner, this is how it&#8217;s done
</p>
</li>
<li>
<p>
unrecognised options are passed through to the Program builder unchanged
</p>
</li>
</ol>
</td></tr></table>
<p><b>Example 4. </b>Setting up tests with SCons and the cxxtest builder</p>
<h4><a name="_configuration_options"></a>Configuration Options</h4>
<h5><a name="_code_cxxtest_runner_code"></a><code>CXXTEST_RUNNER</code></h5>
<p>Default: "ErrorPrinter".</p>
<p>This is what is passed to the <code>--runner</code> option of <code>cxxtestgen</code>. See the section
about runners to see what the other options are.</p>
<h5><a name="_code_cxxtest_opts_code"></a><code>CXXTEST_OPTS</code></h5>
<p>Default: empty.</p>
<p>Any other commandline options to pass to <code>cxxtestgen</code>.</p>
<p>Do not pass <code>--runner</code>, <code>--error-printer</code> and friends, and <code>--root</code> or <code>--part</code>
here.</p>
<h5><a name="_code_cxxtest_suffix_code"></a><code>CXXTEST_SUFFIX</code></h5>
<p>Default: ".t.h"</p>
<p>The suffix test suite files have. Should be different from other header files.
If you never mean to pass any header files that are not test suites to the
builder, you can set this to ".h" and use plain ".h" files.</p>
<h5><a name="_code_cxxtest_target_code"></a><code>CXXTEST_TARGET</code></h5>
<p>Default: "check"</p>
<p>This is the target that scons tests are added to in order to run them. If you
want something else, this is the place.</p>
<h5><a name="_code_cxxtest_install_dir_code"></a><code>CXXTEST_INSTALL_DIR</code></h5>
<p>Default: autodetect</p>
<p>If cxxtest isn&#8217;t found automatically, you need to set this. Normal SCons path
expansion rules apply.</p>
<h5><a name="_code_cxxtest_cpppath_code"></a><code>CXXTEST_CPPPATH</code></h5>
<p>Default: autodetect</p>
<p>If you don&#8217;t want to clutter your normal <code>CPPPATH</code> with CxxTest headers and this
isn&#8217;t autodetected even after you set <code>CXXTEST_INSTALL_DIR</code>, then set this.</p>
<h5><a name="_code_cxxtest_code"></a><code>CXXTEST</code></h5>
<p>Default: autodetect</p>
<p>If <code>cxxtestgen</code> isn&#8217;t found even after you set <code>CXXTEST_INSTALL_DIR</code>, then set
this to the path of the <code>cxxtestgen</code> script.</p>
<h5><a name="_code_cxxtest_skip_errors_code"></a><code>CXXTEST_SKIP_ERRORS</code></h5>
<p>Default: False</p>
<p>When running tests with <code>scons check</code>, if you want to continue even if tests
fail, set this to True.</p>
<h5><a name="_code_cxxtest_python_code"></a><code>CXXTEST_PYTHON</code></h5>
<p>Default: the same python interpreter that is running scons.</p>
<p>If you want to use a particular python interpreter to run <code>cxxtestgen</code>, set its
path here.</p>
<h5><a name="_code_cxxtest_cxxflags_remove_code"></a><code>CXXTEST_CXXFLAGS_REMOVE</code></h5>
<p>Default: a list of flags with which no test compiles. Changes as we fix bugs.</p>
<p>Do you want your tests to compile without some flags and don&#8217;t want gymnastics
to get them out for tests only? This is the way. Just add them to here and they
will be stripped. (This is a list, by the way, not a string.)</p>
<h5><a name="_code_cxxtest_ccflags_remove_code"></a><code>CXXTEST_CCFLAGS_REMOVE</code></h5>
<p>Same as above, but for <code>CCFLAGS</code>.</p>
<h5><a name="_code_cxxtest_cxxtestgen_script_name_code"></a><code>CXXTEST_CXXTESTGEN_SCRIPT_NAME</code></h5>
<p>If you are crazy and have changed the name of the cxxtestgen executable and want
autodetection to work otherwise, set this to the new name.</p>
<h3><a name="_using_makefiles"></a>Using Makefiles</h3>
<p>Generating the tests with a makefile is pretty straightforward.
Simply add rules to generate, compile and run the test runner.</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt><font color="#990000">all:</font> lib run_tests app

<i><font color="#9A1900"># Rules to build your targets</font></i>
<font color="#990000">lib:</font> <font color="#990000">...</font>

<font color="#990000">app:</font> <font color="#990000">...</font>

<i><font color="#9A1900"># A rule that runs the unit tests</font></i>
<font color="#990000">run_tests:</font> runner
        <font color="#990000">.</font>/runner

<i><font color="#9A1900"># How to build the test runner</font></i>
<font color="#990000">runner:</font> runner.cpp lib
        <font color="#009900">$(CXX)</font> -o <font color="#009900">$@</font> <font color="#009900">$&lt;</font>

<i><font color="#9A1900"># How to generate the test runner</font></i>
<font color="#990000">runner.cpp:</font> SimpleTest.h ComplicatedTest.h
         cxxtestgen -o <font color="#009900">$@</font> --error-printer <font color="#009900">$^</font></tt></pre></td></tr></table>
<h3><a name="_using_cons"></a>Using Cons</h3>
<p><a href="http://dsmit.com/cons/">Cons</a> is a powerful and
versatile make replacement which uses Perl scripts instead of Makefiles.</p>
<p>See <code>cxxtest/sample/Construct</code> in the CxxTest distribution for an
example of building CxxTest test runners with Cons.</p>
<h3><a name="_using_microsoft_visual_studio"></a>Using Microsoft Visual Studio</h3>
<p>See <code>cxxtest/sample/msvc</code> in the distribution
to see a reasonable integration of CxxTest with Microsoft Visual Studio&#8217;s IDE.
Basically, the workspace has three
projects:</p>
<ul>
<li>
<p>
The project <code>CxxTest_3_Generate</code> runs <code>cxxtestgen</code>.
</p>
</li>
<li>
<p>
The project <code>CxxTest_2_Build</code> compiles the generated file.
</p>
</li>
<li>
<p>
The project <code>CxxTest_1_Run</code> runs the tests.
</p>
</li>
</ul>
<p>This method certainly works, and the test results are conveniently
displayed as compilation errors and warnings (for <a href="#ts_warn">TS_WARN</a>.
However, there are still a few things missing; to integrate this
approach with your own project, you usually need to work a little
bit and tweak some makefiles and project options.  The script
<code>sample/msvc/FixFiles.bat</code> can automate some of this process.</p>
<h3><a name="_using_microsoft_windows_ddk"></a>Using Microsoft Windows DDK</h3>
<p>To use CxxTest with the <code>build</code> utility for device drivers, you add
the generated tests file as an extra dependency using the
<code>NTBUILDTARGET0</code> macro and the <code>Makefile.inc</code> file.  An example of
how to do this is in the CxxTest distribution under <code>sample/winddk</code>.</p>
<hr>
<h2><a name="appendix_C"></a>Appendix C: Testing CxxTest</h2>
<p>In the <code>cxxtest/test</code> directory, you can execute</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>python test_cxxtest<font color="#990000">.</font>py</tt></pre></td></tr></table>
<p>to launch all tests.  By default, this script executes test suites
for a variety of compilers if they are found on the user&#8217;s path:
<code>g++</code>, <code>clang++</code>, <code>cl</code> (the Microsoft Visual Studio compiler).
Additionally, this test script includes separate test suites for
the default test discovery mechanism as well as test discovery using
the new FOG parser.</p>
<p>You can execute a specific test suite by giving its name as an
argument to this test script.  For example, the command</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>python test_cxxtest<font color="#990000">.</font>py TestGpp</tt></pre></td></tr></table>
<p>executes the <code>TestGpp</code> test suite, which tests CxxTest with the
<code>g++</code> compiler.  Similarly, the command</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>python test_cxxtest<font color="#990000">.</font>py TestGppFOG</tt></pre></td></tr></table>
<p>executes the test suite that tests CxxTest using the <code>g++</code> compiler
and the FOG parser.</p>
<p>The <code>test_cxxtest.py</code> script should work with versions Python 2.7
or newer.  If you are running Python 2.6, you will need to install
the <code>unittest2</code> package.  If you have
<a href="http://pypi.python.org/pypi/setuptools">setuptools</a> or
<a href="http://pypi.python.org/pypi/distribute">distribute</a>
installed, then
you can install this package from PyPI by executing</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10"><tr><td><!-- Generator: GNU source-highlight 3.1.6
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>easy_install unittest2</tt></pre></td></tr></table>
<p>Similarly, the tests for this document rely on the <code>PyUtilib</code> Python package.</p>
<p>The FOG parser requires two Python packages:</p>
<ul>
<li>
<p>
<code>ply</code>
</p>
</li>
<li>
<p>
<code>ordereddict</code> (This is only needed when running Python 2.6)
</p>
</li>
</ul>
<p>If these packages are not available, then <code>test_cxxtest.py</code> will skip the FOG tests.</p>
<hr>
<h2><a name="appendix_D"></a>Appendix D: CxxTest Releases</h2>
<ul>
<li>
<p>
Version 4.3 (2013-07-05)
</p>
<ul>
<li>
<p>
Changes to assess code coverage of the cxxtestgen command
</p>
</li>
<li>
<p>
Standardizing C++ file formats (using astyle)
</p>
</li>
<li>
<p>
Bug fixes that led to the test runner hanging
</p>
</li>
<li>
<p>
Adding special assertions for floating point values
</p>
</li>
<li>
<p>
Added date to XML output
</p>
</li>
<li>
<p>
Added support for comparison of C strings
</p>
</li>
</ul>
</li>
<li>
<p>
Version 4.2.1 (2013-03-22)
</p>
<ul>
<li>
<p>
Fixing documentation of LGPL version
</p>
</li>
</ul>
</li>
<li>
<p>
Version 4.2 (2013-03-16)
</p>
<ul>
<li>
<p>
Changes to support test fixtures in namespaces
</p>
</li>
<li>
<p>
Adding logic to support test skipping
</p>
</li>
<li>
<p>
Change to create self-contained HTML documentation
</p>
</li>
<li>
<p>
Fixed inheritance issue in GlobalFixture (#69)
</p>
</li>
<li>
<p>
Update LGPL version
</p>
</li>
<li>
<p>
Changes to try/catch to avoid ambiguities withn catching std::exception (#53)
</p>
</li>
<li>
<p>
Fixed TS_ASSERT_DELTA to work on integer types (#65)
</p>
</li>
<li>
<p>
Changed output format to print world-name (#70)
</p>
</li>
</ul>
</li>
<li>
<p>
Version 4.1 (2012-11-30)
</p>
<ul>
<li>
<p>
Added absolute paths to resolve bug when relative path links are provided.
</p>
</li>
<li>
<p>
Bug fix when files contain unicode characters
</p>
</li>
<li>
<p>
Fix for --no-static-init:  Changed how non-static tests are created
</p>
</li>
<li>
<p>
Updated user guide to include SCons build system
</p>
</li>
<li>
<p>
Closing out Tigris and SourceForge tickets
</p>
</li>
<li>
<p>
Added valgrind tests.
</p>
</li>
</ul>
</li>
<li>
<p>
Version 4.0.3 (2012-01-07)
</p>
<ul>
<li>
<p>
Adding support for Python 2.4 - 3.2
</p>
</li>
<li>
<p>
Various cleanup of CxxTest root directory
</p>
</li>
<li>
<p>
Adding patch that allows the cxxtestgen script to be used when symlinked.
</p>
</li>
</ul>
</li>
<li>
<p>
Version 4.0.2 (2012-01-02)
</p>
<ul>
<li>
<p>
Bug fix to enable installation of cxxtestgen without the <em>setuptools</em> package
</p>
</li>
</ul>
</li>
<li>
<p>
Version 4.0.1 (2012-01-01)
</p>
<ul>
<li>
<p>
Documentation updates
</p>
</li>
<li>
<p>
Bug fix for installation of cxxtestgen script
</p>
</li>
</ul>
</li>
<li>
<p>
Version 4.0 (2011-12-28)
</p>
<ul>
<li>
<p>
Perl is no longer used to support CxxTest scripts.  Python is now the only scripting language used by      CxxTest.
</p>
</li>
<li>
<p>
The testing scripts have been rewritten using the PyUnit framework.
</p>
</li>
<li>
<p>
The installation process for CxxTest now leverages and integrates with the system Python installation.
</p>
</li>
<li>
<p>
A more comprehensive C++ parser is now available, which supports testing of templates.
</p>
</li>
<li>
<p>
The CxxTest GUI is no longer supported.
</p>
</li>
<li>
<p>
The <a href="#ts_trace">TS_TRACE</a> and <a href="#ts_warn">TS_WARN</a> macros have the same behavior now.
</p>
</li>
<li>
<p>
CxxTest runners now have a command-line interface that facilitates interactive use of the test runner.
</p>
</li>
<li>
<p>
A new user guide is now available in PDF, HTML and Ebook formats.
</p>
</li>
</ul>
</li>
<li>
<p>
Version 3.10.1 (2004-12-01)
</p>
<ul>
<li>
<p>
Improved support for VC7
</p>
</li>
<li>
<p>
Fixed clash with some versions of STL
</p>
</li>
</ul>
</li>
<li>
<p>
Version 3.10.0 (2004-11-20)
</p>
<ul>
<li>
<p>
Added mock framework for global functions
</p>
</li>
<li>
<p>
Added TS_ASSERT_THROWS_ASSERT and TS_ASSERT_THROWS_EQUALS
</p>
</li>
<li>
<p>
Added CXXTEST_ENUM_TRAITS
</p>
</li>
<li>
<p>
Improved support for STL classes (vector, map etc.)
</p>
</li>
<li>
<p>
Added support for Digital Mars compiler
</p>
</li>
<li>
<p>
Reduced root/part compilation time and binary size
</p>
</li>
<li>
<p>
Support C++-style commenting of tests
</p>
</li>
</ul>
</li>
<li>
<p>
Version 3.9.1 (2004-01-19)
</p>
<ul>
<li>
<p>
Fixed small bug with runner exit code
</p>
</li>
<li>
<p>
Embedded test suites are now deprecated
</p>
</li>
</ul>
</li>
<li>
<p>
Version 3.9.0 (2004-01-17)
</p>
<ul>
<li>
<p>
Added TS_TRACE
</p>
</li>
<li>
<p>
Added --no-static-init
</p>
</li>
<li>
<p>
CxxTest::setAbortTestOnFail() works even without --abort-on-fail
</p>
</li>
</ul>
</li>
<li>
<p>
Version 3.8.5 (2004-01-08)
</p>
<ul>
<li>
<p>
Added --no-eh
</p>
</li>
<li>
<p>
Added CxxTest::setAbortTestOnFail() and CXXTEST_DEFAULT_ABORT
</p>
</li>
<li>
<p>
Added CxxTest::setMaxDumpSize()
</p>
</li>
<li>
<p>
Added StdioFilePrinter
</p>
</li>
</ul>
</li>
<li>
<p>
Version 3.8.4 (2003-12-31)
</p>
<ul>
<li>
<p>
Split distribution into cxxtest and cxxtest-selftest
</p>
</li>
<li>
<p>
Added &#8216;sample/msvc/FixFiles.bat&#8217;
</p>
</li>
</ul>
</li>
<li>
<p>
Version 3.8.3 (2003-12-24)
</p>
<ul>
<li>
<p>
Added TS_ASSERT_PREDICATE
</p>
</li>
<li>
<p>
Template files can now specify where to insert the preamble
</p>
</li>
<li>
<p>
Added a sample Visual Studio workspace in &#8216;sample/msvc&#8217;
</p>
</li>
<li>
<p>
Can compile in MSVC with warning level 4
</p>
</li>
<li>
<p>
Changed output format slightly
</p>
</li>
</ul>
</li>
<li>
<p>
Version 3.8.1 (2003-12-21)
</p>
<ul>
<li>
<p>
Fixed small bug when using multiple --part files.
</p>
</li>
<li>
<p>
Fixed X11 GUI crash when there&#8217;s no X server.
</p>
</li>
<li>
<p>
Added GlobalFixture::setUpWorld()/tearDownWorld()
</p>
</li>
<li>
<p>
Added leaveOnly(), activateAllTests() and &#8216;sample/only.tpl&#8217;
</p>
</li>
<li>
<p>
Should now run without warnings on Sun compiler.
</p>
</li>
</ul>
</li>
<li>
<p>
Version 3.8.0 (2003-12-13)
</p>
<ul>
<li>
<p>
Fixed bug where &#8216;Root.cpp&#8217; needed exception handling
</p>
</li>
<li>
<p>
Added TS_ASSERT_RELATION
</p>
</li>
<li>
<p>
TSM_ macros now also tell you what went wrong
</p>
</li>
<li>
<p>
Renamed Win32Gui::free() to avoid clashes
</p>
</li>
<li>
<p>
Now compatible with more versions of Borland compiler
</p>
</li>
<li>
<p>
Improved the documentation
</p>
</li>
</ul>
</li>
<li>
<p>
Version 3.7.1 (2003-09-29)
</p>
<ul>
<li>
<p>
Added --version
</p>
</li>
<li>
<p>
Compiles with even more exotic g++ warnings
</p>
</li>
<li>
<p>
Win32 Gui compiles with UNICODE
</p>
</li>
<li>
<p>
Should compile on some more platforms (Sun Forte, HP aCC)
</p>
</li>
</ul>
</li>
<li>
<p>
Version 3.7.0 (2003-09-20)
</p>
<ul>
<li>
<p>
Added TS_ASSERT_LESS_THAN_EQUALS
</p>
</li>
<li>
<p>
Minor cleanups
</p>
</li>
</ul>
</li>
<li>
<p>
Version 3.6.1 (2003-09-15)
</p>
<ul>
<li>
<p>
Improved QT GUI
</p>
</li>
<li>
<p>
Improved portability some more
</p>
</li>
</ul>
</li>
<li>
<p>
Version 3.6.0 (2003-09-04)
</p>
<ul>
<li>
<p>
Added --longlong
</p>
</li>
<li>
<p>
Some portability improvements
</p>
</li>
</ul>
</li>
<li>
<p>
Version 3.5.1 (2003-09-03)
</p>
<ul>
<li>
<p>
Major internal rewrite of macros
</p>
</li>
<li>
<p>
Added TS_ASSERT_SAME_DATA
</p>
</li>
<li>
<p>
Added --include option
</p>
</li>
<li>
<p>
Added --part and --root to enable splitting the test runner
</p>
</li>
<li>
<p>
Added global fixtures
</p>
</li>
<li>
<p>
Enhanced Win32 GUI with timers, -keep and -title
</p>
</li>
<li>
<p>
Now compiles with strict warnings
</p>
</li>
</ul>
</li>
<li>
<p>
Version 3.1.1 (2003-08-27)
</p>
<ul>
<li>
<p>
Fixed small bug in TS_ASSERT_THROWS_*()
</p>
</li>
</ul>
</li>
<li>
<p>
Version 3.1.0 (2003-08-23)
</p>
<ul>
<li>
<p>
Default ValueTraits now dumps value as hex bytes
</p>
</li>
<li>
<p>
Fixed double invocation bug (e.g. TS_FAIL(functionWithSideEffects()))
</p>
</li>
<li>
<p>
TS_ASSERT_THROWS*() are now "abort on fail"-friendly
</p>
</li>
<li>
<p>
Win32 GUI now supports Windows 98 and doesn&#8217;t need comctl32.lib
</p>
</li>
</ul>
</li>
<li>
<p>
Version 3.0.1 (2003-08-07)
</p>
<ul>
<li>
<p>
Added simple GUI for X11, Win32 and Qt
</p>
</li>
<li>
<p>
Added TS_WARN() macro
</p>
</li>
<li>
<p>
Removed --exit-code
</p>
</li>
<li>
<p>
Improved samples
</p>
</li>
<li>
<p>
Improved support for older (pre-std::) compilers
</p>
</li>
<li>
<p>
Made a PDF version of the User&#8217;s Guide
</p>
</li>
</ul>
</li>
<li>
<p>
Version 2.8.4 (2003-07-21)
</p>
<ul>
<li>
<p>
Now supports g++-3.3
</p>
</li>
<li>
<p>
Added --have-eh
</p>
</li>
<li>
<p>
Fixed bug in numberToString()
</p>
</li>
</ul>
</li>
<li>
<p>
Version 2.8.3 (2003-06-30)
</p>
<ul>
<li>
<p>
Fixed bugs in cxxtestgen.pl
</p>
</li>
<li>
<p>
Fixed warning for some compilers in ErrorPrinter/StdioPrinter
</p>
</li>
<li>
<p>
Thanks Martin Jost for pointing out these problems!
</p>
</li>
</ul>
</li>
<li>
<p>
Version 2.8.2 (2003-06-10)
</p>
<ul>
<li>
<p>
Fixed bug when using CXXTEST_ABORT_TEST_ON_FAIL without standard library
</p>
</li>
<li>
<p>
Added CXXTEST_USER_TRAITS
</p>
</li>
<li>
<p>
Added --abort-on-fail
</p>
</li>
</ul>
</li>
<li>
<p>
Version 2.8.1 (2003-01-16)
</p>
<ul>
<li>
<p>
Fixed charToString() for negative chars
</p>
</li>
</ul>
</li>
<li>
<p>
Version 2.8.0 (2003-01-13)
</p>
<ul>
<li>
<p>
Added CXXTEST_ABORT_TEST_ON_FAIL for xUnit-like behaviour
</p>
</li>
<li>
<p>
Added &#8216;sample/winddk&#8217;
</p>
</li>
<li>
<p>
Improved ValueTraits
</p>
</li>
<li>
<p>
Improved output formatter
</p>
</li>
<li>
<p>
Started version history
</p>
</li>
</ul>
</li>
<li>
<p>
Version 2.7.0 (2002-09-29)
</p>
<ul>
<li>
<p>
Added embedded test suites
</p>
</li>
<li>
<p>
Major internal improvements
</p>
</li>
</ul>
</li>
</ul>
<p></p>
<p></p>
<hr><p><small>
Last updated 2013-07-05 13:54:58 UTC
</small></p>
</body>
</html>