1<html> 2<head> 3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 4<title>BOOST_DATA_TEST_CASE_F</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="../test_org_reference.html" title="Tests declaration and organization"> 9<link rel="prev" href="test_org_boost_test_dataset.html" title="BOOST_DATA_TEST_CASE"> 10<link rel="next" href="test_org_boost_test_suite.html" title="BOOST_TEST_SUITE"> 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="test_org_boost_test_dataset.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../test_org_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="test_org_boost_test_suite.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.test_org_reference.test_org_boost_test_dataset_fixture"></a><a class="link" href="test_org_boost_test_dataset_fixture.html" title="BOOST_DATA_TEST_CASE_F"><code class="computeroutput"><span class="identifier">BOOST_DATA_TEST_CASE_F</span></code></a> 28</h4></div></div></div> 29<p> 30 Declares and registers a data-driven test case, using a particular dataset 31 and a fixture. This is basically the same as <a class="link" href="test_org_boost_test_dataset.html" title="BOOST_DATA_TEST_CASE"><code class="computeroutput"><span class="identifier">BOOST_DATA_TEST_CASE</span></code></a> with fixture 32 support added. 33 </p> 34<pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">my_fixture</span> <span class="special">{</span> 35 <span class="identifier">my_fixture</span><span class="special">()</span> <span class="special">:</span> <span class="identifier">some_string</span><span class="special">(</span><span class="string">"environment X"</span><span class="special">)</span> <span class="special">{</span> 36 <span class="special">}</span> 37 <span class="identifier">std</span><span class="special">::</span><span class="identifier">string</span> <span class="identifier">some_string</span><span class="special">;</span> 38<span class="special">};</span> 39 40<span class="identifier">BOOST_DATA_TEST_CASE_F</span><span class="special">(</span><span class="identifier">my_fixture</span><span class="special">,</span> <span class="identifier">test_case_name</span><span class="special">,</span> <span class="identifier">dataset</span><span class="special">,</span> <span class="identifier">var1</span><span class="special">,</span> <span class="identifier">var2</span><span class="special">...,</span> <span class="identifier">varN</span><span class="special">)</span> 41<span class="special">{</span> 42 <span class="identifier">BOOST_TEST</span><span class="special">(</span><span class="identifier">var1</span> <span class="special">!=</span> <span class="number">0</span><span class="special">);</span> 43 <span class="comment">//...</span> 44 <span class="identifier">BOOST_TEST</span><span class="special">(</span><span class="identifier">varN</span> <span class="special">!=</span> <span class="number">0</span><span class="special">);</span> 45<span class="special">}</span> 46</pre> 47<p> 48 The fixture should implement the appropriate <a class="link" href="../../tests_organization/fixtures/models.html" title="Fixture models">interface</a>. 49 As any fixture, it is possible to have test assertions in the fixture class. 50 </p> 51<p> 52 See <a class="link" href="../../tests_organization/fixtures/case.html" title="Test case fixture">here</a> 53 for more details on fixtures and <a class="link" href="../../tests_organization/test_cases/test_case_generation/datasets_auto_registration.html" title="Declaring and registering test cases with datasets">here</a> 54 for more details on datasets declaration. 55 </p> 56</div> 57<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> 58<td align="left"></td> 59<td align="right"><div class="copyright-footer">Copyright © 2001-2020 Boost.Test contributors<p> 60 Distributed under the Boost Software License, Version 1.0. (See accompanying 61 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>) 62 </p> 63</div></td> 64</tr></table> 65<hr> 66<div class="spirit-nav"> 67<a accesskey="p" href="test_org_boost_test_dataset.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../test_org_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="test_org_boost_test_suite.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a> 68</div> 69</body> 70</html> 71