Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: search-by-sql
Fetching contributors…

Cannot retrieve contributors at this time

760 lines (400 sloc) 22.187 kb
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang='en' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'>
<head>
<title>/Library/Ruby/Gems/1.8/gems/rcov-0.9.8/lib/rcov/differential_analyzer.rb</title>
<link href="screen.css" media="all" rel="stylesheet" type="text/css" />
<link href="print.css" media="print" rel="stylesheet" type="text/css" />
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
<script type="text/javascript" src="rcov.js"></script>
</head>
<body>
<h1>Clojuredocs C0 Coverage Information - RCov</h1>
<h2>/Library/Ruby/Gems/1.8/gems/rcov-0.9.8/lib/rcov/differential_analyzer.rb</h2>
<div class="report_table_wrapper">
<table class='report' id='report_table'>
<thead>
<tr>
<th class="left_align">Name</th>
<th class="right_align">Total Lines</th>
<th class="right_align">Lines of Code</th>
<th class="left_align">Total Coverage</th>
<th class="left_align">Code Coverage</th>
</tr>
</thead>
<tbody>
<tr>
<td class="left_align"><a href="-Library-Ruby-Gems-1_8-gems-rcov-0_9_8-lib-rcov-differential_analyzer_rb.html">/Library/Ruby/Gems/1.8/gems/rcov-0.9.8/lib/rcov/differential_analyzer.rb</a></td>
<td class='right_align'><tt>116</tt></td>
<td class='right_align'><tt>82</tt></td>
<td class="left_align"><div class="percent_graph_legend"><tt class=''>10.34%</tt></div>
<div class="percent_graph">
<div class="covered" style="width:10px"></div>
<div class="uncovered" style="width:90px"></div>
</div></td>
<td class="left_align"><div class="percent_graph_legend"><tt class=''>9.76%</tt></div>
<div class="percent_graph">
<div class="covered" style="width:10px"></div>
<div class="uncovered" style="width:90px"></div>
</div></td>
</tr>
</tbody>
</table>
</div>
<h3>Key</h3>
<div class="key"><pre><span class='marked'>Code reported as executed by Ruby looks like this...</span><span class='marked1'>and this: this line is also marked as covered.</span><span class='inferred'>Lines considered as run by rcov, but not reported by Ruby, look like this,</span><span class='inferred1'>and this: these lines were inferred by rcov (using simple heuristics).</span><span class='uncovered'>Finally, here's a line marked as not executed.</span></pre></div>
<h3>Coverage Details</h3>
<table class="details">
<tbody>
<tr class="uncovered">
<td><pre><a name="line1">1</a> module Rcov</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line2">2</a> class DifferentialAnalyzer</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line3">3</a> require 'thread'</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line4">4</a> @@mutex = Mutex.new</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line5">5</a> </pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line6">6</a> def initialize(install_hook_meth, remove_hook_meth, reset_meth)</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line7">7</a> @cache_state = :wait</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line8">8</a> @start_raw_data = data_default</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line9">9</a> @end_raw_data = data_default</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line10">10</a> @aggregated_data = data_default</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line11">11</a> @install_hook_meth = install_hook_meth</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line12">12</a> @remove_hook_meth= remove_hook_meth</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line13">13</a> @reset_meth= reset_meth</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line14">14</a> end</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line15">15</a> </pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line16">16</a> # Execute the code in the given block, monitoring it in order to gather</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line17">17</a> # information about which code was executed.</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line18">18</a> def run_hooked</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line19">19</a> install_hook</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line20">20</a> yield</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line21">21</a> ensure</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line22">22</a> remove_hook</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line23">23</a> end</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line24">24</a> </pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line25">25</a> # Start monitoring execution to gather information. Such data will be</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line26">26</a> # collected until #remove_hook is called.</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line27">27</a> #</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line28">28</a> # Use #run_hooked instead if possible.</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line29">29</a> def install_hook</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line30">30</a> @start_raw_data = raw_data_absolute</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line31">31</a> Rcov::RCOV__.send(@install_hook_meth)</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line32">32</a> @cache_state = :hooked</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line33">33</a> @@mutex.synchronize{ self.class.hook_level += 1 }</pre></td>
</tr>
<tr class="inferred">
<td><pre><a name="line34">34</a> end</pre></td>
</tr>
<tr class="inferred">
<td><pre><a name="line35">35</a> </pre></td>
</tr>
<tr class="inferred">
<td><pre><a name="line36">36</a> # Stop collecting information.</pre></td>
</tr>
<tr class="inferred">
<td><pre><a name="line37">37</a> # #remove_hook will also stop collecting info if it is run inside a</pre></td>
</tr>
<tr class="inferred">
<td><pre><a name="line38">38</a> # #run_hooked block.</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line39">39</a> def remove_hook</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line40">40</a> @@mutex.synchronize do </pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line41">41</a> self.class.hook_level -= 1</pre></td>
</tr>
<tr class="marked">
<td><pre><a name="line42">42</a> Rcov::RCOV__.send(@remove_hook_meth) if self.class.hook_level == 0</pre></td>
</tr>
<tr class="inferred">
<td><pre><a name="line43">43</a> end</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line44">44</a> @end_raw_data = raw_data_absolute</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line45">45</a> @cache_state = :done</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line46">46</a> # force computation of the stats for the traced code in this run;</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line47">47</a> # we cannot simply let it be if self.class.hook_level == 0 because </pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line48">48</a> # some other analyzer could install a hook, causing the raw_data_absolute</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line49">49</a> # to change again.</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line50">50</a> # TODO: lazy computation of raw_data_relative, only when the hook gets</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line51">51</a> # activated again.</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line52">52</a> raw_data_relative</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line53">53</a> end</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line54">54</a> </pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line55">55</a> # Remove the data collected so far. Further collection will start from</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line56">56</a> # scratch.</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line57">57</a> def reset</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line58">58</a> @@mutex.synchronize do</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line59">59</a> if self.class.hook_level == 0</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line60">60</a> # Unfortunately there's no way to report this as covered with rcov:</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line61">61</a> # if we run the tests under rcov self.class.hook_level will be &gt;= 1 !</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line62">62</a> # It is however executed when we run the tests normally.</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line63">63</a> Rcov::RCOV__.send(@reset_meth)</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line64">64</a> @start_raw_data = data_default</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line65">65</a> @end_raw_data = data_default</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line66">66</a> else</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line67">67</a> @start_raw_data = @end_raw_data = raw_data_absolute</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line68">68</a> end</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line69">69</a> @raw_data_relative = data_default</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line70">70</a> @aggregated_data = data_default</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line71">71</a> end</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line72">72</a> end</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line73">73</a> </pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line74">74</a> protected</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line75">75</a> </pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line76">76</a> def data_default</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line77">77</a> raise &quot;must be implemented by the subclass&quot;</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line78">78</a> end</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line79">79</a> </pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line80">80</a> def self.hook_level</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line81">81</a> raise &quot;must be implemented by the subclass&quot;</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line82">82</a> end</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line83">83</a> </pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line84">84</a> def raw_data_absolute</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line85">85</a> raise &quot;must be implemented by the subclass&quot;</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line86">86</a> end</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line87">87</a> </pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line88">88</a> def aggregate_data(aggregated_data, delta)</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line89">89</a> raise &quot;must be implemented by the subclass&quot;</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line90">90</a> end</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line91">91</a> </pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line92">92</a> def compute_raw_data_difference(first, last)</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line93">93</a> raise &quot;must be implemented by the subclass&quot;</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line94">94</a> end</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line95">95</a> </pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line96">96</a> private</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line97">97</a> </pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line98">98</a> def raw_data_relative</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line99">99</a> case @cache_state</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line100">100</a> when :wait</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line101">101</a> return @aggregated_data</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line102">102</a> when :hooked</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line103">103</a> new_start = raw_data_absolute</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line104">104</a> new_diff = compute_raw_data_difference(@start_raw_data, new_start)</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line105">105</a> @start_raw_data = new_start</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line106">106</a> when :done</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line107">107</a> @cache_state = :wait</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line108">108</a> new_diff = compute_raw_data_difference(@start_raw_data, </pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line109">109</a> @end_raw_data)</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line110">110</a> end</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line111">111</a> </pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line112">112</a> aggregate_data(@aggregated_data, new_diff)</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line113">113</a> @aggregated_data</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line114">114</a> end</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line115">115</a> end</pre></td>
</tr>
<tr class="uncovered">
<td><pre><a name="line116">116</a> end</pre></td>
</tr>
</tbody>
</table>
<p>Generated on Thu Sep 02 22:40:16 -0600 2010 with <a href="http://github.com/relevance/rcov">rcov 0.9.8</a></p>
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.