• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<?xml version="1.0" encoding="UTF-8"?>
2<!DOCTYPE article PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN" "http://www.boost.org/tools/boostbook/dtd/boostbook.dtd">
3<article id="callout_tests" last-revision="DEBUG MODE Date: 2000/12/20 12:00:00 $"
4 xmlns:xi="http://www.w3.org/2001/XInclude">
5  <title>Callout Tests</title>
6  <para>
7    Example 1:
8  </para>
9  <para>
10    Now we can define a function that simulates an ordinary six-sided die.
11  </para>
12<programlisting><phrase role="keyword">int</phrase> <phrase role="identifier">roll_die</phrase><phrase role="special">()</phrase> <phrase role="special">{</phrase>
13  <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">uniform_int</phrase><phrase role="special">&lt;&gt;</phrase> <phrase role="identifier">dist</phrase><phrase role="special">(</phrase><phrase role="number">1</phrase><phrase role="special">,</phrase> <phrase role="number">6</phrase><phrase role="special">);</phrase> <co id="callout_tests.c0" linkends="callout_tests.c1" />
14<phrase role="special">}</phrase>
15</programlisting>
16  <calloutlist>
17    <callout arearefs="callout_tests.c0" id="callout_tests.c1">
18      <para>
19        create a uniform_int distribution
20      </para>
21    </callout>
22  </calloutlist>
23  <para>
24    Example 2:
25  </para>
26<programlisting><phrase role="keyword">int</phrase> <phrase role="identifier">roll_die</phrase><phrase role="special">()</phrase> <phrase role="special">{</phrase>
27  <co id="callout_tests.c2" linkends="callout_tests.c3" /><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">variate_generator</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">mt19937</phrase><phrase role="special">&amp;,</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">uniform_int</phrase><phrase role="special">&lt;&gt;</phrase> <phrase role="special">&gt;</phrase> <phrase role="identifier">die</phrase><phrase role="special">(</phrase><phrase role="identifier">gen</phrase><phrase role="special">,</phrase> <phrase role="identifier">dist</phrase><phrase role="special">);</phrase>
28<phrase role="special">}</phrase>
29</programlisting>
30  <calloutlist>
31    <callout arearefs="callout_tests.c2" id="callout_tests.c3">
32      <important>
33        <para>
34          test
35        </para>
36      </important>
37    </callout>
38  </calloutlist>
39  <para>
40    Example 3:
41  </para>
42<programlisting><phrase role="keyword">int</phrase> <phrase role="identifier">roll_die</phrase><phrase role="special">()</phrase> <phrase role="special">{</phrase>
43  <co id="callout_tests.c4" linkends="callout_tests.c5" /><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">variate_generator</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">mt19937</phrase><phrase role="special">&amp;,</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">uniform_int</phrase><phrase role="special">&lt;&gt;</phrase> <phrase role="special">&gt;</phrase> <phrase role="identifier">die</phrase><phrase role="special">(</phrase><phrase role="identifier">gen</phrase><phrase role="special">,</phrase> <phrase role="identifier">dist</phrase><phrase role="special">);</phrase>
44<phrase role="special">}</phrase>
45</programlisting>
46  <calloutlist>
47    <callout arearefs="callout_tests.c4" id="callout_tests.c5">
48      <important>
49        <para>
50          test
51        </para>
52      </important>
53    </callout>
54  </calloutlist>
55  <para>
56    Example 3 (again!):
57  </para>
58<programlisting><phrase role="keyword">int</phrase> <phrase role="identifier">roll_die</phrase><phrase role="special">()</phrase> <phrase role="special">{</phrase>
59  <co id="callout_tests.c6" linkends="callout_tests.c7" /><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">variate_generator</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">mt19937</phrase><phrase role="special">&amp;,</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">uniform_int</phrase><phrase role="special">&lt;&gt;</phrase> <phrase role="special">&gt;</phrase> <phrase role="identifier">die</phrase><phrase role="special">(</phrase><phrase role="identifier">gen</phrase><phrase role="special">,</phrase> <phrase role="identifier">dist</phrase><phrase role="special">);</phrase>
60<phrase role="special">}</phrase>
61</programlisting>
62  <calloutlist>
63    <callout arearefs="callout_tests.c6" id="callout_tests.c7">
64      <important>
65        <para>
66          test
67        </para>
68      </important>
69    </callout>
70  </calloutlist>
71  <para>
72    Example 4:
73  </para>
74<programlisting><phrase role="keyword">int</phrase> <phrase role="identifier">roll_die</phrase><phrase role="special">()</phrase> <phrase role="special">{</phrase>
75  <co id="callout_tests.c8" linkends="callout_tests.c9" /><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">variate_generator</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">mt19937</phrase><phrase role="special">&amp;,</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">uniform_int</phrase><phrase role="special">&lt;&gt;</phrase> <phrase role="special">&gt;</phrase> <phrase role="identifier">die</phrase><phrase role="special">(</phrase><phrase role="identifier">gen</phrase><phrase role="special">,</phrase> <phrase role="identifier">dist</phrase><phrase role="special">);</phrase>
76  <co id="callout_tests.c10" linkends="callout_tests.c11" /><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">uniform_int</phrase><phrase role="special">&lt;&gt;</phrase> <phrase role="identifier">dist</phrase><phrase role="special">(</phrase><phrase role="number">1</phrase><phrase role="special">,</phrase> <phrase role="number">6</phrase><phrase role="special">);</phrase> <co id="callout_tests.c12" linkends="callout_tests.c13" />
77<phrase role="special">}</phrase>
78</programlisting>
79  <calloutlist>
80    <callout arearefs="callout_tests.c8" id="callout_tests.c9">
81      <para>
82        callout 1
83      </para>
84    </callout>
85    <callout arearefs="callout_tests.c10" id="callout_tests.c11">
86      <para>
87        callout 2
88      </para>
89    </callout>
90    <callout arearefs="callout_tests.c12" id="callout_tests.c13">
91      <para>
92        create a uniform_int distribution
93      </para>
94    </callout>
95  </calloutlist>
96<programlisting><co id="callout_tests.c14" linkends="callout_tests.c15" /><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">uniform_int</phrase><phrase role="special">&lt;&gt;</phrase> <phrase role="identifier">dist</phrase><phrase role="special">(</phrase><phrase role="number">1</phrase><phrase role="special">,</phrase> <phrase role="number">6</phrase><phrase role="special">);</phrase> <co id="callout_tests.c16" linkends="callout_tests.c17" />
97</programlisting>
98  <calloutlist>
99    <callout arearefs="callout_tests.c14" id="callout_tests.c15">
100      <para>
101        callout 2
102      </para>
103    </callout>
104    <callout arearefs="callout_tests.c16" id="callout_tests.c17">
105      <para>
106        create a uniform_int distribution
107      </para>
108    </callout>
109  </calloutlist>
110  <section id="callout_tests.test_section">
111    <title><link linkend="callout_tests.test_section">Try callouts in a section</link></title>
112    <para>
113      Example 1:
114    </para>
115    <para>
116      Now we can define a function that simulates an ordinary six-sided die.
117    </para>
118<programlisting><phrase role="keyword">int</phrase> <phrase role="identifier">roll_die</phrase><phrase role="special">()</phrase> <phrase role="special">{</phrase>
119  <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">uniform_int</phrase><phrase role="special">&lt;&gt;</phrase> <phrase role="identifier">dist</phrase><phrase role="special">(</phrase><phrase role="number">1</phrase><phrase role="special">,</phrase> <phrase role="number">6</phrase><phrase role="special">);</phrase> <co id="callout_tests.test_section.c0" linkends="callout_tests.test_section.c1" />
120<phrase role="special">}</phrase>
121</programlisting>
122    <calloutlist>
123      <callout arearefs="callout_tests.test_section.c0" id="callout_tests.test_section.c1">
124        <para>
125          create a uniform_int distribution
126        </para>
127      </callout>
128    </calloutlist>
129    <para>
130      Example 2:
131    </para>
132<programlisting><phrase role="keyword">int</phrase> <phrase role="identifier">roll_die</phrase><phrase role="special">()</phrase> <phrase role="special">{</phrase>
133  <co id="callout_tests.test_section.c2" linkends="callout_tests.test_section.c3" /><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">variate_generator</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">mt19937</phrase><phrase role="special">&amp;,</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">uniform_int</phrase><phrase role="special">&lt;&gt;</phrase> <phrase role="special">&gt;</phrase> <phrase role="identifier">die</phrase><phrase role="special">(</phrase><phrase role="identifier">gen</phrase><phrase role="special">,</phrase> <phrase role="identifier">dist</phrase><phrase role="special">);</phrase>
134<phrase role="special">}</phrase>
135</programlisting>
136    <calloutlist>
137      <callout arearefs="callout_tests.test_section.c2" id="callout_tests.test_section.c3">
138        <important>
139          <para>
140            test
141          </para>
142        </important>
143      </callout>
144    </calloutlist>
145    <para>
146      Example 3:
147    </para>
148<programlisting><phrase role="keyword">int</phrase> <phrase role="identifier">roll_die</phrase><phrase role="special">()</phrase> <phrase role="special">{</phrase>
149  <co id="callout_tests.test_section.c4" linkends="callout_tests.test_section.c5" /><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">variate_generator</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">mt19937</phrase><phrase role="special">&amp;,</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">uniform_int</phrase><phrase role="special">&lt;&gt;</phrase> <phrase role="special">&gt;</phrase> <phrase role="identifier">die</phrase><phrase role="special">(</phrase><phrase role="identifier">gen</phrase><phrase role="special">,</phrase> <phrase role="identifier">dist</phrase><phrase role="special">);</phrase>
150<phrase role="special">}</phrase>
151</programlisting>
152    <calloutlist>
153      <callout arearefs="callout_tests.test_section.c4" id="callout_tests.test_section.c5">
154        <important>
155          <para>
156            test
157          </para>
158        </important>
159      </callout>
160    </calloutlist>
161    <para>
162      Example 3 (again!):
163    </para>
164<programlisting><phrase role="keyword">int</phrase> <phrase role="identifier">roll_die</phrase><phrase role="special">()</phrase> <phrase role="special">{</phrase>
165  <co id="callout_tests.test_section.c6" linkends="callout_tests.test_section.c7" /><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">variate_generator</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">mt19937</phrase><phrase role="special">&amp;,</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">uniform_int</phrase><phrase role="special">&lt;&gt;</phrase> <phrase role="special">&gt;</phrase> <phrase role="identifier">die</phrase><phrase role="special">(</phrase><phrase role="identifier">gen</phrase><phrase role="special">,</phrase> <phrase role="identifier">dist</phrase><phrase role="special">);</phrase>
166<phrase role="special">}</phrase>
167</programlisting>
168    <calloutlist>
169      <callout arearefs="callout_tests.test_section.c6" id="callout_tests.test_section.c7">
170        <important>
171          <para>
172            test
173          </para>
174        </important>
175      </callout>
176    </calloutlist>
177    <para>
178      Example 4:
179    </para>
180<programlisting><phrase role="keyword">int</phrase> <phrase role="identifier">roll_die</phrase><phrase role="special">()</phrase> <phrase role="special">{</phrase>
181  <co id="callout_tests.test_section.c8" linkends="callout_tests.test_section.c9" /><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">variate_generator</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">mt19937</phrase><phrase role="special">&amp;,</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">uniform_int</phrase><phrase role="special">&lt;&gt;</phrase> <phrase role="special">&gt;</phrase> <phrase role="identifier">die</phrase><phrase role="special">(</phrase><phrase role="identifier">gen</phrase><phrase role="special">,</phrase> <phrase role="identifier">dist</phrase><phrase role="special">);</phrase>
182  <co id="callout_tests.test_section.c10" linkends="callout_tests.test_section.c11" /><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">uniform_int</phrase><phrase role="special">&lt;&gt;</phrase> <phrase role="identifier">dist</phrase><phrase role="special">(</phrase><phrase role="number">1</phrase><phrase role="special">,</phrase> <phrase role="number">6</phrase><phrase role="special">);</phrase> <co id="callout_tests.test_section.c12" linkends="callout_tests.test_section.c13" />
183<phrase role="special">}</phrase>
184</programlisting>
185    <calloutlist>
186      <callout arearefs="callout_tests.test_section.c8" id="callout_tests.test_section.c9">
187        <para>
188          callout 1
189        </para>
190      </callout>
191      <callout arearefs="callout_tests.test_section.c10" id="callout_tests.test_section.c11">
192        <para>
193          callout 2
194        </para>
195      </callout>
196      <callout arearefs="callout_tests.test_section.c12" id="callout_tests.test_section.c13">
197        <para>
198          create a uniform_int distribution
199        </para>
200      </callout>
201    </calloutlist>
202<programlisting><co id="callout_tests.test_section.c14" linkends="callout_tests.test_section.c15" /><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">uniform_int</phrase><phrase role="special">&lt;&gt;</phrase> <phrase role="identifier">dist</phrase><phrase role="special">(</phrase><phrase role="number">1</phrase><phrase role="special">,</phrase> <phrase role="number">6</phrase><phrase role="special">);</phrase> <co id="callout_tests.test_section.c16" linkends="callout_tests.test_section.c17" />
203</programlisting>
204    <calloutlist>
205      <callout arearefs="callout_tests.test_section.c14" id="callout_tests.test_section.c15">
206        <para>
207          callout 2
208        </para>
209      </callout>
210      <callout arearefs="callout_tests.test_section.c16" id="callout_tests.test_section.c17">
211        <para>
212          create a uniform_int distribution
213        </para>
214      </callout>
215    </calloutlist>
216  </section>
217  <section id="callout_tests.blocks">
218    <title><link linkend="callout_tests.blocks">Callouts in code blocks</link></title>
219<programlisting><phrase role="keyword">int</phrase> <phrase role="identifier">roll_die</phrase><phrase role="special">()</phrase> <phrase role="special">{</phrase>
220  <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">uniform_int</phrase><phrase role="special">&lt;&gt;</phrase> <phrase role="identifier">dist</phrase><phrase role="special">(</phrase><phrase role="number">1</phrase><phrase role="special">,</phrase> <phrase role="number">6</phrase><phrase role="special">);</phrase> <co id="callout_tests.blocks.c0" linkends="callout_tests.blocks.c1" />
221<phrase role="special">}</phrase>
222</programlisting>
223    <calloutlist>
224      <callout arearefs="callout_tests.blocks.c0" id="callout_tests.blocks.c1">
225        <para>
226          create a uniform_int distribution
227        </para>
228      </callout>
229    </calloutlist>
230<programlisting><phrase role="keyword">int</phrase> <phrase role="identifier">roll_die</phrase><phrase role="special">()</phrase> <phrase role="special">{</phrase>
231  <co id="callout_tests.blocks.c2" linkends="callout_tests.blocks.c3" /><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">variate_generator</phrase><phrase role="special">&lt;</phrase><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">mt19937</phrase><phrase role="special">&amp;,</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">uniform_int</phrase><phrase role="special">&lt;&gt;</phrase> <phrase role="special">&gt;</phrase> <phrase role="identifier">die</phrase><phrase role="special">(</phrase><phrase role="identifier">gen</phrase><phrase role="special">,</phrase> <phrase role="identifier">dist</phrase><phrase role="special">);</phrase>
232<phrase role="special">}</phrase>
233</programlisting>
234    <calloutlist>
235      <callout arearefs="callout_tests.blocks.c2" id="callout_tests.blocks.c3">
236        <important>
237          <para>
238            test
239          </para>
240        </important>
241      </callout>
242    </calloutlist>
243    <para>
244      <code><phrase role="comment">/*&lt; This shouldn't be a callout &gt;*/</phrase></code>
245    </para>
246    <para>Silly test<co linkends="silly-callout"/></para>
247<calloutlist><callout id="silly-callout"><para>silly</para></callout></calloutlist>
248  </section>
249</article>
250