• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
4<title>random</title>
5<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
6<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
7<link rel="home" href="../../../index.html" title="Boost.Test">
8<link rel="up" href="../rt_param_reference.html" title="Runtime parameters reference">
9<link rel="prev" href="output_format.html" title="output_format">
10<link rel="next" href="report_format.html" title="report_format">
11</head>
12<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
13<table cellpadding="2" width="100%"><tr>
14<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
15<td align="center"><a href="../../../../../../../index.html">Home</a></td>
16<td align="center"><a href="../../../../../../../libs/libraries.htm">Libraries</a></td>
17<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
18<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
19<td align="center"><a href="../../../../../../../more/index.htm">More</a></td>
20</tr></table>
21<hr>
22<div class="spirit-nav">
23<a accesskey="p" href="output_format.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../rt_param_reference.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="report_format.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
24</div>
25<div class="section">
26<div class="titlepage"><div><div><h4 class="title">
27<a name="boost_test.utf_reference.rt_param_reference.random"></a><a class="link" href="random.html" title="random"><code class="computeroutput"><span class="identifier">random</span></code></a>
28</h4></div></div></div>
29<p>
30          Parameter <span class="emphasis"><em>random</em></span> instructs the <span class="emphasis"><em>Unit Test
31          Framework</em></span> to execute the test cases in random order. This parameter
32          accepts an optional <code class="computeroutput"><span class="keyword">unsigned</span> <span class="identifier">integer</span></code> argument for the seed of the
33          random generator:
34        </p>
35<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
36<li class="listitem">
37              By default (value <code class="computeroutput"><span class="number">0</span></code>), the
38              test cases are executed in some specific order defined by the order
39              of test units in the test files, and the dependencies between test
40              units.
41            </li>
42<li class="listitem">
43              If the parameter is specified without the argument value, or with value
44              <code class="computeroutput"><span class="number">1</span></code>, the testing order is
45              randomized based on current time.
46            </li>
47<li class="listitem">
48              Alternatively, any positive value greater than <code class="computeroutput"><span class="number">1</span></code>
49              will be used as random seed for the run.
50            </li>
51</ul></div>
52<div class="tip"><table border="0" summary="Tip">
53<tr>
54<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="../../../../../../../doc/src/images/tip.png"></td>
55<th align="left">Tip</th>
56</tr>
57<tr><td align="left" valign="top"><p>
58            in case <code class="computeroutput"><span class="special">--</span><span class="identifier">random</span></code>
59            is specified, the value of the seed is logged using <a class="link" href="../testout_reference/test_output_macro_message.html" title="BOOST_TEST_MESSAGE"><code class="computeroutput"><span class="identifier">BOOST_TEST_MESSAGE</span></code></a>, so that
60            it is possible to replay exactly the same sequence of unit test in case
61            of failure. For the seed to be visible in the logs, make sure the proper
62            <a class="link" href="log_level.html" title="log_level"><code class="computeroutput"><span class="special">--</span><span class="identifier">log_level</span></code></a>
63            is set.
64          </p></td></tr>
65</table></div>
66<h5>
67<a name="boost_test.utf_reference.rt_param_reference.random.h0"></a>
68          <span class="phrase"><a name="boost_test.utf_reference.rt_param_reference.random.acceptable_values"></a></span><a class="link" href="random.html#boost_test.utf_reference.rt_param_reference.random.acceptable_values">Acceptable
69          values</a>
70        </h5>
71<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
72<li class="listitem">
73              <span class="bold"><strong>0</strong></span> (default): no randomization
74            </li>
75<li class="listitem">
76              <code class="computeroutput"><span class="number">1</span></code>: random seed based on
77              the current time
78            </li>
79<li class="listitem">
80              <a class="link" href="../rt_param_reference.html#regular_param_value">integer</a> <code class="computeroutput"><span class="identifier">value</span>
81              <span class="special">&gt;</span> <span class="number">1</span></code>
82              : seed for the random number generator
83            </li>
84</ul></div>
85<h5>
86<a name="boost_test.utf_reference.rt_param_reference.random.h1"></a>
87          <span class="phrase"><a name="boost_test.utf_reference.rt_param_reference.random.command_line_syntax"></a></span><a class="link" href="random.html#boost_test.utf_reference.rt_param_reference.random.command_line_syntax">Command
88          line syntax</a>
89        </h5>
90<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
91              <code class="computeroutput"><span class="special">--</span><span class="identifier">random</span><span class="special">=&lt;</span><span class="identifier">seed</span><span class="special">&gt;</span></code>
92            </li></ul></div>
93<h5>
94<a name="boost_test.utf_reference.rt_param_reference.random.h2"></a>
95          <span class="phrase"><a name="boost_test.utf_reference.rt_param_reference.random.environment_variable"></a></span><a class="link" href="random.html#boost_test.utf_reference.rt_param_reference.random.environment_variable">Environment
96          variable</a>
97        </h5>
98<pre class="programlisting"><span class="identifier">BOOST_TEST_RANDOM</span>
99</pre>
100</div>
101<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
102<td align="left"></td>
103<td align="right"><div class="copyright-footer">Copyright © 2001-2020 Boost.Test contributors<p>
104        Distributed under the Boost Software License, Version 1.0. (See accompanying
105        file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
106      </p>
107</div></td>
108</tr></table>
109<hr>
110<div class="spirit-nav">
111<a accesskey="p" href="output_format.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../rt_param_reference.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="report_format.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
112</div>
113</body>
114</html>
115