This file is indexed.

/usr/share/doc/libglib2.0-doc/glib/glib-Testing.html is in libglib2.0-doc 2.32.1-0ubuntu2.

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
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Testing</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
<link rel="home" href="index.html" title="GLib Reference Manual">
<link rel="up" href="glib-utilities.html" title="GLib Utilities">
<link rel="prev" href="glib-Bookmark-file-parser.html" title="Bookmark file parser">
<link rel="next" href="glib-UNIX-specific-utilities-and-integration.html" title="UNIX-specific utilities and integration">
<meta name="generator" content="GTK-Doc V1.18 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="glib-Bookmark-file-parser.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="glib-utilities.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">GLib Reference Manual</th>
<td><a accesskey="n" href="glib-UNIX-specific-utilities-and-integration.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts">
<a href="#glib-Testing.synopsis" class="shortcut">Top</a>
                   | 
                  <a href="#glib-Testing.description" class="shortcut">Description</a>
</td></tr>
</table>
<div class="refentry">
<a name="glib-Testing"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="glib-Testing.top_of_page"></a>Testing</span></h2>
<p>Testing — a test framework</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<a name="glib-Testing.synopsis"></a><h2>Synopsis</h2>
<pre class="synopsis">
#include &lt;glib.h&gt;

<span class="returnvalue">void</span>                <a class="link" href="glib-Testing.html#g-test-minimized-result" title="g_test_minimized_result ()">g_test_minimized_result</a>             (<em class="parameter"><code><span class="type">double</span> minimized_quantity</code></em>,
                                                         <em class="parameter"><code>const <span class="type">char</span> *format</code></em>,
                                                         <em class="parameter"><code>...</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="glib-Testing.html#g-test-maximized-result" title="g_test_maximized_result ()">g_test_maximized_result</a>             (<em class="parameter"><code><span class="type">double</span> maximized_quantity</code></em>,
                                                         <em class="parameter"><code>const <span class="type">char</span> *format</code></em>,
                                                         <em class="parameter"><code>...</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="glib-Testing.html#g-test-init" title="g_test_init ()">g_test_init</a>                         (<em class="parameter"><code><span class="type">int</span> *argc</code></em>,
                                                         <em class="parameter"><code><span class="type">char</span> ***argv</code></em>,
                                                         <em class="parameter"><code>...</code></em>);
#define             <a class="link" href="glib-Testing.html#g-test-quick" title="g_test_quick">g_test_quick</a>
#define             <a class="link" href="glib-Testing.html#g-test-slow" title="g_test_slow">g_test_slow</a>
#define             <a class="link" href="glib-Testing.html#g-test-thorough" title="g_test_thorough">g_test_thorough</a>
#define             <a class="link" href="glib-Testing.html#g-test-perf" title="g_test_perf">g_test_perf</a>
#define             <a class="link" href="glib-Testing.html#g-test-verbose" title="g_test_verbose">g_test_verbose</a>
#define             <a class="link" href="glib-Testing.html#g-test-undefined" title="g_test_undefined">g_test_undefined</a>
#define             <a class="link" href="glib-Testing.html#g-test-quiet" title="g_test_quiet">g_test_quiet</a>
<span class="returnvalue">int</span>                 <a class="link" href="glib-Testing.html#g-test-run" title="g_test_run ()">g_test_run</a>                          (<em class="parameter"><code><span class="type">void</span></code></em>);
<span class="returnvalue">void</span>                (<a class="link" href="glib-Testing.html#GTestFunc" title="GTestFunc ()">*GTestFunc</a>)                        (<em class="parameter"><code><span class="type">void</span></code></em>);
<span class="returnvalue">void</span>                <a class="link" href="glib-Testing.html#g-test-add-func" title="g_test_add_func ()">g_test_add_func</a>                     (<em class="parameter"><code>const <span class="type">char</span> *testpath</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Testing.html#GTestFunc" title="GTestFunc ()"><span class="type">GTestFunc</span></a> test_func</code></em>);
<span class="returnvalue">void</span>                (<a class="link" href="glib-Testing.html#GTestDataFunc" title="GTestDataFunc ()">*GTestDataFunc</a>)                    (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="type">gconstpointer</span></a> user_data</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="glib-Testing.html#g-test-add-data-func" title="g_test_add_data_func ()">g_test_add_data_func</a>                (<em class="parameter"><code>const <span class="type">char</span> *testpath</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="type">gconstpointer</span></a> test_data</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Testing.html#GTestDataFunc" title="GTestDataFunc ()"><span class="type">GTestDataFunc</span></a> test_func</code></em>);
#define             <a class="link" href="glib-Testing.html#g-test-add" title="g_test_add()">g_test_add</a>                          (testpath,
                                                         Fixture,
                                                         tdata,
                                                         fsetup,
                                                         ftest,
                                                         fteardown)
<span class="returnvalue">void</span>                <a class="link" href="glib-Testing.html#g-test-fail" title="g_test_fail ()">g_test_fail</a>                         (<em class="parameter"><code><span class="type">void</span></code></em>);
<span class="returnvalue">void</span>                <a class="link" href="glib-Testing.html#g-test-message" title="g_test_message ()">g_test_message</a>                      (<em class="parameter"><code>const <span class="type">char</span> *format</code></em>,
                                                         <em class="parameter"><code>...</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="glib-Testing.html#g-test-bug-base" title="g_test_bug_base ()">g_test_bug_base</a>                     (<em class="parameter"><code>const <span class="type">char</span> *uri_pattern</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="glib-Testing.html#g-test-bug" title="g_test_bug ()">g_test_bug</a>                          (<em class="parameter"><code>const <span class="type">char</span> *bug_uri_snippet</code></em>);
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>            (<a class="link" href="glib-Testing.html#GTestLogFatalFunc" title="GTestLogFatalFunc ()">*GTestLogFatalFunc</a>)                (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *log_domain</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Message-Logging.html#GLogLevelFlags" title="enum GLogLevelFlags"><span class="type">GLogLevelFlags</span></a> log_level</code></em>,
                                                         <em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *message</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> user_data</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="glib-Testing.html#g-test-log-set-fatal-handler" title="g_test_log_set_fatal_handler ()">g_test_log_set_fatal_handler</a>        (<em class="parameter"><code><a class="link" href="glib-Testing.html#GTestLogFatalFunc" title="GTestLogFatalFunc ()"><span class="type">GTestLogFatalFunc</span></a> log_func</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> user_data</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="glib-Testing.html#g-test-timer-start" title="g_test_timer_start ()">g_test_timer_start</a>                  (<em class="parameter"><code><span class="type">void</span></code></em>);
<span class="returnvalue">double</span>              <a class="link" href="glib-Testing.html#g-test-timer-elapsed" title="g_test_timer_elapsed ()">g_test_timer_elapsed</a>                (<em class="parameter"><code><span class="type">void</span></code></em>);
<span class="returnvalue">double</span>              <a class="link" href="glib-Testing.html#g-test-timer-last" title="g_test_timer_last ()">g_test_timer_last</a>                   (<em class="parameter"><code><span class="type">void</span></code></em>);
<span class="returnvalue">void</span>                <a class="link" href="glib-Testing.html#g-test-queue-free" title="g_test_queue_free ()">g_test_queue_free</a>                   (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> gfree_pointer</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="glib-Testing.html#g-test-queue-destroy" title="g_test_queue_destroy ()">g_test_queue_destroy</a>                (<em class="parameter"><code><a class="link" href="glib-Datasets.html#GDestroyNotify" title="GDestroyNotify ()"><span class="type">GDestroyNotify</span></a> destroy_func</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> destroy_data</code></em>);
#define             <a class="link" href="glib-Testing.html#g-test-queue-unref" title="g_test_queue_unref()">g_test_queue_unref</a>                  (gobject)
enum                <a class="link" href="glib-Testing.html#GTestTrapFlags" title="enum GTestTrapFlags">GTestTrapFlags</a>;
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="glib-Testing.html#g-test-trap-fork" title="g_test_trap_fork ()">g_test_trap_fork</a>                    (<em class="parameter"><code><span class="type">guint64</span> usec_timeout</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Testing.html#GTestTrapFlags" title="enum GTestTrapFlags"><span class="type">GTestTrapFlags</span></a> test_trap_flags</code></em>);
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="glib-Testing.html#g-test-trap-has-passed" title="g_test_trap_has_passed ()">g_test_trap_has_passed</a>              (<em class="parameter"><code><span class="type">void</span></code></em>);
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>            <a class="link" href="glib-Testing.html#g-test-trap-reached-timeout" title="g_test_trap_reached_timeout ()">g_test_trap_reached_timeout</a>         (<em class="parameter"><code><span class="type">void</span></code></em>);
#define             <a class="link" href="glib-Testing.html#g-test-trap-assert-passed" title="g_test_trap_assert_passed">g_test_trap_assert_passed</a>
#define             <a class="link" href="glib-Testing.html#g-test-trap-assert-failed" title="g_test_trap_assert_failed">g_test_trap_assert_failed</a>
#define             <a class="link" href="glib-Testing.html#g-test-trap-assert-stdout" title="g_test_trap_assert_stdout()">g_test_trap_assert_stdout</a>           (soutpattern)
#define             <a class="link" href="glib-Testing.html#g-test-trap-assert-stdout-unmatched" title="g_test_trap_assert_stdout_unmatched()">g_test_trap_assert_stdout_unmatched</a> (soutpattern)
#define             <a class="link" href="glib-Testing.html#g-test-trap-assert-stderr" title="g_test_trap_assert_stderr()">g_test_trap_assert_stderr</a>           (serrpattern)
#define             <a class="link" href="glib-Testing.html#g-test-trap-assert-stderr-unmatched" title="g_test_trap_assert_stderr_unmatched()">g_test_trap_assert_stderr_unmatched</a> (serrpattern)
#define             <a class="link" href="glib-Testing.html#g-test-rand-bit" title="g_test_rand_bit">g_test_rand_bit</a>
<span class="returnvalue">gint32</span>              <a class="link" href="glib-Testing.html#g-test-rand-int" title="g_test_rand_int ()">g_test_rand_int</a>                     (<em class="parameter"><code><span class="type">void</span></code></em>);
<span class="returnvalue">gint32</span>              <a class="link" href="glib-Testing.html#g-test-rand-int-range" title="g_test_rand_int_range ()">g_test_rand_int_range</a>               (<em class="parameter"><code><span class="type">gint32</span> begin</code></em>,
                                                         <em class="parameter"><code><span class="type">gint32</span> end</code></em>);
<span class="returnvalue">double</span>              <a class="link" href="glib-Testing.html#g-test-rand-double" title="g_test_rand_double ()">g_test_rand_double</a>                  (<em class="parameter"><code><span class="type">void</span></code></em>);
<span class="returnvalue">double</span>              <a class="link" href="glib-Testing.html#g-test-rand-double-range" title="g_test_rand_double_range ()">g_test_rand_double_range</a>            (<em class="parameter"><code><span class="type">double</span> range_start</code></em>,
                                                         <em class="parameter"><code><span class="type">double</span> range_end</code></em>);
#define             <a class="link" href="glib-Testing.html#g-assert" title="g_assert()">g_assert</a>                            (expr)
#define             <a class="link" href="glib-Testing.html#g-assert-not-reached" title="g_assert_not_reached">g_assert_not_reached</a>
#define             <a class="link" href="glib-Testing.html#g-assert-cmpstr" title="g_assert_cmpstr()">g_assert_cmpstr</a>                     (s1,
                                                         cmp,
                                                         s2)
#define             <a class="link" href="glib-Testing.html#g-assert-cmpint" title="g_assert_cmpint()">g_assert_cmpint</a>                     (n1,
                                                         cmp,
                                                         n2)
#define             <a class="link" href="glib-Testing.html#g-assert-cmpuint" title="g_assert_cmpuint()">g_assert_cmpuint</a>                    (n1,
                                                         cmp,
                                                         n2)
#define             <a class="link" href="glib-Testing.html#g-assert-cmphex" title="g_assert_cmphex()">g_assert_cmphex</a>                     (n1,
                                                         cmp,
                                                         n2)
#define             <a class="link" href="glib-Testing.html#g-assert-cmpfloat" title="g_assert_cmpfloat()">g_assert_cmpfloat</a>                   (n1,
                                                         cmp,
                                                         n2)
#define             <a class="link" href="glib-Testing.html#g-assert-no-error" title="g_assert_no_error()">g_assert_no_error</a>                   (err)
#define             <a class="link" href="glib-Testing.html#g-assert-error" title="g_assert_error()">g_assert_error</a>                      (err,
                                                         dom,
                                                         c)
typedef             <a class="link" href="glib-Testing.html#GTestCase" title="GTestCase">GTestCase</a>;
typedef             <a class="link" href="glib-Testing.html#GTestSuite" title="GTestSuite">GTestSuite</a>;
<span class="returnvalue">void</span>                (<a class="link" href="glib-Testing.html#GTestFixtureFunc" title="GTestFixtureFunc ()">*GTestFixtureFunc</a>)                 (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> fixture</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="type">gconstpointer</span></a> user_data</code></em>);
<a class="link" href="glib-Testing.html#GTestCase" title="GTestCase"><span class="returnvalue">GTestCase</span></a> *         <a class="link" href="glib-Testing.html#g-test-create-case" title="g_test_create_case ()">g_test_create_case</a>                  (<em class="parameter"><code>const <span class="type">char</span> *test_name</code></em>,
                                                         <em class="parameter"><code><span class="type">gsize</span> data_size</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="type">gconstpointer</span></a> test_data</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Testing.html#GTestFixtureFunc" title="GTestFixtureFunc ()"><span class="type">GTestFixtureFunc</span></a> data_setup</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Testing.html#GTestFixtureFunc" title="GTestFixtureFunc ()"><span class="type">GTestFixtureFunc</span></a> data_test</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Testing.html#GTestFixtureFunc" title="GTestFixtureFunc ()"><span class="type">GTestFixtureFunc</span></a> data_teardown</code></em>);
<a class="link" href="glib-Testing.html#GTestSuite" title="GTestSuite"><span class="returnvalue">GTestSuite</span></a> *        <a class="link" href="glib-Testing.html#g-test-create-suite" title="g_test_create_suite ()">g_test_create_suite</a>                 (<em class="parameter"><code>const <span class="type">char</span> *suite_name</code></em>);
<a class="link" href="glib-Testing.html#GTestSuite" title="GTestSuite"><span class="returnvalue">GTestSuite</span></a> *        <a class="link" href="glib-Testing.html#g-test-get-root" title="g_test_get_root ()">g_test_get_root</a>                     (<em class="parameter"><code><span class="type">void</span></code></em>);
<span class="returnvalue">void</span>                <a class="link" href="glib-Testing.html#g-test-suite-add" title="g_test_suite_add ()">g_test_suite_add</a>                    (<em class="parameter"><code><a class="link" href="glib-Testing.html#GTestSuite" title="GTestSuite"><span class="type">GTestSuite</span></a> *suite</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Testing.html#GTestCase" title="GTestCase"><span class="type">GTestCase</span></a> *test_case</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="glib-Testing.html#g-test-suite-add-suite" title="g_test_suite_add_suite ()">g_test_suite_add_suite</a>              (<em class="parameter"><code><a class="link" href="glib-Testing.html#GTestSuite" title="GTestSuite"><span class="type">GTestSuite</span></a> *suite</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Testing.html#GTestSuite" title="GTestSuite"><span class="type">GTestSuite</span></a> *nestedsuite</code></em>);
<span class="returnvalue">int</span>                 <a class="link" href="glib-Testing.html#g-test-run-suite" title="g_test_run_suite ()">g_test_run_suite</a>                    (<em class="parameter"><code><a class="link" href="glib-Testing.html#GTestSuite" title="GTestSuite"><span class="type">GTestSuite</span></a> *suite</code></em>);
</pre>
</div>
<div class="refsect1">
<a name="glib-Testing.description"></a><h2>Description</h2>
<p>
GLib provides a framework for writing and maintaining unit tests
in parallel to the code they are testing. The API is designed according
to established concepts found in the other test frameworks (JUnit, NUnit,
RUnit), which in turn is based on smalltalk unit testing concepts.
</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term">Test case</span></p></td>
<td>Tests (test methods) are grouped together with their
      fixture into test cases.</td>
</tr>
<tr>
<td><p><span class="term">Fixture</span></p></td>
<td>A test fixture consists of fixture data and setup and
      teardown methods to establish the environment for the test
      functions. We use fresh fixtures, i.e. fixtures are newly set
      up and torn down around each test invocation to avoid dependencies
      between tests.</td>
</tr>
<tr>
<td><p><span class="term">Test suite</span></p></td>
<td>Test cases can be grouped into test suites, to allow
      subsets of the available tests to be run. Test suites can be
      grouped into other test suites as well.</td>
</tr>
</tbody>
</table></div>
<p>
The API is designed to handle creation and registration of test suites
and test cases implicitly. A simple call like
</p>
<div class="informalexample"><pre class="programlisting">
  g_test_add_func ("/misc/assertions", test_assertions);
</pre></div>
<p>
creates a test suite called "misc" with a single test case named
"assertions", which consists of running the test_assertions function.
</p>
<p>
In addition to the traditional <a class="link" href="glib-Testing.html#g-assert" title="g_assert()"><code class="function">g_assert()</code></a>, the test framework provides
an extended set of assertions for string and numerical comparisons:
<a class="link" href="glib-Testing.html#g-assert-cmpfloat" title="g_assert_cmpfloat()"><code class="function">g_assert_cmpfloat()</code></a>, <a class="link" href="glib-Testing.html#g-assert-cmpint" title="g_assert_cmpint()"><code class="function">g_assert_cmpint()</code></a>, <a class="link" href="glib-Testing.html#g-assert-cmpuint" title="g_assert_cmpuint()"><code class="function">g_assert_cmpuint()</code></a>,
<a class="link" href="glib-Testing.html#g-assert-cmphex" title="g_assert_cmphex()"><code class="function">g_assert_cmphex()</code></a>, <a class="link" href="glib-Testing.html#g-assert-cmpstr" title="g_assert_cmpstr()"><code class="function">g_assert_cmpstr()</code></a>. The advantage of these variants
over plain <a class="link" href="glib-Testing.html#g-assert" title="g_assert()"><code class="function">g_assert()</code></a> is that the assertion messages can be more
elaborate, and include the values of the compared entities.
</p>
<p>
GLib ships with two utilities called gtester and gtester-report to
facilitate running tests and producing nicely formatted test reports.
</p>
</div>
<div class="refsect1">
<a name="glib-Testing.details"></a><h2>Details</h2>
<div class="refsect2">
<a name="g-test-minimized-result"></a><h3>g_test_minimized_result ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_test_minimized_result             (<em class="parameter"><code><span class="type">double</span> minimized_quantity</code></em>,
                                                         <em class="parameter"><code>const <span class="type">char</span> *format</code></em>,
                                                         <em class="parameter"><code>...</code></em>);</pre>
<p>
Report the result of a performance or measurement test.
The test should generally strive to minimize the reported
quantities (smaller values are better than larger ones),
this and <em class="parameter"><code>minimized_quantity</code></em> can determine sorting
order for test result reports.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>minimized_quantity</code></em> :</span></p></td>
<td>the reported value</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>format</code></em> :</span></p></td>
<td>the format string of the report message</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td>
<td>arguments to pass to the <code class="function">printf()</code> function</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.16</p>
</div>
<hr>
<div class="refsect2">
<a name="g-test-maximized-result"></a><h3>g_test_maximized_result ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_test_maximized_result             (<em class="parameter"><code><span class="type">double</span> maximized_quantity</code></em>,
                                                         <em class="parameter"><code>const <span class="type">char</span> *format</code></em>,
                                                         <em class="parameter"><code>...</code></em>);</pre>
<p>
Report the result of a performance or measurement test.
The test should generally strive to maximize the reported
quantities (larger values are better than smaller ones),
this and <em class="parameter"><code>maximized_quantity</code></em> can determine sorting
order for test result reports.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>maximized_quantity</code></em> :</span></p></td>
<td>the reported value</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>format</code></em> :</span></p></td>
<td>the format string of the report message</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td>
<td>arguments to pass to the <code class="function">printf()</code> function</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.16</p>
</div>
<hr>
<div class="refsect2">
<a name="g-test-init"></a><h3>g_test_init ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_test_init                         (<em class="parameter"><code><span class="type">int</span> *argc</code></em>,
                                                         <em class="parameter"><code><span class="type">char</span> ***argv</code></em>,
                                                         <em class="parameter"><code>...</code></em>);</pre>
<p>
Initialize the GLib testing framework, e.g. by seeding the
test random number generator, the name for <a class="link" href="glib-Miscellaneous-Utility-Functions.html#g-get-prgname" title="g_get_prgname ()"><code class="function">g_get_prgname()</code></a>
and parsing test related command line args.
So far, the following arguments are understood:
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><code class="option">-l</code></span></p></td>
<td><p>
      list test cases available in a test executable.
    </p></td>
</tr>
<tr>
<td><p><span class="term"><code class="option">--seed=<em class="replaceable"><code>RANDOMSEED</code></em></code></span></p></td>
<td><p>
      provide a random seed to reproduce test runs using random numbers.
    </p></td>
</tr>
<tr>
<td><p><span class="term"><code class="option">--verbose</code></span></p></td>
<td><p>run tests verbosely.</p></td>
</tr>
<tr>
<td><p><span class="term"><code class="option">-q</code>, <code class="option">--quiet</code></span></p></td>
<td><p>run tests quietly.</p></td>
</tr>
<tr>
<td><p><span class="term"><code class="option">-p <em class="replaceable"><code>TESTPATH</code></em></code></span></p></td>
<td><p>
        execute all tests matching <em class="replaceable"><code>TESTPATH</code></em>.
      </p></td>
</tr>
<tr>
<td><p><span class="term"><code class="option">-m {perf|slow|thorough|quick|undefined|no-undefined}</code></span></p></td>
<td>
<p>
        execute tests according to these test modes:
        </p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term">perf</span></p></td>
<td><p>
              performance tests, may take long and report results.
            </p></td>
</tr>
<tr>
<td><p><span class="term">slow, thorough</span></p></td>
<td><p>
              slow and thorough tests, may take quite long and 
              maximize coverage.
            </p></td>
</tr>
<tr>
<td><p><span class="term">quick</span></p></td>
<td><p>
              quick tests, should run really quickly and give good coverage.
            </p></td>
</tr>
<tr>
<td><p><span class="term">undefined</span></p></td>
<td><p>
              tests for undefined behaviour, may provoke programming errors
              under <a class="link" href="glib-Testing.html#g-test-trap-fork" title="g_test_trap_fork ()"><code class="function">g_test_trap_fork()</code></a> to check that appropriate assertions
              or warnings are given
            </p></td>
</tr>
<tr>
<td><p><span class="term">no-undefined</span></p></td>
<td><p>
              avoid tests for undefined behaviour
            </p></td>
</tr>
</tbody>
</table></div>
<p>
      </p>
</td>
</tr>
<tr>
<td><p><span class="term"><code class="option">--debug-log</code></span></p></td>
<td><p>debug test logging output.</p></td>
</tr>
<tr>
<td><p><span class="term"><code class="option">-k</code>, <code class="option">--keep-going</code></span></p></td>
<td><p>gtester-specific argument.</p></td>
</tr>
<tr>
<td><p><span class="term"><code class="option">--GTestLogFD <em class="replaceable"><code>N</code></em></code></span></p></td>
<td><p>gtester-specific argument.</p></td>
</tr>
<tr>
<td><p><span class="term"><code class="option">--GTestSkipCount <em class="replaceable"><code>N</code></em></code></span></p></td>
<td><p>gtester-specific argument.</p></td>
</tr>
</tbody>
</table></div>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>argc</code></em> :</span></p></td>
<td>Address of the <em class="parameter"><code>argc</code></em> parameter of the <code class="function">main()</code> function.
Changed if any arguments were handled.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>argv</code></em> :</span></p></td>
<td>Address of the <em class="parameter"><code>argv</code></em> parameter of <code class="function">main()</code>.
Any parameters understood by <a class="link" href="glib-Testing.html#g-test-init" title="g_test_init ()"><code class="function">g_test_init()</code></a> stripped before return.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td>
<td>Reserved for future extension. Currently, you must pass <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.16</p>
</div>
<hr>
<div class="refsect2">
<a name="g-test-quick"></a><h3>g_test_quick</h3>
<pre class="programlisting">#define             g_test_quick()</pre>
<p>
Returns <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if tests are run in quick mode.
Exactly one of <a class="link" href="glib-Testing.html#g-test-quick" title="g_test_quick"><code class="function">g_test_quick()</code></a> and <a class="link" href="glib-Testing.html#g-test-slow" title="g_test_slow"><code class="function">g_test_slow()</code></a> is active in any run;
there is no "medium speed".
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>
<a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if in quick mode</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-test-slow"></a><h3>g_test_slow</h3>
<pre class="programlisting">#define             g_test_slow()</pre>
<p>
Returns <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if tests are run in slow mode.
Exactly one of <a class="link" href="glib-Testing.html#g-test-quick" title="g_test_quick"><code class="function">g_test_quick()</code></a> and <a class="link" href="glib-Testing.html#g-test-slow" title="g_test_slow"><code class="function">g_test_slow()</code></a> is active in any run;
there is no "medium speed".
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>the opposite of <a class="link" href="glib-Testing.html#g-test-quick" title="g_test_quick"><code class="function">g_test_quick()</code></a>
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-test-thorough"></a><h3>g_test_thorough</h3>
<pre class="programlisting">#define             g_test_thorough()</pre>
<p>
Returns <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if tests are run in thorough mode, equivalent to
<a class="link" href="glib-Testing.html#g-test-slow" title="g_test_slow"><code class="function">g_test_slow()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>the same thing as <a class="link" href="glib-Testing.html#g-test-slow" title="g_test_slow"><code class="function">g_test_slow()</code></a>
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-test-perf"></a><h3>g_test_perf</h3>
<pre class="programlisting">#define             g_test_perf()</pre>
<p>
Returns <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if tests are run in performance mode.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>
<a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if in performance mode</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-test-verbose"></a><h3>g_test_verbose</h3>
<pre class="programlisting">#define             g_test_verbose()</pre>
<p>
Returns <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if tests are run in verbose mode.
The default is neither <a class="link" href="glib-Testing.html#g-test-verbose" title="g_test_verbose"><code class="function">g_test_verbose()</code></a> nor <a class="link" href="glib-Testing.html#g-test-quiet" title="g_test_quiet"><code class="function">g_test_quiet()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>
<a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if in verbose mode</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-test-undefined"></a><h3>g_test_undefined</h3>
<pre class="programlisting">#define             g_test_undefined()</pre>
<p>
Returns <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if tests may provoke assertions and other formally-undefined
behaviour under <a class="link" href="glib-Testing.html#g-test-trap-fork" title="g_test_trap_fork ()"><code class="function">g_test_trap_fork()</code></a>, to verify that appropriate warnings
are given. It can be useful to turn this off if running tests under
valgrind.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>
<a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if tests may provoke programming errors</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-test-quiet"></a><h3>g_test_quiet</h3>
<pre class="programlisting">#define             g_test_quiet()</pre>
<p>
Returns <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if tests are run in quiet mode.
The default is neither <a class="link" href="glib-Testing.html#g-test-verbose" title="g_test_verbose"><code class="function">g_test_verbose()</code></a> nor <a class="link" href="glib-Testing.html#g-test-quiet" title="g_test_quiet"><code class="function">g_test_quiet()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>
<a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if in quiet mode</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-test-run"></a><h3>g_test_run ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span>                 g_test_run                          (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
<p>
Runs all tests under the toplevel suite which can be retrieved
with <a class="link" href="glib-Testing.html#g-test-get-root" title="g_test_get_root ()"><code class="function">g_test_get_root()</code></a>. Similar to <a class="link" href="glib-Testing.html#g-test-run-suite" title="g_test_run_suite ()"><code class="function">g_test_run_suite()</code></a>, the test
cases to be run are filtered according to
test path arguments (-p <em class="replaceable"><code>testpath</code></em>) as 
parsed by <a class="link" href="glib-Testing.html#g-test-init" title="g_test_init ()"><code class="function">g_test_init()</code></a>.
<a class="link" href="glib-Testing.html#g-test-run-suite" title="g_test_run_suite ()"><code class="function">g_test_run_suite()</code></a> or <a class="link" href="glib-Testing.html#g-test-run" title="g_test_run ()"><code class="function">g_test_run()</code></a> may only be called once
in a program.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>0 on success</td>
</tr></tbody>
</table></div>
<p class="since">Since 2.16</p>
</div>
<hr>
<div class="refsect2">
<a name="GTestFunc"></a><h3>GTestFunc ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                (*GTestFunc)                        (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
<p>
The type used for test case functions.
</p>
<p class="since">Since 2.28</p>
</div>
<hr>
<div class="refsect2">
<a name="g-test-add-func"></a><h3>g_test_add_func ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_test_add_func                     (<em class="parameter"><code>const <span class="type">char</span> *testpath</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Testing.html#GTestFunc" title="GTestFunc ()"><span class="type">GTestFunc</span></a> test_func</code></em>);</pre>
<p>
Create a new test case, similar to <a class="link" href="glib-Testing.html#g-test-create-case" title="g_test_create_case ()"><code class="function">g_test_create_case()</code></a>. However
the test is assumed to use no fixture, and test suites are automatically
created on the fly and added to the root fixture, based on the
slash-separated portions of <em class="parameter"><code>testpath</code></em>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>testpath</code></em> :</span></p></td>
<td>/-separated test case path name for the test.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>test_func</code></em> :</span></p></td>
<td>The test function to invoke for this test.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.16</p>
</div>
<hr>
<div class="refsect2">
<a name="GTestDataFunc"></a><h3>GTestDataFunc ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                (*GTestDataFunc)                    (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="type">gconstpointer</span></a> user_data</code></em>);</pre>
<p>
The type used for test case functions that take an extra pointer
argument.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
<td>the data provided when registering the test</td>
</tr></tbody>
</table></div>
<p class="since">Since 2.28</p>
</div>
<hr>
<div class="refsect2">
<a name="g-test-add-data-func"></a><h3>g_test_add_data_func ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_test_add_data_func                (<em class="parameter"><code>const <span class="type">char</span> *testpath</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="type">gconstpointer</span></a> test_data</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Testing.html#GTestDataFunc" title="GTestDataFunc ()"><span class="type">GTestDataFunc</span></a> test_func</code></em>);</pre>
<p>
Create a new test case, similar to <a class="link" href="glib-Testing.html#g-test-create-case" title="g_test_create_case ()"><code class="function">g_test_create_case()</code></a>. However
the test is assumed to use no fixture, and test suites are automatically
created on the fly and added to the root fixture, based on the
slash-separated portions of <em class="parameter"><code>testpath</code></em>. The <em class="parameter"><code>test_data</code></em> argument
will be passed as first argument to <em class="parameter"><code>test_func</code></em>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>testpath</code></em> :</span></p></td>
<td>/-separated test case path name for the test.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>test_data</code></em> :</span></p></td>
<td>Test data argument for the test function.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>test_func</code></em> :</span></p></td>
<td>The test function to invoke for this test.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.16</p>
</div>
<hr>
<div class="refsect2">
<a name="g-test-add"></a><h3>g_test_add()</h3>
<pre class="programlisting">#define             g_test_add(testpath, Fixture, tdata, fsetup, ftest, fteardown)</pre>
<p>
Hook up a new test case at <em class="parameter"><code>testpath</code></em>, similar to <a class="link" href="glib-Testing.html#g-test-add-func" title="g_test_add_func ()"><code class="function">g_test_add_func()</code></a>.
A fixture data structure with setup and teardown function may be provided
though, similar to <a class="link" href="glib-Testing.html#g-test-create-case" title="g_test_create_case ()"><code class="function">g_test_create_case()</code></a>.
<a class="link" href="glib-Testing.html#g-test-add" title="g_test_add()"><code class="function">g_test_add()</code></a> is implemented as a macro, so that the <code class="function">fsetup()</code>, <code class="function">ftest()</code> and
<code class="function">fteardown()</code> callbacks can expect a <em class="parameter"><code>Fixture</code></em> pointer as first argument in
a type safe manner.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>testpath</code></em> :</span></p></td>
<td>The test path for a new test case.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>Fixture</code></em> :</span></p></td>
<td>The type of a fixture data structure.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>tdata</code></em> :</span></p></td>
<td>Data argument for the test functions.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>fsetup</code></em> :</span></p></td>
<td>The function to set up the fixture data.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>ftest</code></em> :</span></p></td>
<td>The actual test function.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>fteardown</code></em> :</span></p></td>
<td>The function to tear down the fixture data.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.16</p>
</div>
<hr>
<div class="refsect2">
<a name="g-test-fail"></a><h3>g_test_fail ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_test_fail                         (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
<p>
Indicates that a test failed. This function can be called
multiple times from the same test. You can use this function
if your test failed in a recoverable way.
</p>
<p>
Do not use this function if the failure of a test could cause
other tests to malfunction.
</p>
<p>
Calling this function will not stop the test from running, you
need to return from the test function yourself. So you can
produce additional diagnostic messages or even continue running
the test.
</p>
<p>
If not called from inside a test, this function does nothing.
</p>
<p class="since">Since 2.30</p>
</div>
<hr>
<div class="refsect2">
<a name="g-test-message"></a><h3>g_test_message ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_test_message                      (<em class="parameter"><code>const <span class="type">char</span> *format</code></em>,
                                                         <em class="parameter"><code>...</code></em>);</pre>
<p>
Add a message to the test report.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>format</code></em> :</span></p></td>
<td>the format string</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td>
<td>printf-like arguments to <em class="parameter"><code>format</code></em>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.16</p>
</div>
<hr>
<div class="refsect2">
<a name="g-test-bug-base"></a><h3>g_test_bug_base ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_test_bug_base                     (<em class="parameter"><code>const <span class="type">char</span> *uri_pattern</code></em>);</pre>
<p>
Specify the base URI for bug reports.
</p>
<p>
The base URI is used to construct bug report messages for
<a class="link" href="glib-Testing.html#g-test-message" title="g_test_message ()"><code class="function">g_test_message()</code></a> when <a class="link" href="glib-Testing.html#g-test-bug" title="g_test_bug ()"><code class="function">g_test_bug()</code></a> is called.
Calling this function outside of a test case sets the
default base URI for all test cases. Calling it from within
a test case changes the base URI for the scope of the test
case only.
Bug URIs are constructed by appending a bug specific URI
portion to <em class="parameter"><code>uri_pattern</code></em>, or by replacing the special string
'%s' within <em class="parameter"><code>uri_pattern</code></em> if that is present.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>uri_pattern</code></em> :</span></p></td>
<td>the base pattern for bug URIs</td>
</tr></tbody>
</table></div>
<p class="since">Since 2.16</p>
</div>
<hr>
<div class="refsect2">
<a name="g-test-bug"></a><h3>g_test_bug ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_test_bug                          (<em class="parameter"><code>const <span class="type">char</span> *bug_uri_snippet</code></em>);</pre>
<p>
This function adds a message to test reports that
associates a bug URI with a test case.
Bug URIs are constructed from a base URI set with <a class="link" href="glib-Testing.html#g-test-bug-base" title="g_test_bug_base ()"><code class="function">g_test_bug_base()</code></a>
and <em class="parameter"><code>bug_uri_snippet</code></em>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>bug_uri_snippet</code></em> :</span></p></td>
<td>Bug specific bug tracker URI portion.</td>
</tr></tbody>
</table></div>
<p class="since">Since 2.16</p>
</div>
<hr>
<div class="refsect2">
<a name="GTestLogFatalFunc"></a><h3>GTestLogFatalFunc ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>            (*GTestLogFatalFunc)                (<em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *log_domain</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Message-Logging.html#GLogLevelFlags" title="enum GLogLevelFlags"><span class="type">GLogLevelFlags</span></a> log_level</code></em>,
                                                         <em class="parameter"><code>const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar"><span class="type">gchar</span></a> *message</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> user_data</code></em>);</pre>
<p>
Specifies the prototype of fatal log handler functions.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>log_domain</code></em> :</span></p></td>
<td>the log domain of the message</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>log_level</code></em> :</span></p></td>
<td>the log level of the message (including the fatal and recursion flags)</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>message</code></em> :</span></p></td>
<td>the message to process</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
<td>user data, set in <a class="link" href="glib-Testing.html#g-test-log-set-fatal-handler" title="g_test_log_set_fatal_handler ()"><code class="function">g_test_log_set_fatal_handler()</code></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>
<a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if the program should abort, <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a> otherwise</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.22</p>
</div>
<hr>
<div class="refsect2">
<a name="g-test-log-set-fatal-handler"></a><h3>g_test_log_set_fatal_handler ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_test_log_set_fatal_handler        (<em class="parameter"><code><a class="link" href="glib-Testing.html#GTestLogFatalFunc" title="GTestLogFatalFunc ()"><span class="type">GTestLogFatalFunc</span></a> log_func</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> user_data</code></em>);</pre>
<p>
Installs a non-error fatal log handler which can be
used to decide whether log messages which are counted
as fatal abort the program.
</p>
<p>
The use case here is that you are running a test case
that depends on particular libraries or circumstances
and cannot prevent certain known critical or warning
messages. So you install a handler that compares the
domain and message to precisely not abort in such a case.
</p>
<p>
Note that the handler is reset at the beginning of
any test case, so you have to set it inside each test
function which needs the special behavior.
</p>
<p>
This handler has no effect on g_error messages.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>log_func</code></em> :</span></p></td>
<td>the log handler function.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
<td>data passed to the log handler.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.22</p>
</div>
<hr>
<div class="refsect2">
<a name="g-test-timer-start"></a><h3>g_test_timer_start ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_test_timer_start                  (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
<p>
Start a timing test. Call <a class="link" href="glib-Testing.html#g-test-timer-elapsed" title="g_test_timer_elapsed ()"><code class="function">g_test_timer_elapsed()</code></a> when the task is supposed
to be done. Call this function again to restart the timer.
</p>
<p class="since">Since 2.16</p>
</div>
<hr>
<div class="refsect2">
<a name="g-test-timer-elapsed"></a><h3>g_test_timer_elapsed ()</h3>
<pre class="programlisting"><span class="returnvalue">double</span>              g_test_timer_elapsed                (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
<p>
Get the time since the last start of the timer with <a class="link" href="glib-Testing.html#g-test-timer-start" title="g_test_timer_start ()"><code class="function">g_test_timer_start()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>the time since the last start of the timer, as a double</td>
</tr></tbody>
</table></div>
<p class="since">Since 2.16</p>
</div>
<hr>
<div class="refsect2">
<a name="g-test-timer-last"></a><h3>g_test_timer_last ()</h3>
<pre class="programlisting"><span class="returnvalue">double</span>              g_test_timer_last                   (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
<p>
Report the last result of <a class="link" href="glib-Testing.html#g-test-timer-elapsed" title="g_test_timer_elapsed ()"><code class="function">g_test_timer_elapsed()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>the last result of <a class="link" href="glib-Testing.html#g-test-timer-elapsed" title="g_test_timer_elapsed ()"><code class="function">g_test_timer_elapsed()</code></a>, as a double</td>
</tr></tbody>
</table></div>
<p class="since">Since 2.16</p>
</div>
<hr>
<div class="refsect2">
<a name="g-test-queue-free"></a><h3>g_test_queue_free ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_test_queue_free                   (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> gfree_pointer</code></em>);</pre>
<p>
Enqueue a pointer to be released with <a class="link" href="glib-Memory-Allocation.html#g-free" title="g_free ()"><code class="function">g_free()</code></a> during the next
teardown phase. This is equivalent to calling <a class="link" href="glib-Testing.html#g-test-queue-destroy" title="g_test_queue_destroy ()"><code class="function">g_test_queue_destroy()</code></a>
with a destroy callback of <a class="link" href="glib-Memory-Allocation.html#g-free" title="g_free ()"><code class="function">g_free()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>gfree_pointer</code></em> :</span></p></td>
<td>the pointer to be stored.</td>
</tr></tbody>
</table></div>
<p class="since">Since 2.16</p>
</div>
<hr>
<div class="refsect2">
<a name="g-test-queue-destroy"></a><h3>g_test_queue_destroy ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_test_queue_destroy                (<em class="parameter"><code><a class="link" href="glib-Datasets.html#GDestroyNotify" title="GDestroyNotify ()"><span class="type">GDestroyNotify</span></a> destroy_func</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> destroy_data</code></em>);</pre>
<p>
This function enqueus a callback <em class="parameter"><code>destroy_func</code></em> to be executed
during the next test case teardown phase. This is most useful
to auto destruct allocted test resources at the end of a test run.
Resources are released in reverse queue order, that means enqueueing
callback A before callback B will cause <code class="function">B()</code> to be called before
<code class="function">A()</code> during teardown.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>destroy_func</code></em> :</span></p></td>
<td>Destroy callback for teardown phase.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>destroy_data</code></em> :</span></p></td>
<td>Destroy callback data.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.16</p>
</div>
<hr>
<div class="refsect2">
<a name="g-test-queue-unref"></a><h3>g_test_queue_unref()</h3>
<pre class="programlisting">#define             g_test_queue_unref(gobject)</pre>
<p>
Enqueue an object to be released with <a href="../gobject/gobject-The-Base-Object-Type.html#g-object-unref"><code class="function">g_object_unref()</code></a> during
the next teardown phase. This is equivalent to calling
<a class="link" href="glib-Testing.html#g-test-queue-destroy" title="g_test_queue_destroy ()"><code class="function">g_test_queue_destroy()</code></a> with a destroy callback of <a href="../gobject/gobject-The-Base-Object-Type.html#g-object-unref"><code class="function">g_object_unref()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>gobject</code></em> :</span></p></td>
<td>the object to unref</td>
</tr></tbody>
</table></div>
<p class="since">Since 2.16</p>
</div>
<hr>
<div class="refsect2">
<a name="GTestTrapFlags"></a><h3>enum GTestTrapFlags</h3>
<pre class="programlisting">typedef enum {
  G_TEST_TRAP_SILENCE_STDOUT    = 1 &lt;&lt; 7,
  G_TEST_TRAP_SILENCE_STDERR    = 1 &lt;&lt; 8,
  G_TEST_TRAP_INHERIT_STDIN     = 1 &lt;&lt; 9
} GTestTrapFlags;
</pre>
<p>
Test traps are guards around forked tests.
These flags determine what traps to set.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><a name="G-TEST-TRAP-SILENCE-STDOUT:CAPS"></a><span class="term"><code class="literal">G_TEST_TRAP_SILENCE_STDOUT</code></span></p></td>
<td>Redirect stdout of the test child to
    <code class="filename">/dev/null</code> so it cannot be observed on the
    console during test runs. The actual output is still captured
    though to allow later tests with <a class="link" href="glib-Testing.html#g-test-trap-assert-stdout" title="g_test_trap_assert_stdout()"><code class="function">g_test_trap_assert_stdout()</code></a>.
</td>
</tr>
<tr>
<td><p><a name="G-TEST-TRAP-SILENCE-STDERR:CAPS"></a><span class="term"><code class="literal">G_TEST_TRAP_SILENCE_STDERR</code></span></p></td>
<td>Redirect stderr of the test child to
    <code class="filename">/dev/null</code> so it cannot be observed on the
    console during test runs. The actual output is still captured
    though to allow later tests with <a class="link" href="glib-Testing.html#g-test-trap-assert-stderr" title="g_test_trap_assert_stderr()"><code class="function">g_test_trap_assert_stderr()</code></a>.
</td>
</tr>
<tr>
<td><p><a name="G-TEST-TRAP-INHERIT-STDIN:CAPS"></a><span class="term"><code class="literal">G_TEST_TRAP_INHERIT_STDIN</code></span></p></td>
<td>If this flag is given, stdin of the
    forked child process is shared with stdin of its parent process.
    It is redirected to <code class="filename">/dev/null</code> otherwise.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-test-trap-fork"></a><h3>g_test_trap_fork ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>            g_test_trap_fork                    (<em class="parameter"><code><span class="type">guint64</span> usec_timeout</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Testing.html#GTestTrapFlags" title="enum GTestTrapFlags"><span class="type">GTestTrapFlags</span></a> test_trap_flags</code></em>);</pre>
<p>
Fork the current test program to execute a test case that might
not return or that might abort. The forked test case is aborted
and considered failing if its run time exceeds <em class="parameter"><code>usec_timeout</code></em>.
</p>
<p>
The forking behavior can be configured with the <a class="link" href="glib-Testing.html#GTestTrapFlags" title="enum GTestTrapFlags"><span class="type">GTestTrapFlags</span></a> flags.
</p>
<p>
In the following example, the test code forks, the forked child
process produces some sample output and exits successfully.
The forking parent process then asserts successful child program
termination and validates child program outputs.
</p>
<p>
</p>
<div class="informalexample"><pre class="programlisting">
  static void
  test_fork_patterns (void)
  {
    if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR))
      {
        g_print ("some stdout text: somagic17\n");
        g_printerr ("some stderr text: semagic43\n");
        exit (0); /* successful test run */
      }
    g_test_trap_assert_passed();
    g_test_trap_assert_stdout ("*somagic17*");
    g_test_trap_assert_stderr ("*semagic43*");
  }
</pre></div>
<p>
</p>
<p>
This function is implemented only on Unix platforms.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>usec_timeout</code></em> :</span></p></td>
<td>Timeout for the forked test in micro seconds.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>test_trap_flags</code></em> :</span></p></td>
<td>Flags to modify forking behaviour.</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>
<a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> for the forked child and <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a> for the executing parent process.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.16</p>
</div>
<hr>
<div class="refsect2">
<a name="g-test-trap-has-passed"></a><h3>g_test_trap_has_passed ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>            g_test_trap_has_passed              (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
<p>
Check the result of the last <a class="link" href="glib-Testing.html#g-test-trap-fork" title="g_test_trap_fork ()"><code class="function">g_test_trap_fork()</code></a> call.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>
<a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if the last forked child terminated successfully.</td>
</tr></tbody>
</table></div>
<p class="since">Since 2.16</p>
</div>
<hr>
<div class="refsect2">
<a name="g-test-trap-reached-timeout"></a><h3>g_test_trap_reached_timeout ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>            g_test_trap_reached_timeout         (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
<p>
Check the result of the last <a class="link" href="glib-Testing.html#g-test-trap-fork" title="g_test_trap_fork ()"><code class="function">g_test_trap_fork()</code></a> call.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>
<a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if the last forked child got killed due to a fork timeout.</td>
</tr></tbody>
</table></div>
<p class="since">Since 2.16</p>
</div>
<hr>
<div class="refsect2">
<a name="g-test-trap-assert-passed"></a><h3>g_test_trap_assert_passed</h3>
<pre class="programlisting">#define             g_test_trap_assert_passed()</pre>
<p>
Assert that the last forked test passed.
See <a class="link" href="glib-Testing.html#g-test-trap-fork" title="g_test_trap_fork ()"><code class="function">g_test_trap_fork()</code></a>.
</p>
<p class="since">Since 2.16</p>
</div>
<hr>
<div class="refsect2">
<a name="g-test-trap-assert-failed"></a><h3>g_test_trap_assert_failed</h3>
<pre class="programlisting">#define             g_test_trap_assert_failed()</pre>
<p>
Assert that the last forked test failed.
See <a class="link" href="glib-Testing.html#g-test-trap-fork" title="g_test_trap_fork ()"><code class="function">g_test_trap_fork()</code></a>.
</p>
<p>
This is sometimes used to test situations that are formally considered to
be undefined behaviour, like inputs that fail a <a class="link" href="glib-Warnings-and-Assertions.html#g-return-if-fail" title="g_return_if_fail()"><code class="function">g_return_if_fail()</code></a>
check. In these situations you should skip the entire test, including the
call to <a class="link" href="glib-Testing.html#g-test-trap-fork" title="g_test_trap_fork ()"><code class="function">g_test_trap_fork()</code></a>, unless <a class="link" href="glib-Testing.html#g-test-undefined" title="g_test_undefined"><code class="function">g_test_undefined()</code></a> returns <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a>
to indicate that undefined behaviour may be tested.
</p>
<p class="since">Since 2.16</p>
</div>
<hr>
<div class="refsect2">
<a name="g-test-trap-assert-stdout"></a><h3>g_test_trap_assert_stdout()</h3>
<pre class="programlisting">#define             g_test_trap_assert_stdout(soutpattern)</pre>
<p>
Assert that the stdout output of the last forked test matches
<em class="parameter"><code>soutpattern</code></em>. See <a class="link" href="glib-Testing.html#g-test-trap-fork" title="g_test_trap_fork ()"><code class="function">g_test_trap_fork()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>soutpattern</code></em> :</span></p></td>
<td>a glob-style
<a class="link" href="glib-Glob-style-pattern-matching.html" title="Glob-style pattern matching">pattern</a>
</td>
</tr></tbody>
</table></div>
<p class="since">Since 2.16</p>
</div>
<hr>
<div class="refsect2">
<a name="g-test-trap-assert-stdout-unmatched"></a><h3>g_test_trap_assert_stdout_unmatched()</h3>
<pre class="programlisting">#define             g_test_trap_assert_stdout_unmatched(soutpattern)</pre>
<p>
Assert that the stdout output of the last forked test
does not match <em class="parameter"><code>soutpattern</code></em>. See <a class="link" href="glib-Testing.html#g-test-trap-fork" title="g_test_trap_fork ()"><code class="function">g_test_trap_fork()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>soutpattern</code></em> :</span></p></td>
<td>a glob-style
<a class="link" href="glib-Glob-style-pattern-matching.html" title="Glob-style pattern matching">pattern</a>
</td>
</tr></tbody>
</table></div>
<p class="since">Since 2.16</p>
</div>
<hr>
<div class="refsect2">
<a name="g-test-trap-assert-stderr"></a><h3>g_test_trap_assert_stderr()</h3>
<pre class="programlisting">#define             g_test_trap_assert_stderr(serrpattern)</pre>
<p>
Assert that the stderr output of the last forked test
matches <em class="parameter"><code>serrpattern</code></em>. See  <a class="link" href="glib-Testing.html#g-test-trap-fork" title="g_test_trap_fork ()"><code class="function">g_test_trap_fork()</code></a>.
</p>
<p>
This is sometimes used to test situations that are formally considered to
be undefined behaviour, like inputs that fail a <a class="link" href="glib-Warnings-and-Assertions.html#g-return-if-fail" title="g_return_if_fail()"><code class="function">g_return_if_fail()</code></a>
check. In these situations you should skip the entire test, including the
call to <a class="link" href="glib-Testing.html#g-test-trap-fork" title="g_test_trap_fork ()"><code class="function">g_test_trap_fork()</code></a>, unless <a class="link" href="glib-Testing.html#g-test-undefined" title="g_test_undefined"><code class="function">g_test_undefined()</code></a> returns <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a>
to indicate that undefined behaviour may be tested.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>serrpattern</code></em> :</span></p></td>
<td>a glob-style
<a class="link" href="glib-Glob-style-pattern-matching.html" title="Glob-style pattern matching">pattern</a>
</td>
</tr></tbody>
</table></div>
<p class="since">Since 2.16</p>
</div>
<hr>
<div class="refsect2">
<a name="g-test-trap-assert-stderr-unmatched"></a><h3>g_test_trap_assert_stderr_unmatched()</h3>
<pre class="programlisting">#define             g_test_trap_assert_stderr_unmatched(serrpattern)</pre>
<p>
Assert that the stderr output of the last forked test
does not match <em class="parameter"><code>serrpattern</code></em>. See <a class="link" href="glib-Testing.html#g-test-trap-fork" title="g_test_trap_fork ()"><code class="function">g_test_trap_fork()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>serrpattern</code></em> :</span></p></td>
<td>a glob-style
<a class="link" href="glib-Glob-style-pattern-matching.html" title="Glob-style pattern matching">pattern</a>
</td>
</tr></tbody>
</table></div>
<p class="since">Since 2.16</p>
</div>
<hr>
<div class="refsect2">
<a name="g-test-rand-bit"></a><h3>g_test_rand_bit</h3>
<pre class="programlisting">#define             g_test_rand_bit()</pre>
<p>
Get a reproducible random bit (0 or 1), see <a class="link" href="glib-Testing.html#g-test-rand-int" title="g_test_rand_int ()"><code class="function">g_test_rand_int()</code></a>
for details on test case random numbers.
</p>
<p class="since">Since 2.16</p>
</div>
<hr>
<div class="refsect2">
<a name="g-test-rand-int"></a><h3>g_test_rand_int ()</h3>
<pre class="programlisting"><span class="returnvalue">gint32</span>              g_test_rand_int                     (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
<p>
Get a reproducible random integer number.
</p>
<p>
The random numbers generated by the g_test_rand_*() family of functions
change with every new test program start, unless the --seed option is
given when starting test programs.
</p>
<p>
For individual test cases however, the random number generator is
reseeded, to avoid dependencies between tests and to make --seed
effective for all test cases.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>a random number from the seeded random number generator.</td>
</tr></tbody>
</table></div>
<p class="since">Since 2.16</p>
</div>
<hr>
<div class="refsect2">
<a name="g-test-rand-int-range"></a><h3>g_test_rand_int_range ()</h3>
<pre class="programlisting"><span class="returnvalue">gint32</span>              g_test_rand_int_range               (<em class="parameter"><code><span class="type">gint32</span> begin</code></em>,
                                                         <em class="parameter"><code><span class="type">gint32</span> end</code></em>);</pre>
<p>
Get a reproducible random integer number out of a specified range,
see <a class="link" href="glib-Testing.html#g-test-rand-int" title="g_test_rand_int ()"><code class="function">g_test_rand_int()</code></a> for details on test case random numbers.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>begin</code></em> :</span></p></td>
<td>the minimum value returned by this function</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>end</code></em> :</span></p></td>
<td>the smallest value not to be returned by this function</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>a number with <em class="parameter"><code>begin</code></em> &lt;= number &lt; <em class="parameter"><code>end</code></em>.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.16</p>
</div>
<hr>
<div class="refsect2">
<a name="g-test-rand-double"></a><h3>g_test_rand_double ()</h3>
<pre class="programlisting"><span class="returnvalue">double</span>              g_test_rand_double                  (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
<p>
Get a reproducible random floating point number,
see <a class="link" href="glib-Testing.html#g-test-rand-int" title="g_test_rand_int ()"><code class="function">g_test_rand_int()</code></a> for details on test case random numbers.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>a random number from the seeded random number generator.</td>
</tr></tbody>
</table></div>
<p class="since">Since 2.16</p>
</div>
<hr>
<div class="refsect2">
<a name="g-test-rand-double-range"></a><h3>g_test_rand_double_range ()</h3>
<pre class="programlisting"><span class="returnvalue">double</span>              g_test_rand_double_range            (<em class="parameter"><code><span class="type">double</span> range_start</code></em>,
                                                         <em class="parameter"><code><span class="type">double</span> range_end</code></em>);</pre>
<p>
Get a reproducible random floating pointer number out of a specified range,
see <a class="link" href="glib-Testing.html#g-test-rand-int" title="g_test_rand_int ()"><code class="function">g_test_rand_int()</code></a> for details on test case random numbers.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>range_start</code></em> :</span></p></td>
<td>the minimum value returned by this function</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>range_end</code></em> :</span></p></td>
<td>the minimum value not returned by this function</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>a number with <em class="parameter"><code>range_start</code></em> &lt;= number &lt; <em class="parameter"><code>range_end</code></em>.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.16</p>
</div>
<hr>
<div class="refsect2">
<a name="g-assert"></a><h3>g_assert()</h3>
<pre class="programlisting">#define             g_assert(expr)</pre>
<p>
Debugging macro to terminate the application if the assertion
fails. If the assertion fails (i.e. the expression is not true),
an error message is logged and the application is terminated.
</p>
<p>
The macro can be turned off in final releases of code by defining
<code class="envar">G_DISABLE_ASSERT</code> when compiling the application.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>expr</code></em> :</span></p></td>
<td>the expression to check</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="g-assert-not-reached"></a><h3>g_assert_not_reached</h3>
<pre class="programlisting">#define             g_assert_not_reached()</pre>
<p>
Debugging macro to terminate the application if it is ever
reached. If it is reached, an error message is logged and the
application is terminated.
</p>
<p>
The macro can be turned off in final releases of code by defining
<code class="envar">G_DISABLE_ASSERT</code> when compiling the application.
</p>
</div>
<hr>
<div class="refsect2">
<a name="g-assert-cmpstr"></a><h3>g_assert_cmpstr()</h3>
<pre class="programlisting">#define             g_assert_cmpstr(s1, cmp, s2)</pre>
<p>
Debugging macro to terminate the application with a warning
message if a string comparison fails. The strings are compared
using <a class="link" href="glib-String-Utility-Functions.html#g-strcmp0" title="g_strcmp0 ()"><code class="function">g_strcmp0()</code></a>.
</p>
<p>
The effect of <code class="literal">g_assert_cmpstr (s1, op, s2)</code> is
the same as <code class="literal">g_assert (g_strcmp0 (s1, s2) op 0)</code>.
The advantage of this macro is that it can produce a message that
includes the actual values of <em class="parameter"><code>s1</code></em> and <em class="parameter"><code>s2</code></em>.
</p>
<p>
</p>
<div class="informalexample"><pre class="programlisting">
  g_assert_cmpstr (mystring, ==, "fubar");
</pre></div>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>s1</code></em> :</span></p></td>
<td>a string (may be <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>)</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>cmp</code></em> :</span></p></td>
<td>The comparison operator to use.
One of ==, !=, &lt;, &gt;, &lt;=, &gt;=.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>s2</code></em> :</span></p></td>
<td>another string (may be <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>)</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.16</p>
</div>
<hr>
<div class="refsect2">
<a name="g-assert-cmpint"></a><h3>g_assert_cmpint()</h3>
<pre class="programlisting">#define             g_assert_cmpint(n1, cmp, n2)</pre>
<p>
Debugging macro to terminate the application with a warning
message if an integer comparison fails.
</p>
<p>
The effect of <code class="literal">g_assert_cmpint (n1, op, n2)</code> is
the same as <code class="literal">g_assert (n1 op n2)</code>. The advantage
of this macro is that it can produce a message that includes the
actual values of <em class="parameter"><code>n1</code></em> and <em class="parameter"><code>n2</code></em>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>n1</code></em> :</span></p></td>
<td>an integer</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>cmp</code></em> :</span></p></td>
<td>The comparison operator to use.
One of ==, !=, &lt;, &gt;, &lt;=, &gt;=.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>n2</code></em> :</span></p></td>
<td>another integer</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.16</p>
</div>
<hr>
<div class="refsect2">
<a name="g-assert-cmpuint"></a><h3>g_assert_cmpuint()</h3>
<pre class="programlisting">#define             g_assert_cmpuint(n1, cmp, n2)</pre>
<p>
Debugging macro to terminate the application with a warning
message if an unsigned integer comparison fails.
</p>
<p>
The effect of <code class="literal">g_assert_cmpuint (n1, op, n2)</code> is
the same as <code class="literal">g_assert (n1 op n2)</code>. The advantage
of this macro is that it can produce a message that includes the
actual values of <em class="parameter"><code>n1</code></em> and <em class="parameter"><code>n2</code></em>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>n1</code></em> :</span></p></td>
<td>an unsigned integer</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>cmp</code></em> :</span></p></td>
<td>The comparison operator to use.
One of ==, !=, &lt;, &gt;, &lt;=, &gt;=.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>n2</code></em> :</span></p></td>
<td>another unsigned integer</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.16</p>
</div>
<hr>
<div class="refsect2">
<a name="g-assert-cmphex"></a><h3>g_assert_cmphex()</h3>
<pre class="programlisting">#define             g_assert_cmphex(n1, cmp, n2)</pre>
<p>
Debugging macro to terminate the application with a warning
message if an unsigned integer comparison fails.
</p>
<p>
This is a variant of <a class="link" href="glib-Testing.html#g-assert-cmpuint" title="g_assert_cmpuint()"><code class="function">g_assert_cmpuint()</code></a> that displays the numbers
in hexadecimal notation in the message.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>n1</code></em> :</span></p></td>
<td>an unsigned integer</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>cmp</code></em> :</span></p></td>
<td>The comparison operator to use.
One of ==, !=, &lt;, &gt;, &lt;=, &gt;=.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>n2</code></em> :</span></p></td>
<td>another unsigned integer</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.16</p>
</div>
<hr>
<div class="refsect2">
<a name="g-assert-cmpfloat"></a><h3>g_assert_cmpfloat()</h3>
<pre class="programlisting">#define             g_assert_cmpfloat(n1,cmp,n2)</pre>
<p>
Debugging macro to terminate the application with a warning
message if a floating point number comparison fails.
</p>
<p>
The effect of <code class="literal">g_assert_cmpfloat (n1, op, n2)</code> is
the same as <code class="literal">g_assert (n1 op n2)</code>. The advantage
of this macro is that it can produce a message that includes the
actual values of <em class="parameter"><code>n1</code></em> and <em class="parameter"><code>n2</code></em>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>n1</code></em> :</span></p></td>
<td>an floating point number</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>cmp</code></em> :</span></p></td>
<td>The comparison operator to use.
One of ==, !=, &lt;, &gt;, &lt;=, &gt;=.</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>n2</code></em> :</span></p></td>
<td>another floating point number</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.16</p>
</div>
<hr>
<div class="refsect2">
<a name="g-assert-no-error"></a><h3>g_assert_no_error()</h3>
<pre class="programlisting">#define             g_assert_no_error(err)</pre>
<p>
Debugging macro to terminate the application with a warning
message if a method has returned a <a class="link" href="glib-Error-Reporting.html#GError" title="struct GError"><span class="type">GError</span></a>.
</p>
<p>
The effect of <code class="literal">g_assert_no_error (err)</code> is
the same as <code class="literal">g_assert (err == NULL)</code>. The advantage
of this macro is that it can produce a message that includes
the error message and code.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>err</code></em> :</span></p></td>
<td>a <a class="link" href="glib-Error-Reporting.html#GError" title="struct GError"><span class="type">GError</span></a>, possibly <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>
</td>
</tr></tbody>
</table></div>
<p class="since">Since 2.20</p>
</div>
<hr>
<div class="refsect2">
<a name="g-assert-error"></a><h3>g_assert_error()</h3>
<pre class="programlisting">#define             g_assert_error(err, dom, c)</pre>
<p>
Debugging macro to terminate the application with a warning
message if a method has not returned the correct <a class="link" href="glib-Error-Reporting.html#GError" title="struct GError"><span class="type">GError</span></a>.
</p>
<p>
The effect of <code class="literal">g_assert_error (err, dom, c)</code> is
the same as <code class="literal">g_assert (err != NULL &amp;&amp; err-&gt;domain
== dom &amp;&amp; err-&gt;code == c)</code>. The advantage of this
macro is that it can produce a message that includes the incorrect
error message and code.
</p>
<p>
This can only be used to test for a specific error. If you want to
test that <em class="parameter"><code>err</code></em> is set, but don't care what it's set to, just use
<code class="literal">g_assert (err != NULL)</code>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>err</code></em> :</span></p></td>
<td>a <a class="link" href="glib-Error-Reporting.html#GError" title="struct GError"><span class="type">GError</span></a>, possibly <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>dom</code></em> :</span></p></td>
<td>the expected error domain (a <a class="link" href="glib-Quarks.html#GQuark" title="GQuark"><span class="type">GQuark</span></a>)</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>c</code></em> :</span></p></td>
<td>the expected error code</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.20</p>
</div>
<hr>
<div class="refsect2">
<a name="GTestCase"></a><h3>GTestCase</h3>
<pre class="programlisting">typedef struct GTestCase  GTestCase;
</pre>
<p>
An opaque structure representing a test case.
</p>
</div>
<hr>
<div class="refsect2">
<a name="GTestSuite"></a><h3>GTestSuite</h3>
<pre class="programlisting">typedef struct GTestSuite GTestSuite;
</pre>
<p>
An opaque structure representing a test suite.
</p>
</div>
<hr>
<div class="refsect2">
<a name="GTestFixtureFunc"></a><h3>GTestFixtureFunc ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                (*GTestFixtureFunc)                 (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> fixture</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="type">gconstpointer</span></a> user_data</code></em>);</pre>
<p>
The type used for functions that operate on test fixtures.  This is
used for the fixture setup and teardown functions as well as for the
testcases themselves.
</p>
<p>
<em class="parameter"><code>user_data</code></em> is a pointer to the data that was given when registering
the test case.
</p>
<p>
<em class="parameter"><code>fixture</code></em> will be a pointer to the area of memory allocated by the
test framework, of the size requested.  If the requested size was
zero then <em class="parameter"><code>fixture</code></em> will be equal to <em class="parameter"><code>user_data</code></em>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>fixture</code></em> :</span></p></td>
<td>the test fixture</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
<td>the data provided when registering the test</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.28</p>
</div>
<hr>
<div class="refsect2">
<a name="g-test-create-case"></a><h3>g_test_create_case ()</h3>
<pre class="programlisting"><a class="link" href="glib-Testing.html#GTestCase" title="GTestCase"><span class="returnvalue">GTestCase</span></a> *         g_test_create_case                  (<em class="parameter"><code>const <span class="type">char</span> *test_name</code></em>,
                                                         <em class="parameter"><code><span class="type">gsize</span> data_size</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gconstpointer" title="gconstpointer"><span class="type">gconstpointer</span></a> test_data</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Testing.html#GTestFixtureFunc" title="GTestFixtureFunc ()"><span class="type">GTestFixtureFunc</span></a> data_setup</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Testing.html#GTestFixtureFunc" title="GTestFixtureFunc ()"><span class="type">GTestFixtureFunc</span></a> data_test</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Testing.html#GTestFixtureFunc" title="GTestFixtureFunc ()"><span class="type">GTestFixtureFunc</span></a> data_teardown</code></em>);</pre>
<p>
Create a new <a class="link" href="glib-Testing.html#GTestCase" title="GTestCase"><span class="type">GTestCase</span></a>, named <em class="parameter"><code>test_name</code></em>, this API is fairly
low level, calling <a class="link" href="glib-Testing.html#g-test-add" title="g_test_add()"><code class="function">g_test_add()</code></a> or <a class="link" href="glib-Testing.html#g-test-add-func" title="g_test_add_func ()"><code class="function">g_test_add_func()</code></a> is preferable.
When this test is executed, a fixture structure of size <em class="parameter"><code>data_size</code></em>
will be allocated and filled with 0s. Then <em class="parameter"><code>data_setup</code></em> is called
to initialize the fixture. After fixture setup, the actual test
function <em class="parameter"><code>data_test</code></em> is called. Once the test run completed, the
fixture structure is torn down  by calling <em class="parameter"><code>data_teardown</code></em> and
after that the memory is released.
</p>
<p>
Splitting up a test run into fixture setup, test function and
fixture teardown is most usful if the same fixture is used for
multiple tests. In this cases, <a class="link" href="glib-Testing.html#g-test-create-case" title="g_test_create_case ()"><code class="function">g_test_create_case()</code></a> will be
called with the same fixture, but varying <em class="parameter"><code>test_name</code></em> and
<em class="parameter"><code>data_test</code></em> arguments.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>test_name</code></em> :</span></p></td>
<td>the name for the test case</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>data_size</code></em> :</span></p></td>
<td>the size of the fixture data structure</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>test_data</code></em> :</span></p></td>
<td>test data argument for the test functions</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>data_setup</code></em> :</span></p></td>
<td>the function to set up the fixture data</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>data_test</code></em> :</span></p></td>
<td>the actual test function</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>data_teardown</code></em> :</span></p></td>
<td>the function to teardown the fixture data</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>a newly allocated <a class="link" href="glib-Testing.html#GTestCase" title="GTestCase"><span class="type">GTestCase</span></a>.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.16</p>
</div>
<hr>
<div class="refsect2">
<a name="g-test-create-suite"></a><h3>g_test_create_suite ()</h3>
<pre class="programlisting"><a class="link" href="glib-Testing.html#GTestSuite" title="GTestSuite"><span class="returnvalue">GTestSuite</span></a> *        g_test_create_suite                 (<em class="parameter"><code>const <span class="type">char</span> *suite_name</code></em>);</pre>
<p>
Create a new test suite with the name <em class="parameter"><code>suite_name</code></em>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>suite_name</code></em> :</span></p></td>
<td>a name for the suite</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>A newly allocated <a class="link" href="glib-Testing.html#GTestSuite" title="GTestSuite"><span class="type">GTestSuite</span></a> instance.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.16</p>
</div>
<hr>
<div class="refsect2">
<a name="g-test-get-root"></a><h3>g_test_get_root ()</h3>
<pre class="programlisting"><a class="link" href="glib-Testing.html#GTestSuite" title="GTestSuite"><span class="returnvalue">GTestSuite</span></a> *        g_test_get_root                     (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
<p>
Get the toplevel test suite for the test path API.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>the toplevel <a class="link" href="glib-Testing.html#GTestSuite" title="GTestSuite"><span class="type">GTestSuite</span></a>
</td>
</tr></tbody>
</table></div>
<p class="since">Since 2.16</p>
</div>
<hr>
<div class="refsect2">
<a name="g-test-suite-add"></a><h3>g_test_suite_add ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_test_suite_add                    (<em class="parameter"><code><a class="link" href="glib-Testing.html#GTestSuite" title="GTestSuite"><span class="type">GTestSuite</span></a> *suite</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Testing.html#GTestCase" title="GTestCase"><span class="type">GTestCase</span></a> *test_case</code></em>);</pre>
<p>
Adds <em class="parameter"><code>test_case</code></em> to <em class="parameter"><code>suite</code></em>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>suite</code></em> :</span></p></td>
<td>a <a class="link" href="glib-Testing.html#GTestSuite" title="GTestSuite"><span class="type">GTestSuite</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>test_case</code></em> :</span></p></td>
<td>a <a class="link" href="glib-Testing.html#GTestCase" title="GTestCase"><span class="type">GTestCase</span></a>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.16</p>
</div>
<hr>
<div class="refsect2">
<a name="g-test-suite-add-suite"></a><h3>g_test_suite_add_suite ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                g_test_suite_add_suite              (<em class="parameter"><code><a class="link" href="glib-Testing.html#GTestSuite" title="GTestSuite"><span class="type">GTestSuite</span></a> *suite</code></em>,
                                                         <em class="parameter"><code><a class="link" href="glib-Testing.html#GTestSuite" title="GTestSuite"><span class="type">GTestSuite</span></a> *nestedsuite</code></em>);</pre>
<p>
Adds <em class="parameter"><code>nestedsuite</code></em> to <em class="parameter"><code>suite</code></em>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>suite</code></em> :</span></p></td>
<td>a <a class="link" href="glib-Testing.html#GTestSuite" title="GTestSuite"><span class="type">GTestSuite</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>nestedsuite</code></em> :</span></p></td>
<td>another <a class="link" href="glib-Testing.html#GTestSuite" title="GTestSuite"><span class="type">GTestSuite</span></a>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.16</p>
</div>
<hr>
<div class="refsect2">
<a name="g-test-run-suite"></a><h3>g_test_run_suite ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span>                 g_test_run_suite                    (<em class="parameter"><code><a class="link" href="glib-Testing.html#GTestSuite" title="GTestSuite"><span class="type">GTestSuite</span></a> *suite</code></em>);</pre>
<p>
Execute the tests within <em class="parameter"><code>suite</code></em> and all nested <a href="glib-Testing.html#GTestSuite"><span class="type">GTestSuites</span></a>.
The test suites to be executed are filtered according to
test path arguments (-p <em class="replaceable"><code>testpath</code></em>) 
as parsed by <a class="link" href="glib-Testing.html#g-test-init" title="g_test_init ()"><code class="function">g_test_init()</code></a>.
<a class="link" href="glib-Testing.html#g-test-run-suite" title="g_test_run_suite ()"><code class="function">g_test_run_suite()</code></a> or <a class="link" href="glib-Testing.html#g-test-run" title="g_test_run ()"><code class="function">g_test_run()</code></a> may only be called once
in a program.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>suite</code></em> :</span></p></td>
<td>a <a class="link" href="glib-Testing.html#GTestSuite" title="GTestSuite"><span class="type">GTestSuite</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>0 on success</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.16</p>
</div>
</div>
<div class="refsect1">
<a name="glib-Testing.see-also"></a><h2>See Also</h2>
<a href="gtester.html">gtester</a>,
           <a href="gtester-report.html">gtester-report</a>
</div>
</div>
<div class="footer">
<hr>
          Generated by GTK-Doc V1.18</div>
</body>
</html>