1<!DOCTYPE html> 2<html> 3 <head></head> 4 <body> 5 <h3> 6 Callout Tests 7 </h3> 8 <div class="toc"> 9 <p> 10 <b>Table of contents</b> 11 </p> 12 <ul> 13 <li> 14 <a href="#callout_tests.test_section">Try callouts in a section</a> 15 </li> 16 </ul> 17 </div> 18 <p> 19 Example 1: 20 </p> 21 <p> 22 Now we can define a function that simulates an ordinary six-sided die. 23 </p> 24 <p> 25<pre class="programlisting"><span class="keyword">int</span> <span class="identifier">roll_die</span><span class="special">()</span> <span class="special">{</span> 26 <span class="identifier">boost</span><span class="special">::</span><span class="identifier">uniform_int</span><span class="special"><></span> <span class="identifier">dist</span><span class="special">(</span><span class="number">1</span><span class="special">,</span> <span class="number">6</span><span class="special">);</span> <a href="#callout_tests.c1">(1)</a> 27<span class="special">}</span> 28</pre> 29 </p> 30 <div> 31 <div id="callout_tests.c1"> 32 <a href="#callout_tests.c0">(1)</a> 33 <p> 34 create a uniform_int distribution 35 </p> 36 </div> 37 </div> 38 <p> 39 Example 2: 40 </p> 41 <p> 42<pre class="programlisting"><span class="keyword">int</span> <span class="identifier">roll_die</span><span class="special">()</span> <span class="special">{</span> 43 <a href="#callout_tests.c3">(1)</a><span class="identifier">boost</span><span class="special">::</span><span class="identifier">variate_generator</span><span class="special"><</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mt19937</span><span class="special">&,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">uniform_int</span><span class="special"><></span> <span class="special">></span> <span class="identifier">die</span><span class="special">(</span><span class="identifier">gen</span><span class="special">,</span> <span class="identifier">dist</span><span class="special">);</span> 44<span class="special">}</span> 45</pre> 46 </p> 47 <div> 48 <div id="callout_tests.c3"> 49 <a href="#callout_tests.c2">(1)</a> 50 <div class="important"> 51 <p> 52 test 53 </p> 54 </div> 55 </div> 56 </div> 57 <p> 58 Example 3: 59 </p> 60 <p> 61<pre class="programlisting"><span class="keyword">int</span> <span class="identifier">roll_die</span><span class="special">()</span> <span class="special">{</span> 62 <a href="#callout_tests.c5">(1)</a><span class="identifier">boost</span><span class="special">::</span><span class="identifier">variate_generator</span><span class="special"><</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mt19937</span><span class="special">&,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">uniform_int</span><span class="special"><></span> <span class="special">></span> <span class="identifier">die</span><span class="special">(</span><span class="identifier">gen</span><span class="special">,</span> <span class="identifier">dist</span><span class="special">);</span> 63<span class="special">}</span> 64</pre> 65 </p> 66 <div> 67 <div id="callout_tests.c5"> 68 <a href="#callout_tests.c4">(1)</a> 69 <div class="important"> 70 <p> 71 test 72 </p> 73 </div> 74 </div> 75 </div> 76 <p> 77 Example 3 (again!): 78 </p> 79 <p> 80<pre class="programlisting"><span class="keyword">int</span> <span class="identifier">roll_die</span><span class="special">()</span> <span class="special">{</span> 81 <a href="#callout_tests.c7">(1)</a><span class="identifier">boost</span><span class="special">::</span><span class="identifier">variate_generator</span><span class="special"><</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mt19937</span><span class="special">&,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">uniform_int</span><span class="special"><></span> <span class="special">></span> <span class="identifier">die</span><span class="special">(</span><span class="identifier">gen</span><span class="special">,</span> <span class="identifier">dist</span><span class="special">);</span> 82<span class="special">}</span> 83</pre> 84 </p> 85 <div> 86 <div id="callout_tests.c7"> 87 <a href="#callout_tests.c6">(1)</a> 88 <div class="important"> 89 <p> 90 test 91 </p> 92 </div> 93 </div> 94 </div> 95 <p> 96 Example 4: 97 </p> 98 <p> 99<pre class="programlisting"><span class="keyword">int</span> <span class="identifier">roll_die</span><span class="special">()</span> <span class="special">{</span> 100 <a href="#callout_tests.c9">(1)</a><span class="identifier">boost</span><span class="special">::</span><span class="identifier">variate_generator</span><span class="special"><</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mt19937</span><span class="special">&,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">uniform_int</span><span class="special"><></span> <span class="special">></span> <span class="identifier">die</span><span class="special">(</span><span class="identifier">gen</span><span class="special">,</span> <span class="identifier">dist</span><span class="special">);</span> 101 <a href="#callout_tests.c11">(2)</a><span class="identifier">boost</span><span class="special">::</span><span class="identifier">uniform_int</span><span class="special"><></span> <span class="identifier">dist</span><span class="special">(</span><span class="number">1</span><span class="special">,</span> <span class="number">6</span><span class="special">);</span> <a href="#callout_tests.c13">(3)</a> 102<span class="special">}</span> 103</pre> 104 </p> 105 <div> 106 <div id="callout_tests.c9"> 107 <a href="#callout_tests.c8">(1)</a> 108 <p> 109 callout 1 110 </p> 111 </div> 112 <div id="callout_tests.c11"> 113 <a href="#callout_tests.c10">(2)</a> 114 <p> 115 callout 2 116 </p> 117 </div> 118 <div id="callout_tests.c13"> 119 <a href="#callout_tests.c12">(3)</a> 120 <p> 121 create a uniform_int distribution 122 </p> 123 </div> 124 </div> 125 <p> 126<pre class="programlisting"><a href="#callout_tests.c15">(1)</a><span class="identifier">boost</span><span class="special">::</span><span class="identifier">uniform_int</span><span class="special"><></span> <span class="identifier">dist</span><span class="special">(</span><span class="number">1</span><span class="special">,</span> <span class="number">6</span><span class="special">);</span> <a href="#callout_tests.c17">(2)</a> 127</pre> 128 </p> 129 <div> 130 <div id="callout_tests.c15"> 131 <a href="#callout_tests.c14">(1)</a> 132 <p> 133 callout 2 134 </p> 135 </div> 136 <div id="callout_tests.c17"> 137 <a href="#callout_tests.c16">(2)</a> 138 <p> 139 create a uniform_int distribution 140 </p> 141 </div> 142 </div> 143 <div id="callout_tests.test_section"> 144 <h3> 145 Try callouts in a section 146 </h3> 147 <div id="callout_tests.test_section"> 148 <p> 149 Example 1: 150 </p> 151 <p> 152 Now we can define a function that simulates an ordinary six-sided die. 153 </p> 154 <p> 155<pre class="programlisting"><span class="keyword">int</span> <span class="identifier">roll_die</span><span class="special">()</span> <span class="special">{</span> 156 <span class="identifier">boost</span><span class="special">::</span><span class="identifier">uniform_int</span><span class="special"><></span> <span class="identifier">dist</span><span class="special">(</span><span class="number">1</span><span class="special">,</span> <span class="number">6</span><span class="special">);</span> <a href="#callout_tests.test_section.c1">(1)</a> 157<span class="special">}</span> 158</pre> 159 </p> 160 <div> 161 <div id="callout_tests.test_section.c1"> 162 <a href="#callout_tests.test_section.c0">(1)</a> 163 <p> 164 create a uniform_int distribution 165 </p> 166 </div> 167 </div> 168 <p> 169 Example 2: 170 </p> 171 <p> 172<pre class="programlisting"><span class="keyword">int</span> <span class="identifier">roll_die</span><span class="special">()</span> <span class="special">{</span> 173 <a href="#callout_tests.test_section.c3">(1)</a><span class="identifier">boost</span><span class="special">::</span><span class="identifier">variate_generator</span><span class="special"><</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mt19937</span><span class="special">&,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">uniform_int</span><span class="special"><></span> <span class="special">></span> <span class="identifier">die</span><span class="special">(</span><span class="identifier">gen</span><span class="special">,</span> <span class="identifier">dist</span><span class="special">);</span> 174<span class="special">}</span> 175</pre> 176 </p> 177 <div> 178 <div id="callout_tests.test_section.c3"> 179 <a href="#callout_tests.test_section.c2">(1)</a> 180 <div class="important"> 181 <p> 182 test 183 </p> 184 </div> 185 </div> 186 </div> 187 <p> 188 Example 3: 189 </p> 190 <p> 191<pre class="programlisting"><span class="keyword">int</span> <span class="identifier">roll_die</span><span class="special">()</span> <span class="special">{</span> 192 <a href="#callout_tests.test_section.c5">(1)</a><span class="identifier">boost</span><span class="special">::</span><span class="identifier">variate_generator</span><span class="special"><</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mt19937</span><span class="special">&,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">uniform_int</span><span class="special"><></span> <span class="special">></span> <span class="identifier">die</span><span class="special">(</span><span class="identifier">gen</span><span class="special">,</span> <span class="identifier">dist</span><span class="special">);</span> 193<span class="special">}</span> 194</pre> 195 </p> 196 <div> 197 <div id="callout_tests.test_section.c5"> 198 <a href="#callout_tests.test_section.c4">(1)</a> 199 <div class="important"> 200 <p> 201 test 202 </p> 203 </div> 204 </div> 205 </div> 206 <p> 207 Example 3 (again!): 208 </p> 209 <p> 210<pre class="programlisting"><span class="keyword">int</span> <span class="identifier">roll_die</span><span class="special">()</span> <span class="special">{</span> 211 <a href="#callout_tests.test_section.c7">(1)</a><span class="identifier">boost</span><span class="special">::</span><span class="identifier">variate_generator</span><span class="special"><</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mt19937</span><span class="special">&,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">uniform_int</span><span class="special"><></span> <span class="special">></span> <span class="identifier">die</span><span class="special">(</span><span class="identifier">gen</span><span class="special">,</span> <span class="identifier">dist</span><span class="special">);</span> 212<span class="special">}</span> 213</pre> 214 </p> 215 <div> 216 <div id="callout_tests.test_section.c7"> 217 <a href="#callout_tests.test_section.c6">(1)</a> 218 <div class="important"> 219 <p> 220 test 221 </p> 222 </div> 223 </div> 224 </div> 225 <p> 226 Example 4: 227 </p> 228 <p> 229<pre class="programlisting"><span class="keyword">int</span> <span class="identifier">roll_die</span><span class="special">()</span> <span class="special">{</span> 230 <a href="#callout_tests.test_section.c9">(1)</a><span class="identifier">boost</span><span class="special">::</span><span class="identifier">variate_generator</span><span class="special"><</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mt19937</span><span class="special">&,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">uniform_int</span><span class="special"><></span> <span class="special">></span> <span class="identifier">die</span><span class="special">(</span><span class="identifier">gen</span><span class="special">,</span> <span class="identifier">dist</span><span class="special">);</span> 231 <a href="#callout_tests.test_section.c11">(2)</a><span class="identifier">boost</span><span class="special">::</span><span class="identifier">uniform_int</span><span class="special"><></span> <span class="identifier">dist</span><span class="special">(</span><span class="number">1</span><span class="special">,</span> <span class="number">6</span><span class="special">);</span> <a href="#callout_tests.test_section.c13">(3)</a> 232<span class="special">}</span> 233</pre> 234 </p> 235 <div> 236 <div id="callout_tests.test_section.c9"> 237 <a href="#callout_tests.test_section.c8">(1)</a> 238 <p> 239 callout 1 240 </p> 241 </div> 242 <div id="callout_tests.test_section.c11"> 243 <a href="#callout_tests.test_section.c10">(2)</a> 244 <p> 245 callout 2 246 </p> 247 </div> 248 <div id="callout_tests.test_section.c13"> 249 <a href="#callout_tests.test_section.c12">(3)</a> 250 <p> 251 create a uniform_int distribution 252 </p> 253 </div> 254 </div> 255 <p> 256<pre class="programlisting"><a href="#callout_tests.test_section.c15">(1)</a><span class="identifier">boost</span><span class="special">::</span><span class="identifier">uniform_int</span><span class="special"><></span> <span class="identifier">dist</span><span class="special">(</span><span class="number">1</span><span class="special">,</span> <span class="number">6</span><span class="special">);</span> <a href="#callout_tests.test_section.c17">(2)</a> 257</pre> 258 </p> 259 <div> 260 <div id="callout_tests.test_section.c15"> 261 <a href="#callout_tests.test_section.c14">(1)</a> 262 <p> 263 callout 2 264 </p> 265 </div> 266 <div id="callout_tests.test_section.c17"> 267 <a href="#callout_tests.test_section.c16">(2)</a> 268 <p> 269 create a uniform_int distribution 270 </p> 271 </div> 272 </div> 273 </div> 274 </div> 275 </body> 276</html> 277