|
|
|
|
@@ -3,7 +3,7 @@
|
|
|
|
|
<head>
|
|
|
|
|
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
|
|
|
|
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
|
|
|
|
|
<meta name="generator" content="Doxygen 1.9.2"/>
|
|
|
|
|
<meta name="generator" content="Doxygen 1.9.3"/>
|
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
|
|
|
|
<title>Algorithms_in_C++: tests Namespace Reference</title>
|
|
|
|
|
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
|
|
|
|
|
@@ -30,8 +30,8 @@ MathJax.Hub.Config({
|
|
|
|
|
<div id="titlearea">
|
|
|
|
|
<table cellspacing="0" cellpadding="0">
|
|
|
|
|
<tbody>
|
|
|
|
|
<tr style="height: 56px;">
|
|
|
|
|
<td id="projectalign" style="padding-left: 0.5em;">
|
|
|
|
|
<tr id="projectrow">
|
|
|
|
|
<td id="projectalign">
|
|
|
|
|
<div id="projectname">Algorithms_in_C++<span id="projectnumber"> 1.0.0</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div id="projectbrief">Set of algorithms implemented in C++.</div>
|
|
|
|
|
@@ -41,7 +41,7 @@ MathJax.Hub.Config({
|
|
|
|
|
</table>
|
|
|
|
|
</div>
|
|
|
|
|
<!-- end header part -->
|
|
|
|
|
<!-- Generated by Doxygen 1.9.2 -->
|
|
|
|
|
<!-- Generated by Doxygen 1.9.3 -->
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
|
|
|
|
var searchBox = new SearchBox("searchBox", "../../search",'Search','.html');
|
|
|
|
|
@@ -164,17 +164,17 @@ Functions</h2></td></tr>
|
|
|
|
|
<p >< Check if both elements are same</p>
|
|
|
|
|
<p >< Check if result is empty</p>
|
|
|
|
|
<p >< Should only print newline</p>
|
|
|
|
|
<div class="fragment"><div class="line"><a id="l00075" name="l00075"></a><span class="lineno"> 75</span> {</div>
|
|
|
|
|
<div class="line"><a id="l00076" name="l00076"></a><span class="lineno"> 76</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"TEST CASE 1\n"</span>;</div>
|
|
|
|
|
<div class="line"><a id="l00077" name="l00077"></a><span class="lineno"> 77</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"Initialized arr = {1, 2, 3, 4, 5}\n"</span>;</div>
|
|
|
|
|
<div class="line"><a id="l00078" name="l00078"></a><span class="lineno"> 78</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"Expected result: {3, 4, 5, 1, 2}\n"</span>;</div>
|
|
|
|
|
<div class="line"><a id="l00079" name="l00079"></a><span class="lineno"> 79</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector<int32_t></a> arr = {1, 2, 3, 4, 5};</div>
|
|
|
|
|
<div class="line"><a id="l00080" name="l00080"></a><span class="lineno"> 80</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector<int32_t></a> res = <a class="code hl_function" href="../../da/d6d/namespaceoperations__on__datastructures.html#afce39cf843989a39811a49ebe29dd6d8">shift_left</a>(arr, 2);</div>
|
|
|
|
|
<div class="line"><a id="l00081" name="l00081"></a><span class="lineno"> 81</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector<int32_t></a> expected = {3, 4, 5, 1, 2};</div>
|
|
|
|
|
<div class="line"><a id="l00082" name="l00082"></a><span class="lineno"> 82</span> assert(res == expected);</div>
|
|
|
|
|
<div class="line"><a id="l00083" name="l00083"></a><span class="lineno"> 83</span> <a class="code hl_function" href="../../d8/ddf/sieve__of__eratosthenes_8cpp.html#a235843bdf82d2a6cc8596ae8fd3b8df9">print</a>(res); <span class="comment">///< Should print 3 4 5 1 2</span></div>
|
|
|
|
|
<div class="line"><a id="l00084" name="l00084"></a><span class="lineno"> 84</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"TEST PASSED!\n\n"</span>;</div>
|
|
|
|
|
<div class="line"><a id="l00085" name="l00085"></a><span class="lineno"> 85</span>}</div>
|
|
|
|
|
<div class="fragment"><div class="line"><span class="lineno"> 75</span> {</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 76</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"TEST CASE 1\n"</span>;</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 77</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"Initialized arr = {1, 2, 3, 4, 5}\n"</span>;</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 78</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"Expected result: {3, 4, 5, 1, 2}\n"</span>;</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 79</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector<int32_t></a> arr = {1, 2, 3, 4, 5};</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 80</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector<int32_t></a> res = <a class="code hl_function" href="../../da/d6d/namespaceoperations__on__datastructures.html#afce39cf843989a39811a49ebe29dd6d8">shift_left</a>(arr, 2);</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 81</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector<int32_t></a> expected = {3, 4, 5, 1, 2};</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 82</span> assert(res == expected);</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 83</span> <a class="code hl_function" href="../../d8/ddf/sieve__of__eratosthenes_8cpp.html#a235843bdf82d2a6cc8596ae8fd3b8df9">print</a>(res); <span class="comment">///< Should print 3 4 5 1 2</span></div>
|
|
|
|
|
<div class="line"><span class="lineno"> 84</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"TEST PASSED!\n\n"</span>;</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 85</span>}</div>
|
|
|
|
|
<div class="ttc" id="abasic_ostream_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a></div></div>
|
|
|
|
|
<div class="ttc" id="anamespaceoperations__on__datastructures_html_afce39cf843989a39811a49ebe29dd6d8"><div class="ttname"><a href="../../da/d6d/namespaceoperations__on__datastructures.html#afce39cf843989a39811a49ebe29dd6d8">operations_on_datastructures::shift_left</a></div><div class="ttdeci">std::vector< int32_t > shift_left(const std::vector< int32_t > &array, size_t shift)</div><div class="ttdoc">Shifts the given vector to the left by the shift amount and returns a new vector with the result....</div><div class="ttdef"><b>Definition:</b> array_left_rotation.cpp:46</div></div>
|
|
|
|
|
<div class="ttc" id="asieve__of__eratosthenes_8cpp_html_a235843bdf82d2a6cc8596ae8fd3b8df9"><div class="ttname"><a href="../../d8/ddf/sieve__of__eratosthenes_8cpp.html#a235843bdf82d2a6cc8596ae8fd3b8df9">print</a></div><div class="ttdeci">void print(uint32_t N, const std::vector< bool > &is_prime)</div><div class="ttdef"><b>Definition:</b> sieve_of_eratosthenes.cpp:44</div></div>
|
|
|
|
|
@@ -223,17 +223,17 @@ Here is the call graph for this function:</div>
|
|
|
|
|
<p >< Ensure that there is only one element</p>
|
|
|
|
|
<p >< Check if result is equal to b</p>
|
|
|
|
|
<p >< Should print 2 3</p>
|
|
|
|
|
<div class="fragment"><div class="line"><a id="l00090" name="l00090"></a><span class="lineno"> 90</span> {</div>
|
|
|
|
|
<div class="line"><a id="l00091" name="l00091"></a><span class="lineno"> 91</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"TEST CASE 2\n"</span>;</div>
|
|
|
|
|
<div class="line"><a id="l00092" name="l00092"></a><span class="lineno"> 92</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"Initialized arr = {}\n"</span>;</div>
|
|
|
|
|
<div class="line"><a id="l00093" name="l00093"></a><span class="lineno"> 93</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"Expected result: {}\n"</span>;</div>
|
|
|
|
|
<div class="line"><a id="l00094" name="l00094"></a><span class="lineno"> 94</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector<int32_t></a> arr = {};</div>
|
|
|
|
|
<div class="line"><a id="l00095" name="l00095"></a><span class="lineno"> 95</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector<int32_t></a> res = <a class="code hl_function" href="../../da/d6d/namespaceoperations__on__datastructures.html#afce39cf843989a39811a49ebe29dd6d8">shift_left</a>(arr, 2);</div>
|
|
|
|
|
<div class="line"><a id="l00096" name="l00096"></a><span class="lineno"> 96</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector<int32_t></a> expected = {};</div>
|
|
|
|
|
<div class="line"><a id="l00097" name="l00097"></a><span class="lineno"> 97</span> assert(res == expected);</div>
|
|
|
|
|
<div class="line"><a id="l00098" name="l00098"></a><span class="lineno"> 98</span> <a class="code hl_function" href="../../d8/ddf/sieve__of__eratosthenes_8cpp.html#a235843bdf82d2a6cc8596ae8fd3b8df9">print</a>(res); <span class="comment">///< Should print empty newline</span></div>
|
|
|
|
|
<div class="line"><a id="l00099" name="l00099"></a><span class="lineno"> 99</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"TEST PASSED!\n\n"</span>;</div>
|
|
|
|
|
<div class="line"><a id="l00100" name="l00100"></a><span class="lineno"> 100</span>}</div>
|
|
|
|
|
<div class="fragment"><div class="line"><span class="lineno"> 90</span> {</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 91</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"TEST CASE 2\n"</span>;</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 92</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"Initialized arr = {}\n"</span>;</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 93</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"Expected result: {}\n"</span>;</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 94</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector<int32_t></a> arr = {};</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 95</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector<int32_t></a> res = <a class="code hl_function" href="../../da/d6d/namespaceoperations__on__datastructures.html#afce39cf843989a39811a49ebe29dd6d8">shift_left</a>(arr, 2);</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 96</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector<int32_t></a> expected = {};</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 97</span> assert(res == expected);</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 98</span> <a class="code hl_function" href="../../d8/ddf/sieve__of__eratosthenes_8cpp.html#a235843bdf82d2a6cc8596ae8fd3b8df9">print</a>(res); <span class="comment">///< Should print empty newline</span></div>
|
|
|
|
|
<div class="line"><span class="lineno"> 99</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"TEST PASSED!\n\n"</span>;</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 100</span>}</div>
|
|
|
|
|
</div><!-- fragment --><div class="dynheader">
|
|
|
|
|
Here is the call graph for this function:</div>
|
|
|
|
|
<div class="dyncontent">
|
|
|
|
|
@@ -281,17 +281,17 @@ Here is the call graph for this function:</div>
|
|
|
|
|
<p >< Check for equality</p>
|
|
|
|
|
<p >< Check if result is correct</p>
|
|
|
|
|
<p >< Should print 2 3 4 6</p>
|
|
|
|
|
<div class="fragment"><div class="line"><a id="l00105" name="l00105"></a><span class="lineno"> 105</span> {</div>
|
|
|
|
|
<div class="line"><a id="l00106" name="l00106"></a><span class="lineno"> 106</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"TEST CASE 3\n"</span>;</div>
|
|
|
|
|
<div class="line"><a id="l00107" name="l00107"></a><span class="lineno"> 107</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"Initialized arr = {1, 2, 3, 4, 5}\n"</span>;</div>
|
|
|
|
|
<div class="line"><a id="l00108" name="l00108"></a><span class="lineno"> 108</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"Expected result: {}\n"</span>;</div>
|
|
|
|
|
<div class="line"><a id="l00109" name="l00109"></a><span class="lineno"> 109</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector<int32_t></a> arr = {1, 2, 3, 4, 5};</div>
|
|
|
|
|
<div class="line"><a id="l00110" name="l00110"></a><span class="lineno"> 110</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector<int32_t></a> res = <a class="code hl_function" href="../../da/d6d/namespaceoperations__on__datastructures.html#afce39cf843989a39811a49ebe29dd6d8">shift_left</a>(arr, 7); <span class="comment">///< 7 > 5</span></div>
|
|
|
|
|
<div class="line"><a id="l00111" name="l00111"></a><span class="lineno"> 111</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector<int32_t></a> expected = {};</div>
|
|
|
|
|
<div class="line"><a id="l00112" name="l00112"></a><span class="lineno"> 112</span> assert(res == expected);</div>
|
|
|
|
|
<div class="line"><a id="l00113" name="l00113"></a><span class="lineno"> 113</span> <a class="code hl_function" href="../../d8/ddf/sieve__of__eratosthenes_8cpp.html#a235843bdf82d2a6cc8596ae8fd3b8df9">print</a>(res); <span class="comment">///< Should print empty newline</span></div>
|
|
|
|
|
<div class="line"><a id="l00114" name="l00114"></a><span class="lineno"> 114</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"TEST PASSED!\n\n"</span>;</div>
|
|
|
|
|
<div class="line"><a id="l00115" name="l00115"></a><span class="lineno"> 115</span>}</div>
|
|
|
|
|
<div class="fragment"><div class="line"><span class="lineno"> 105</span> {</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 106</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"TEST CASE 3\n"</span>;</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 107</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"Initialized arr = {1, 2, 3, 4, 5}\n"</span>;</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 108</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"Expected result: {}\n"</span>;</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 109</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector<int32_t></a> arr = {1, 2, 3, 4, 5};</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 110</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector<int32_t></a> res = <a class="code hl_function" href="../../da/d6d/namespaceoperations__on__datastructures.html#afce39cf843989a39811a49ebe29dd6d8">shift_left</a>(arr, 7); <span class="comment">///< 7 > 5</span></div>
|
|
|
|
|
<div class="line"><span class="lineno"> 111</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector<int32_t></a> expected = {};</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 112</span> assert(res == expected);</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 113</span> <a class="code hl_function" href="../../d8/ddf/sieve__of__eratosthenes_8cpp.html#a235843bdf82d2a6cc8596ae8fd3b8df9">print</a>(res); <span class="comment">///< Should print empty newline</span></div>
|
|
|
|
|
<div class="line"><span class="lineno"> 114</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"TEST PASSED!\n\n"</span>;</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 115</span>}</div>
|
|
|
|
|
</div><!-- fragment --><div class="dynheader">
|
|
|
|
|
Here is the call graph for this function:</div>
|
|
|
|
|
<div class="dyncontent">
|
|
|
|
|
@@ -333,25 +333,25 @@ Here is the call graph for this function:</div>
|
|
|
|
|
<p >< Should print 4 6</p>
|
|
|
|
|
<p >< Check if result is correct</p>
|
|
|
|
|
<p >< Should print 2 3 4 6 7</p>
|
|
|
|
|
<div class="fragment"><div class="line"><a id="l00120" name="l00120"></a><span class="lineno"> 120</span> {</div>
|
|
|
|
|
<div class="line"><a id="l00121" name="l00121"></a><span class="lineno"> 121</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"TEST CASE 4\n"</span>;</div>
|
|
|
|
|
<div class="line"><a id="l00122" name="l00122"></a><span class="lineno"> 122</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"Initialized arr = {2, 4, ..., 420}\n"</span>;</div>
|
|
|
|
|
<div class="line"><a id="l00123" name="l00123"></a><span class="lineno"> 123</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"Expected result: {4, 6, ..., 420, 2}\n"</span>;</div>
|
|
|
|
|
<div class="line"><a id="l00124" name="l00124"></a><span class="lineno"> 124</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector<int32_t></a> arr;</div>
|
|
|
|
|
<div class="line"><a id="l00125" name="l00125"></a><span class="lineno"> 125</span> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 1; i <= 210; i++) {</div>
|
|
|
|
|
<div class="line"><a id="l00126" name="l00126"></a><span class="lineno"> 126</span> arr.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/push_back.html">push_back</a>(i * 2);</div>
|
|
|
|
|
<div class="line"><a id="l00127" name="l00127"></a><span class="lineno"> 127</span> }</div>
|
|
|
|
|
<div class="line"><a id="l00128" name="l00128"></a><span class="lineno"> 128</span> <a class="code hl_function" href="../../d8/ddf/sieve__of__eratosthenes_8cpp.html#a235843bdf82d2a6cc8596ae8fd3b8df9">print</a>(arr);</div>
|
|
|
|
|
<div class="line"><a id="l00129" name="l00129"></a><span class="lineno"> 129</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector<int32_t></a> res = <a class="code hl_function" href="../../da/d6d/namespaceoperations__on__datastructures.html#afce39cf843989a39811a49ebe29dd6d8">shift_left</a>(arr, 1);</div>
|
|
|
|
|
<div class="line"><a id="l00130" name="l00130"></a><span class="lineno"> 130</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector<int32_t></a> expected;</div>
|
|
|
|
|
<div class="line"><a id="l00131" name="l00131"></a><span class="lineno"> 131</span> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 1; i < 210; i++) {</div>
|
|
|
|
|
<div class="line"><a id="l00132" name="l00132"></a><span class="lineno"> 132</span> expected.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/push_back.html">push_back</a>(arr[i]);</div>
|
|
|
|
|
<div class="line"><a id="l00133" name="l00133"></a><span class="lineno"> 133</span> }</div>
|
|
|
|
|
<div class="line"><a id="l00134" name="l00134"></a><span class="lineno"> 134</span> expected.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/push_back.html">push_back</a>(2);</div>
|
|
|
|
|
<div class="line"><a id="l00135" name="l00135"></a><span class="lineno"> 135</span> assert(res == expected);</div>
|
|
|
|
|
<div class="line"><a id="l00136" name="l00136"></a><span class="lineno"> 136</span> <a class="code hl_function" href="../../d8/ddf/sieve__of__eratosthenes_8cpp.html#a235843bdf82d2a6cc8596ae8fd3b8df9">print</a>(res); <span class="comment">///< Should print {4, 6, ..., 420, 2}</span></div>
|
|
|
|
|
<div class="line"><a id="l00137" name="l00137"></a><span class="lineno"> 137</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"TEST PASSED!\n\n"</span>;</div>
|
|
|
|
|
<div class="line"><a id="l00138" name="l00138"></a><span class="lineno"> 138</span>}</div>
|
|
|
|
|
<div class="fragment"><div class="line"><span class="lineno"> 120</span> {</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 121</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"TEST CASE 4\n"</span>;</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 122</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"Initialized arr = {2, 4, ..., 420}\n"</span>;</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 123</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"Expected result: {4, 6, ..., 420, 2}\n"</span>;</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 124</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector<int32_t></a> arr;</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 125</span> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 1; i <= 210; i++) {</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 126</span> arr.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/push_back.html">push_back</a>(i * 2);</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 127</span> }</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 128</span> <a class="code hl_function" href="../../d8/ddf/sieve__of__eratosthenes_8cpp.html#a235843bdf82d2a6cc8596ae8fd3b8df9">print</a>(arr);</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 129</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector<int32_t></a> res = <a class="code hl_function" href="../../da/d6d/namespaceoperations__on__datastructures.html#afce39cf843989a39811a49ebe29dd6d8">shift_left</a>(arr, 1);</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 130</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector<int32_t></a> expected;</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 131</span> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 1; i < 210; i++) {</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 132</span> expected.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/push_back.html">push_back</a>(arr[i]);</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 133</span> }</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 134</span> expected.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/push_back.html">push_back</a>(2);</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 135</span> assert(res == expected);</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 136</span> <a class="code hl_function" href="../../d8/ddf/sieve__of__eratosthenes_8cpp.html#a235843bdf82d2a6cc8596ae8fd3b8df9">print</a>(res); <span class="comment">///< Should print {4, 6, ..., 420, 2}</span></div>
|
|
|
|
|
<div class="line"><span class="lineno"> 137</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"TEST PASSED!\n\n"</span>;</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 138</span>}</div>
|
|
|
|
|
<div class="ttc" id="apush_back_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/container/vector/push_back.html">std::vector::push_back</a></div><div class="ttdeci">T push_back(T... args)</div></div>
|
|
|
|
|
</div><!-- fragment --><div class="dynheader">
|
|
|
|
|
Here is the call graph for this function:</div>
|
|
|
|
|
@@ -392,16 +392,16 @@ Here is the call graph for this function:</div>
|
|
|
|
|
<p >< Should print 2 3 4</p>
|
|
|
|
|
<p >< Check if result is correct</p>
|
|
|
|
|
<p >< Should print 1 2 3 4 5 6 7 9</p>
|
|
|
|
|
<div class="fragment"><div class="line"><a id="l00143" name="l00143"></a><span class="lineno"> 143</span> {</div>
|
|
|
|
|
<div class="line"><a id="l00144" name="l00144"></a><span class="lineno"> 144</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"TEST CASE 5\n"</span>;</div>
|
|
|
|
|
<div class="line"><a id="l00145" name="l00145"></a><span class="lineno"> 145</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"Initialized arr = {1, 2, 3, 4, 5}\n"</span>;</div>
|
|
|
|
|
<div class="line"><a id="l00146" name="l00146"></a><span class="lineno"> 146</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"Expected result: {1, 2, 3, 4, 5}\n"</span>;</div>
|
|
|
|
|
<div class="line"><a id="l00147" name="l00147"></a><span class="lineno"> 147</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector<int32_t></a> arr = {1, 2, 3, 4, 5};</div>
|
|
|
|
|
<div class="line"><a id="l00148" name="l00148"></a><span class="lineno"> 148</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector<int32_t></a> res = <a class="code hl_function" href="../../da/d6d/namespaceoperations__on__datastructures.html#afce39cf843989a39811a49ebe29dd6d8">shift_left</a>(arr, 0);</div>
|
|
|
|
|
<div class="line"><a id="l00149" name="l00149"></a><span class="lineno"> 149</span> assert(res == arr);</div>
|
|
|
|
|
<div class="line"><a id="l00150" name="l00150"></a><span class="lineno"> 150</span> <a class="code hl_function" href="../../d8/ddf/sieve__of__eratosthenes_8cpp.html#a235843bdf82d2a6cc8596ae8fd3b8df9">print</a>(res); <span class="comment">///< Should print 1 2 3 4 5</span></div>
|
|
|
|
|
<div class="line"><a id="l00151" name="l00151"></a><span class="lineno"> 151</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"TEST PASSED!\n\n"</span>;</div>
|
|
|
|
|
<div class="line"><a id="l00152" name="l00152"></a><span class="lineno"> 152</span>}</div>
|
|
|
|
|
<div class="fragment"><div class="line"><span class="lineno"> 143</span> {</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 144</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"TEST CASE 5\n"</span>;</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 145</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"Initialized arr = {1, 2, 3, 4, 5}\n"</span>;</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 146</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"Expected result: {1, 2, 3, 4, 5}\n"</span>;</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 147</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector<int32_t></a> arr = {1, 2, 3, 4, 5};</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 148</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector<int32_t></a> res = <a class="code hl_function" href="../../da/d6d/namespaceoperations__on__datastructures.html#afce39cf843989a39811a49ebe29dd6d8">shift_left</a>(arr, 0);</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 149</span> assert(res == arr);</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 150</span> <a class="code hl_function" href="../../d8/ddf/sieve__of__eratosthenes_8cpp.html#a235843bdf82d2a6cc8596ae8fd3b8df9">print</a>(res); <span class="comment">///< Should print 1 2 3 4 5</span></div>
|
|
|
|
|
<div class="line"><span class="lineno"> 151</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"TEST PASSED!\n\n"</span>;</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 152</span>}</div>
|
|
|
|
|
</div><!-- fragment --><div class="dynheader">
|
|
|
|
|
Here is the call graph for this function:</div>
|
|
|
|
|
<div class="dyncontent">
|
|
|
|
|
@@ -440,21 +440,21 @@ Here is the call graph for this function:</div>
|
|
|
|
|
<p >< Sort vector b</p>
|
|
|
|
|
<p >< Check if result is correct</p>
|
|
|
|
|
<p >< Should print 1 2 3 4 5 6 7 8 9 11</p>
|
|
|
|
|
<div class="fragment"><div class="line"><a id="l00166" name="l00166"></a><span class="lineno"> 166</span> {</div>
|
|
|
|
|
<div class="line"><a id="l00167" name="l00167"></a><span class="lineno"> 167</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"TEST CASE 6\n"</span>;</div>
|
|
|
|
|
<div class="line"><a id="l00168" name="l00168"></a><span class="lineno"> 168</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"Intialized a = {1, 3, 3, 2, 5, 9, 4, 7, 3, 2} "</span>;</div>
|
|
|
|
|
<div class="line"><a id="l00169" name="l00169"></a><span class="lineno"> 169</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"b = {11, 3, 7, 8, 6}\n"</span>;</div>
|
|
|
|
|
<div class="line"><a id="l00170" name="l00170"></a><span class="lineno"> 170</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"Expected result: {3, 7}\n"</span>;</div>
|
|
|
|
|
<div class="line"><a id="l00171" name="l00171"></a><span class="lineno"> 171</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector<int32_t></a> a = {1, 3, 3, 2, 5, 9, 4, 7, 3, 2};</div>
|
|
|
|
|
<div class="line"><a id="l00172" name="l00172"></a><span class="lineno"> 172</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector<int32_t></a> b = {11, 3, 7, 8, 6};</div>
|
|
|
|
|
<div class="line"><a id="l00173" name="l00173"></a><span class="lineno"> 173</span> <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/algorithm/sort.html">std::sort</a>(a.begin(), a.end()); <span class="comment">///< Sort vector a</span></div>
|
|
|
|
|
<div class="line"><a id="l00174" name="l00174"></a><span class="lineno"> 174</span> <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/algorithm/sort.html">std::sort</a>(b.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/begin.html">begin</a>(), b.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/end.html">end</a>()); <span class="comment">///< Sort vector b</span></div>
|
|
|
|
|
<div class="line"><a id="l00175" name="l00175"></a><span class="lineno"> 175</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector<int32_t></a> <a class="code hl_function" href="../../de/dc3/fibonacci__sum_8cpp.html#aadb40ac4c74a7efc0680b83eeee138aa">result</a> = <a class="code hl_function" href="../../da/d6d/namespaceoperations__on__datastructures.html#adaf9a06f0c236c2d95c97e441ea2d12e">get_intersection</a>(a, b);</div>
|
|
|
|
|
<div class="line"><a id="l00176" name="l00176"></a><span class="lineno"> 176</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector<int32_t></a> expected = {3, 7};</div>
|
|
|
|
|
<div class="line"><a id="l00177" name="l00177"></a><span class="lineno"> 177</span> assert(result == expected); <span class="comment">///< Check if result is correct</span></div>
|
|
|
|
|
<div class="line"><a id="l00178" name="l00178"></a><span class="lineno"> 178</span> <a class="code hl_function" href="../../d8/ddf/sieve__of__eratosthenes_8cpp.html#a235843bdf82d2a6cc8596ae8fd3b8df9">print</a>(result); <span class="comment">///< Should print 3 7</span></div>
|
|
|
|
|
<div class="line"><a id="l00179" name="l00179"></a><span class="lineno"> 179</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"TEST PASSED!\n\n"</span>;</div>
|
|
|
|
|
<div class="line"><a id="l00180" name="l00180"></a><span class="lineno"> 180</span>}</div>
|
|
|
|
|
<div class="fragment"><div class="line"><span class="lineno"> 166</span> {</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 167</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"TEST CASE 6\n"</span>;</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 168</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"Intialized a = {1, 3, 3, 2, 5, 9, 4, 7, 3, 2} "</span>;</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 169</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"b = {11, 3, 7, 8, 6}\n"</span>;</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 170</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"Expected result: {3, 7}\n"</span>;</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 171</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector<int32_t></a> a = {1, 3, 3, 2, 5, 9, 4, 7, 3, 2};</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 172</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector<int32_t></a> b = {11, 3, 7, 8, 6};</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 173</span> <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/algorithm/sort.html">std::sort</a>(a.begin(), a.end()); <span class="comment">///< Sort vector a</span></div>
|
|
|
|
|
<div class="line"><span class="lineno"> 174</span> <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/algorithm/sort.html">std::sort</a>(b.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/begin.html">begin</a>(), b.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/end.html">end</a>()); <span class="comment">///< Sort vector b</span></div>
|
|
|
|
|
<div class="line"><span class="lineno"> 175</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector<int32_t></a> <a class="code hl_function" href="../../de/dc3/fibonacci__sum_8cpp.html#aadb40ac4c74a7efc0680b83eeee138aa">result</a> = <a class="code hl_function" href="../../da/d6d/namespaceoperations__on__datastructures.html#adaf9a06f0c236c2d95c97e441ea2d12e">get_intersection</a>(a, b);</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 176</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector<int32_t></a> expected = {3, 7};</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 177</span> assert(result == expected); <span class="comment">///< Check if result is correct</span></div>
|
|
|
|
|
<div class="line"><span class="lineno"> 178</span> <a class="code hl_function" href="../../d8/ddf/sieve__of__eratosthenes_8cpp.html#a235843bdf82d2a6cc8596ae8fd3b8df9">print</a>(result); <span class="comment">///< Should print 3 7</span></div>
|
|
|
|
|
<div class="line"><span class="lineno"> 179</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"TEST PASSED!\n\n"</span>;</div>
|
|
|
|
|
<div class="line"><span class="lineno"> 180</span>}</div>
|
|
|
|
|
<div class="ttc" id="abegin_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/container/vector/begin.html">std::vector::begin</a></div><div class="ttdeci">T begin(T... args)</div></div>
|
|
|
|
|
<div class="ttc" id="aend_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/container/vector/end.html">std::vector::end</a></div><div class="ttdeci">T end(T... args)</div></div>
|
|
|
|
|
<div class="ttc" id="afibonacci__sum_8cpp_html_aadb40ac4c74a7efc0680b83eeee138aa"><div class="ttname"><a href="../../de/dc3/fibonacci__sum_8cpp.html#aadb40ac4c74a7efc0680b83eeee138aa">math::fibonacci_sum::result</a></div><div class="ttdeci">uint64_t result(uint64_t n)</div><div class="ttdef"><b>Definition:</b> fibonacci_sum.cpp:76</div></div>
|
|
|
|
|
@@ -475,7 +475,7 @@ Here is the call graph for this function:</div>
|
|
|
|
|
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
|
|
|
|
|
<ul>
|
|
|
|
|
<li class="navelem"><a class="el" href="../../d9/df4/namespacetests.html">tests</a></li>
|
|
|
|
|
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="../../doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.2 </li>
|
|
|
|
|
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="../../doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.3 </li>
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
|
|
|
|
</body>
|
|
|
|
|
|