Micro template library A library for building device drivers
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

121 lines
17 KiB

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
  5. <meta http-equiv="X-UA-Compatible" content="IE=9"/>
  6. <meta name="generator" content="Doxygen 1.8.14"/>
  7. <meta name="viewport" content="width=device-width, initial-scale=1"/>
  8. <title>uTL: test/tests/test_1w_impl.cpp Source File</title>
  9. <link href="tabs.css" rel="stylesheet" type="text/css"/>
  10. <script type="text/javascript" src="jquery.js"></script>
  11. <script type="text/javascript" src="dynsections.js"></script>
  12. <link href="navtree.css" rel="stylesheet" type="text/css"/>
  13. <script type="text/javascript" src="resize.js"></script>
  14. <script type="text/javascript" src="navtreedata.js"></script>
  15. <script type="text/javascript" src="navtree.js"></script>
  16. <script type="text/javascript">
  17. /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
  18. $(document).ready(initResizable);
  19. /* @license-end */</script>
  20. <link href="search/search.css" rel="stylesheet" type="text/css"/>
  21. <script type="text/javascript" src="search/searchdata.js"></script>
  22. <script type="text/javascript" src="search/search.js"></script>
  23. <link href="doxygen.css" rel="stylesheet" type="text/css" />
  24. </head>
  25. <body>
  26. <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
  27. <div id="titlearea">
  28. <table cellspacing="0" cellpadding="0">
  29. <tbody>
  30. <tr style="height: 56px;">
  31. <td id="projectalign" style="padding-left: 0.5em;">
  32. <div id="projectname">uTL
  33. </div>
  34. <div id="projectbrief">micro Template library</div>
  35. </td>
  36. </tr>
  37. </tbody>
  38. </table>
  39. </div>
  40. <!-- end header part -->
  41. <!-- Generated by Doxygen 1.8.14 -->
  42. <script type="text/javascript">
  43. /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
  44. var searchBox = new SearchBox("searchBox", "search",false,'Search');
  45. /* @license-end */
  46. </script>
  47. <script type="text/javascript" src="menudata.js"></script>
  48. <script type="text/javascript" src="menu.js"></script>
  49. <script type="text/javascript">
  50. /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
  51. $(function() {
  52. initMenu('',true,false,'search.php','Search');
  53. $(document).ready(function() { init_search(); });
  54. });
  55. /* @license-end */</script>
  56. <div id="main-nav"></div>
  57. </div><!-- top -->
  58. <div id="side-nav" class="ui-resizable side-nav-resizable">
  59. <div id="nav-tree">
  60. <div id="nav-tree-contents">
  61. <div id="nav-sync" class="sync"></div>
  62. </div>
  63. </div>
  64. <div id="splitbar" style="-moz-user-select:none;"
  65. class="ui-resizable-handle">
  66. </div>
  67. </div>
  68. <script type="text/javascript">
  69. /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
  70. $(document).ready(function(){initNavTree('test__1w__impl_8cpp_source.html','');});
  71. /* @license-end */
  72. </script>
  73. <div id="doc-content">
  74. <!-- window showing the filter options -->
  75. <div id="MSearchSelectWindow"
  76. onmouseover="return searchBox.OnSearchSelectShow()"
  77. onmouseout="return searchBox.OnSearchSelectHide()"
  78. onkeydown="return searchBox.OnSearchSelectKey(event)">
  79. </div>
  80. <!-- iframe showing the search results (closed by default) -->
  81. <div id="MSearchResultsWindow">
  82. <iframe src="javascript:void(0)" frameborder="0"
  83. name="MSearchResults" id="MSearchResults">
  84. </iframe>
  85. </div>
  86. <div class="header">
  87. <div class="headertitle">
  88. <div class="title">test_1w_impl.cpp</div> </div>
  89. </div><!--header-->
  90. <div class="contents">
  91. <a href="test__1w__impl_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span>&#160;</div><div class="line"><a name="l00020"></a><span class="lineno"> 20</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="gtest_8h.html">gtest/gtest.h</a>&gt;</span></div><div class="line"><a name="l00021"></a><span class="lineno"> 21</span>&#160;<span class="preprocessor">#include &lt;<a class="code" href="__1wire__uart_8h.html">utl/com/_1wire_uart.h</a>&gt;</span></div><div class="line"><a name="l00022"></a><span class="lineno"> 22</span>&#160;</div><div class="line"><a name="l00029"></a><span class="lineno"><a class="line" href="namespacetest__1w.html"> 29</a></span>&#160;<span class="keyword">namespace </span><a class="code" href="namespacetest__1w.html">test_1w</a> {</div><div class="line"><a name="l00030"></a><span class="lineno"> 30</span>&#160; <span class="keyword">using namespace </span><a class="code" href="namespaceutl.html">utl</a>;</div><div class="line"><a name="l00031"></a><span class="lineno"> 31</span>&#160;</div><div class="line"><a name="l00032"></a><span class="lineno"> 32</span>&#160; <span class="comment">// implementer class stub</span></div><div class="line"><a name="l00033"></a><span class="lineno"><a class="line" href="classtest__1w_1_1_o_w.html"> 33</a></span>&#160; <span class="keyword">class </span><a class="code" href="classtest__1w_1_1_o_w.html">OW</a> : <span class="keyword">public</span> <a class="code" href="classutl_1_1__1wire__uart__i.html">_1wire_uart_i</a>&lt;OW&gt; {</div><div class="line"><a name="l00034"></a><span class="lineno"> 34</span>&#160; <span class="keyword">friend</span> <a class="code" href="classutl_1_1__1wire__uart__i.html">_1wire_uart_i&lt;OW&gt;</a>;</div><div class="line"><a name="l00035"></a><span class="lineno"> 35</span>&#160; <a class="code" href="namespaceutl.html#a1427cb5a2b13313147a902173b91e3c1">byte_t</a> UART_RW (<a class="code" href="namespaceutl.html#a1427cb5a2b13313147a902173b91e3c1">byte_t</a> byte) {</div><div class="line"><a name="l00036"></a><span class="lineno"> 36</span>&#160; <span class="comment">// return the given. This also mean no-device</span></div><div class="line"><a name="l00037"></a><span class="lineno"> 37</span>&#160; <span class="keywordflow">return</span> byte;</div><div class="line"><a name="l00038"></a><span class="lineno"> 38</span>&#160; }</div><div class="line"><a name="l00039"></a><span class="lineno"> 39</span>&#160; <span class="keywordtype">void</span> UART_BR (uint32_t br) {} <span class="comment">// imaginary baud-rate implementation</span></div><div class="line"><a name="l00040"></a><span class="lineno"> 40</span>&#160; };</div><div class="line"><a name="l00041"></a><span class="lineno"> 41</span>&#160;</div><div class="line"><a name="l00042"></a><span class="lineno"> 42</span>&#160; <span class="comment">// fixture</span></div><div class="line"><a name="l00043"></a><span class="lineno"><a class="line" href="classtest__1w_1_1_test__1w__impl.html"> 43</a></span>&#160; <span class="keyword">class </span><a class="code" href="classtest__1w_1_1_test__1w__impl.html">Test_1w_impl</a> : <span class="keyword">public</span> <a class="code" href="classtesting_1_1_test.html">::testing::Test</a> {</div><div class="line"><a name="l00044"></a><span class="lineno"> 44</span>&#160; <span class="keyword">protected</span>:</div><div class="line"><a name="l00045"></a><span class="lineno"> 45</span>&#160; <span class="comment">//void SetUp() override { }</span></div><div class="line"><a name="l00046"></a><span class="lineno"> 46</span>&#160; <span class="comment">//void TearDown() override { }</span></div><div class="line"><a name="l00047"></a><span class="lineno"><a class="line" href="classtest__1w_1_1_test__1w__impl.html#aa0eda9594f798f3ebed80f179741293a"> 47</a></span>&#160; <a class="code" href="classtest__1w_1_1_o_w.html">OW</a> <a class="code" href="classtest__1w_1_1_test__1w__impl.html#aa0eda9594f798f3ebed80f179741293a">ow</a>;</div><div class="line"><a name="l00048"></a><span class="lineno"> 48</span>&#160; };</div><div class="line"><a name="l00049"></a><span class="lineno"> 49</span>&#160;</div><div class="line"><a name="l00050"></a><span class="lineno"><a class="line" href="namespacetest__1w.html#a91bee95e2ca23e750b4a33479aea8029"> 50</a></span>&#160; <a class="code" href="namespacetest__1w.html#a91bee95e2ca23e750b4a33479aea8029">TEST_F</a>(<a class="code" href="classtest__1w_1_1_test__1w__impl.html">Test_1w_impl</a>, TestConcept) {</div><div class="line"><a name="l00051"></a><span class="lineno"> 51</span>&#160;<span class="comment">// EXPECT_EQ(_1Wire_i&lt;OW&gt;, true);</span></div><div class="line"><a name="l00052"></a><span class="lineno"> 52</span>&#160; }</div><div class="line"><a name="l00053"></a><span class="lineno"> 53</span>&#160;</div><div class="line"><a name="l00054"></a><span class="lineno"><a class="line" href="namespacetest__1w.html#a2e7d40e0befd264af7e7b6794b447555"> 54</a></span>&#160; <a class="code" href="namespacetest__1w.html#a91bee95e2ca23e750b4a33479aea8029">TEST_F</a>(<a class="code" href="classtest__1w_1_1_test__1w__impl.html">Test_1w_impl</a>, TestConstruction) {</div><div class="line"><a name="l00055"></a><span class="lineno"> 55</span>&#160; <a class="code" href="gtest_8h.html#aa8bc8320813e1abb0016129b636e3b27">EXPECT_GT</a>(<span class="keyword">sizeof</span>(ow), 0UL);</div><div class="line"><a name="l00056"></a><span class="lineno"> 56</span>&#160; }</div><div class="line"><a name="l00057"></a><span class="lineno"> 57</span>&#160;</div><div class="line"><a name="l00058"></a><span class="lineno"><a class="line" href="namespacetest__1w.html#ab5d5a9f17f851deeb0058589c4bdbdfc"> 58</a></span>&#160; <a class="code" href="namespacetest__1w.html#a91bee95e2ca23e750b4a33479aea8029">TEST_F</a> (<a class="code" href="classtest__1w_1_1_test__1w__impl.html">Test_1w_impl</a>, TestFunctionality) {</div><div class="line"><a name="l00059"></a><span class="lineno"> 59</span>&#160; <a class="code" href="namespaceutl.html#a1427cb5a2b13313147a902173b91e3c1">byte_t</a> b {42};</div><div class="line"><a name="l00060"></a><span class="lineno"> 60</span>&#160;</div><div class="line"><a name="l00061"></a><span class="lineno"> 61</span>&#160; <a class="code" href="classutl_1_1__1wire__id__t.html">_1wire_id_t</a> <span class="keywordtype">id</span> = ow.first(OW::Speed::STD);</div><div class="line"><a name="l00062"></a><span class="lineno"> 62</span>&#160; <a class="code" href="gtest_8h.html#a4159019abda84f5366acdb7604ff220a">EXPECT_EQ</a> (<span class="keywordtype">id</span> != <a class="code" href="classutl_1_1__1wire__id__t.html#adad08aa5ce38e1a87800de57a91db81b">_1wire_id_t::nullDev</a>(), <span class="keyword">false</span>); <span class="comment">// as long as there is no slave Mock</span></div><div class="line"><a name="l00063"></a><span class="lineno"> 63</span>&#160;</div><div class="line"><a name="l00064"></a><span class="lineno"> 64</span>&#160; <a class="code" href="gtest_8h.html#a4159019abda84f5366acdb7604ff220a">EXPECT_EQ</a> (ow.reset(OW::Speed::STD), <span class="keyword">false</span>); <span class="comment">// as long as there is no slave Mock</span></div><div class="line"><a name="l00065"></a><span class="lineno"> 65</span>&#160; <span class="comment">//ow.match(id, OW::Speed::STD);</span></div><div class="line"><a name="l00066"></a><span class="lineno"> 66</span>&#160; <a class="code" href="gtest_8h.html#a4159019abda84f5366acdb7604ff220a">EXPECT_EQ</a>(ow.rx_data(OW::Speed::STD), 0xFF);</div><div class="line"><a name="l00067"></a><span class="lineno"> 67</span>&#160; <a class="code" href="gtest_8h.html#a4159019abda84f5366acdb7604ff220a">EXPECT_EQ</a>(ow.tx_data(b, OW::Speed::STD), 42);</div><div class="line"><a name="l00068"></a><span class="lineno"> 68</span>&#160;</div><div class="line"><a name="l00069"></a><span class="lineno"> 69</span>&#160; }</div><div class="line"><a name="l00070"></a><span class="lineno"> 70</span>&#160;}</div><div class="ttc" id="namespacetest__1w_html_a91bee95e2ca23e750b4a33479aea8029"><div class="ttname"><a href="namespacetest__1w.html#a91bee95e2ca23e750b4a33479aea8029">test_1w::TEST_F</a></div><div class="ttdeci">TEST_F(Test_1w_impl, TestConcept)</div><div class="ttdef"><b>Definition:</b> <a href="test__1w__impl_8cpp_source.html#l00050">test_1w_impl.cpp:50</a></div></div>
  92. <div class="ttc" id="classtest__1w_1_1_o_w_html"><div class="ttname"><a href="classtest__1w_1_1_o_w.html">test_1w::OW</a></div><div class="ttdef"><b>Definition:</b> <a href="test__1w__impl_8cpp_source.html#l00033">test_1w_impl.cpp:33</a></div></div>
  93. <div class="ttc" id="classtest__1w_1_1_test__1w__impl_html"><div class="ttname"><a href="classtest__1w_1_1_test__1w__impl.html">test_1w::Test_1w_impl</a></div><div class="ttdef"><b>Definition:</b> <a href="test__1w__impl_8cpp_source.html#l00043">test_1w_impl.cpp:43</a></div></div>
  94. <div class="ttc" id="gtest_8h_html"><div class="ttname"><a href="gtest_8h.html">gtest.h</a></div></div>
  95. <div class="ttc" id="classutl_1_1__1wire__id__t_html"><div class="ttname"><a href="classutl_1_1__1wire__id__t.html">utl::_1wire_id_t</a></div><div class="ttdef"><b>Definition:</b> <a href="__1wire__id_8h_source.html#l00032">_1wire_id.h:32</a></div></div>
  96. <div class="ttc" id="gtest_8h_html_aa8bc8320813e1abb0016129b636e3b27"><div class="ttname"><a href="gtest_8h.html#aa8bc8320813e1abb0016129b636e3b27">EXPECT_GT</a></div><div class="ttdeci">#define EXPECT_GT(val1, val2)</div><div class="ttdef"><b>Definition:</b> <a href="gtest_8h_source.html#l16655">gtest.h:16655</a></div></div>
  97. <div class="ttc" id="namespaceutl_html"><div class="ttname"><a href="namespaceutl.html">utl</a></div><div class="ttdoc">STL&amp;#39;s core language concepts. </div><div class="ttdef"><b>Definition:</b> <a href="__1wire_8h_source.html#l00030">_1wire.h:30</a></div></div>
  98. <div class="ttc" id="classutl_1_1__1wire__id__t_html_adad08aa5ce38e1a87800de57a91db81b"><div class="ttname"><a href="classutl_1_1__1wire__id__t.html#adad08aa5ce38e1a87800de57a91db81b">utl::_1wire_id_t::nullDev</a></div><div class="ttdeci">static constexpr const _1wire_id_t &amp; nullDev()</div><div class="ttdoc">Return nullDev reference. </div><div class="ttdef"><b>Definition:</b> <a href="__1wire__id_8h_source.html#l00050">_1wire_id.h:50</a></div></div>
  99. <div class="ttc" id="classtesting_1_1_test_html"><div class="ttname"><a href="classtesting_1_1_test.html">testing::Test</a></div><div class="ttdef"><b>Definition:</b> <a href="gtest_8h_source.html#l15014">gtest.h:15014</a></div></div>
  100. <div class="ttc" id="classtest__1w_1_1_test__1w__impl_html_aa0eda9594f798f3ebed80f179741293a"><div class="ttname"><a href="classtest__1w_1_1_test__1w__impl.html#aa0eda9594f798f3ebed80f179741293a">test_1w::Test_1w_impl::ow</a></div><div class="ttdeci">OW ow</div><div class="ttdef"><b>Definition:</b> <a href="test__1w__impl_8cpp_source.html#l00047">test_1w_impl.cpp:47</a></div></div>
  101. <div class="ttc" id="gtest_8h_html_a4159019abda84f5366acdb7604ff220a"><div class="ttname"><a href="gtest_8h.html#a4159019abda84f5366acdb7604ff220a">EXPECT_EQ</a></div><div class="ttdeci">#define EXPECT_EQ(val1, val2)</div><div class="ttdef"><b>Definition:</b> <a href="gtest_8h_source.html#l16643">gtest.h:16643</a></div></div>
  102. <div class="ttc" id="namespaceutl_html_a1427cb5a2b13313147a902173b91e3c1"><div class="ttname"><a href="namespaceutl.html#a1427cb5a2b13313147a902173b91e3c1">utl::byte_t</a></div><div class="ttdeci">uint8_t byte_t</div><div class="ttdoc">8 bits wide </div><div class="ttdef"><b>Definition:</b> <a href="types_8h_source.html#l00031">types.h:31</a></div></div>
  103. <div class="ttc" id="classutl_1_1__1wire__uart__i_html"><div class="ttname"><a href="classutl_1_1__1wire__uart__i.html">utl::_1wire_uart_i</a></div><div class="ttdoc">1-wire UART interface template class using CRTP Using the private virtual interface we provide the in...</div><div class="ttdef"><b>Definition:</b> <a href="__1wire__uart_8h_source.html#l00052">_1wire_uart.h:52</a></div></div>
  104. <div class="ttc" id="__1wire__uart_8h_html"><div class="ttname"><a href="__1wire__uart_8h.html">_1wire_uart.h</a></div><div class="ttdoc">A 1-wire implementation using a microprocessor&amp;#39;s uart for bit timing. </div></div>
  105. <div class="ttc" id="namespacetest__1w_html"><div class="ttname"><a href="namespacetest__1w.html">test_1w</a></div><div class="ttdef"><b>Definition:</b> <a href="test__1w__impl_8cpp_source.html#l00029">test_1w_impl.cpp:29</a></div></div>
  106. </div><!-- fragment --></div><!-- contents -->
  107. </div><!-- doc-content -->
  108. <!-- start footer part -->
  109. <div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  110. <ul>
  111. <li class="navelem"><a class="el" href="dir_13e138d54eb8818da29c3992edef070a.html">test</a></li><li class="navelem"><a class="el" href="dir_d84abbe486a7f5f39e3c9088ffc1760a.html">tests</a></li><li class="navelem"><a class="el" href="test__1w__impl_8cpp.html">test_1w_impl.cpp</a></li>
  112. <li class="footer">Generated by
  113. <a href="http://www.doxygen.org/index.html">
  114. <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.14 </li>
  115. </ul>
  116. </div>
  117. </body>
  118. </html>