Cartesian 0.3.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,242 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
+ <html lang='en' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'>
3
+ <head>
4
+ <title>
5
+ /home/adriano/software/ruby/Cartesian/lib/grid_search.rb - C0 code
6
+ coverage information
7
+ </title>
8
+ <style type='text/css'>
9
+ body { background-color: rgb(240, 240, 245); }
10
+ </style>
11
+ <style type='text/css'>
12
+ span.cross-ref-title { font-size: 140%; } span.cross-ref a {
13
+ text-decoration: none; } span.cross-ref { background-color:#f3f7fa;
14
+ border: 1px dashed #333; margin: 1em; padding: 0.5em; overflow: hidden; }
15
+ a.crossref-toggle { text-decoration: none; } span.marked0 {
16
+ background-color: rgb(185, 210, 200); display: block; } span.marked1 {
17
+ background-color: rgb(190, 215, 205); display: block; } span.inferred0 {
18
+ background-color: rgb(175, 200, 200); display: block; } span.inferred1 {
19
+ background-color: rgb(180, 205, 205); display: block; } span.uncovered0 {
20
+ background-color: rgb(225, 110, 110); display: block; } span.uncovered1 {
21
+ background-color: rgb(235, 120, 120); display: block; } span.overview {
22
+ border-bottom: 8px solid black; } div.overview { border-bottom: 8px solid
23
+ black; } body { font-family: verdana, arial, helvetica; } div.footer {
24
+ font-size: 68%; margin-top: 1.5em; } h1, h2, h3, h4, h5, h6 {
25
+ margin-bottom: 0.5em; } h5 { margin-top: 0.5em; } .hidden { display: none;
26
+ } div.separator { height: 10px; } /* Commented out for better readability,
27
+ esp. on IE */ /* table tr td, table tr th { font-size: 68%; } td.value
28
+ table tr td { font-size: 11px; } */ table.percent_graph { height: 12px;
29
+ border: #808080 1px solid; empty-cells: show; } table.percent_graph
30
+ td.covered { height: 10px; background: #00f000; } table.percent_graph
31
+ td.uncovered { height: 10px; background: #e00000; } table.percent_graph
32
+ td.NA { height: 10px; background: #eaeaea; } table.report {
33
+ border-collapse: collapse; width: 100%; } table.report td.heading {
34
+ background: #dcecff; border: #d0d0d0 1px solid; font-weight: bold;
35
+ text-align: center; } table.report td.heading:hover { background: #c0ffc0;
36
+ } table.report td.text { border: #d0d0d0 1px solid; } table.report
37
+ td.value, table.report td.lines_total, table.report td.lines_code {
38
+ text-align: right; border: #d0d0d0 1px solid; } table.report tr.light {
39
+ background-color: rgb(240, 240, 245); } table.report tr.dark {
40
+ background-color: rgb(230, 230, 235); }
41
+ </style>
42
+ <script type='text/javascript'>
43
+ // <![CDATA[ function toggleCode( id ) { if ( document.getElementById )
44
+ elem = document.getElementById( id ); else if ( document.all ) elem =
45
+ eval( "document.all." + id ); else return false; elemStyle = elem.style;
46
+ if ( elemStyle.display != "block" ) { elemStyle.display = "block" } else {
47
+ elemStyle.display = "none" } return true; } // Make cross-references
48
+ hidden by default document.writeln( "<style
49
+ type=\"text/css\">span.cross-ref { display: none }</style>" ) // ]]>
50
+ </script>
51
+ <style type='text/css'>
52
+ span.run0 { background-color: rgb(178, 204, 255); display: block; }
53
+ span.run1 { background-color: rgb(178, 206, 255); display: block; }
54
+ span.run2 { background-color: rgb(178, 209, 255); display: block; }
55
+ span.run3 { background-color: rgb(178, 211, 255); display: block; }
56
+ span.run4 { background-color: rgb(178, 214, 255); display: block; }
57
+ span.run5 { background-color: rgb(178, 218, 255); display: block; }
58
+ span.run6 { background-color: rgb(178, 220, 255); display: block; }
59
+ span.run7 { background-color: rgb(178, 223, 255); display: block; }
60
+ span.run8 { background-color: rgb(178, 225, 255); display: block; }
61
+ span.run9 { background-color: rgb(178, 228, 255); display: block; }
62
+ span.run10 { background-color: rgb(178, 232, 255); display: block; }
63
+ span.run11 { background-color: rgb(178, 234, 255); display: block; }
64
+ span.run12 { background-color: rgb(178, 237, 255); display: block; }
65
+ span.run13 { background-color: rgb(178, 239, 255); display: block; }
66
+ span.run14 { background-color: rgb(178, 242, 255); display: block; }
67
+ span.run15 { background-color: rgb(178, 246, 255); display: block; }
68
+ span.run16 { background-color: rgb(178, 248, 255); display: block; }
69
+ span.run17 { background-color: rgb(178, 251, 255); display: block; }
70
+ span.run18 { background-color: rgb(178, 253, 255); display: block; }
71
+ span.run19 { background-color: rgb(178, 255, 253); display: block; }
72
+ span.run20 { background-color: rgb(178, 255, 249); display: block; }
73
+ span.run21 { background-color: rgb(178, 255, 247); display: block; }
74
+ span.run22 { background-color: rgb(178, 255, 244); display: block; }
75
+ span.run23 { background-color: rgb(178, 255, 242); display: block; }
76
+ span.run24 { background-color: rgb(178, 255, 239); display: block; }
77
+ span.run25 { background-color: rgb(178, 255, 235); display: block; }
78
+ span.run26 { background-color: rgb(178, 255, 233); display: block; }
79
+ span.run27 { background-color: rgb(178, 255, 230); display: block; }
80
+ span.run28 { background-color: rgb(178, 255, 228); display: block; }
81
+ span.run29 { background-color: rgb(178, 255, 225); display: block; }
82
+ span.run30 { background-color: rgb(178, 255, 221); display: block; }
83
+ span.run31 { background-color: rgb(178, 255, 219); display: block; }
84
+ span.run32 { background-color: rgb(178, 255, 216); display: block; }
85
+ span.run33 { background-color: rgb(178, 255, 214); display: block; }
86
+ span.run34 { background-color: rgb(178, 255, 211); display: block; }
87
+ span.run35 { background-color: rgb(178, 255, 207); display: block; }
88
+ span.run36 { background-color: rgb(178, 255, 205); display: block; }
89
+ span.run37 { background-color: rgb(178, 255, 202); display: block; }
90
+ span.run38 { background-color: rgb(178, 255, 200); display: block; }
91
+ span.run39 { background-color: rgb(178, 255, 197); display: block; }
92
+ span.run40 { background-color: rgb(178, 255, 193); display: block; }
93
+ span.run41 { background-color: rgb(178, 255, 191); display: block; }
94
+ span.run42 { background-color: rgb(178, 255, 188); display: block; }
95
+ span.run43 { background-color: rgb(178, 255, 186); display: block; }
96
+ span.run44 { background-color: rgb(178, 255, 183); display: block; }
97
+ span.run45 { background-color: rgb(178, 255, 179); display: block; }
98
+ span.run46 { background-color: rgb(179, 255, 178); display: block; }
99
+ span.run47 { background-color: rgb(182, 255, 178); display: block; }
100
+ span.run48 { background-color: rgb(184, 255, 178); display: block; }
101
+ span.run49 { background-color: rgb(187, 255, 178); display: block; }
102
+ span.run50 { background-color: rgb(191, 255, 178); display: block; }
103
+ span.run51 { background-color: rgb(193, 255, 178); display: block; }
104
+ span.run52 { background-color: rgb(196, 255, 178); display: block; }
105
+ span.run53 { background-color: rgb(198, 255, 178); display: block; }
106
+ span.run54 { background-color: rgb(201, 255, 178); display: block; }
107
+ span.run55 { background-color: rgb(205, 255, 178); display: block; }
108
+ span.run56 { background-color: rgb(207, 255, 178); display: block; }
109
+ span.run57 { background-color: rgb(210, 255, 178); display: block; }
110
+ span.run58 { background-color: rgb(212, 255, 178); display: block; }
111
+ span.run59 { background-color: rgb(215, 255, 178); display: block; }
112
+ span.run60 { background-color: rgb(219, 255, 178); display: block; }
113
+ span.run61 { background-color: rgb(221, 255, 178); display: block; }
114
+ span.run62 { background-color: rgb(224, 255, 178); display: block; }
115
+ span.run63 { background-color: rgb(226, 255, 178); display: block; }
116
+ span.run64 { background-color: rgb(229, 255, 178); display: block; }
117
+ span.run65 { background-color: rgb(233, 255, 178); display: block; }
118
+ span.run66 { background-color: rgb(235, 255, 178); display: block; }
119
+ span.run67 { background-color: rgb(238, 255, 178); display: block; }
120
+ span.run68 { background-color: rgb(240, 255, 178); display: block; }
121
+ span.run69 { background-color: rgb(243, 255, 178); display: block; }
122
+ span.run70 { background-color: rgb(247, 255, 178); display: block; }
123
+ span.run71 { background-color: rgb(249, 255, 178); display: block; }
124
+ span.run72 { background-color: rgb(252, 255, 178); display: block; }
125
+ span.run73 { background-color: rgb(255, 255, 178); display: block; }
126
+ span.run74 { background-color: rgb(255, 252, 178); display: block; }
127
+ span.run75 { background-color: rgb(255, 248, 178); display: block; }
128
+ span.run76 { background-color: rgb(255, 246, 178); display: block; }
129
+ span.run77 { background-color: rgb(255, 243, 178); display: block; }
130
+ span.run78 { background-color: rgb(255, 240, 178); display: block; }
131
+ span.run79 { background-color: rgb(255, 238, 178); display: block; }
132
+ span.run80 { background-color: rgb(255, 234, 178); display: block; }
133
+ span.run81 { background-color: rgb(255, 232, 178); display: block; }
134
+ span.run82 { background-color: rgb(255, 229, 178); display: block; }
135
+ span.run83 { background-color: rgb(255, 226, 178); display: block; }
136
+ span.run84 { background-color: rgb(255, 224, 178); display: block; }
137
+ span.run85 { background-color: rgb(255, 220, 178); display: block; }
138
+ span.run86 { background-color: rgb(255, 218, 178); display: block; }
139
+ span.run87 { background-color: rgb(255, 215, 178); display: block; }
140
+ span.run88 { background-color: rgb(255, 212, 178); display: block; }
141
+ span.run89 { background-color: rgb(255, 210, 178); display: block; }
142
+ span.run90 { background-color: rgb(255, 206, 178); display: block; }
143
+ span.run91 { background-color: rgb(255, 204, 178); display: block; }
144
+ span.run92 { background-color: rgb(255, 201, 178); display: block; }
145
+ span.run93 { background-color: rgb(255, 198, 178); display: block; }
146
+ span.run94 { background-color: rgb(255, 196, 178); display: block; }
147
+ span.run95 { background-color: rgb(255, 192, 178); display: block; }
148
+ span.run96 { background-color: rgb(255, 189, 178); display: block; }
149
+ span.run97 { background-color: rgb(255, 187, 178); display: block; }
150
+ span.run98 { background-color: rgb(255, 184, 178); display: block; }
151
+ span.run99 { background-color: rgb(255, 182, 178); display: block; }
152
+ span.run100 { background-color: rgb(255, 178, 178); display: block; }
153
+ </style>
154
+ </head>
155
+ <body>
156
+ <h3>
157
+ C0 code coverage information
158
+ </h3>
159
+ <p>
160
+ Generated on Tue Nov 04 04:48:28 -0200 2008 with
161
+ <a href='http://eigenclass.org/hiki/rcov'>
162
+ rcov 0.8.1.2
163
+ </a>
164
+ </p>
165
+ <hr />
166
+ <pre><span class='marked0'>Code reported as executed by Ruby looks like
167
+ this... </span><span class='marked1'>and this: this line is also marked as
168
+ covered. </span><span class='inferred0'>Lines considered as run by rcov, but
169
+ not reported by Ruby, look like this, </span><span class='inferred1'>and
170
+ this: these lines were inferred by rcov (using simple heuristics).
171
+ </span><span class='uncovered0'>Finally, here&apos;s a line marked as not
172
+ executed. </span></pre>
173
+ <table class='report'> <thead> <tr> <td class='heading'> Name </td> <td
174
+ class='heading'> Total lines </td> <td class='heading'> Lines of code </td>
175
+ <td class='heading'> Total coverage </td> <td class='heading'> Code coverage
176
+ </td> </tr> </thead> <tbody> <tr class='light'> <td> <a
177
+ href='-home-adriano-software-ruby-Cartesian-lib-grid_search_rb.html'>
178
+ /home/adriano/software/ruby/Cartesian/lib/grid_search.rb </a> </td> <td
179
+ class='lines_total'> <tt> 39 </tt> </td> <td class='lines_code'> <tt> 26
180
+ </tt> </td> <td> <table cellspacing='0' align='right' cellpadding='0'> <tr>
181
+ <td> <tt class='coverage_total'> 100.0% </tt> &nbsp; </td> <td> <table
182
+ class='percent_graph' cellspacing='0' width='100' cellpadding='0'> <tr> <td
183
+ class='covered' width='100' /> <td class='uncovered' width='0' /> </tr>
184
+ </table> </td> </tr> </table> </td> <td> <table cellspacing='0'
185
+ align='right' cellpadding='0'> <tr> <td> <tt class='coverage_code'> 100.0%
186
+ </tt> &nbsp; </td> <td> <table class='percent_graph' cellspacing='0'
187
+ width='100' cellpadding='0'> <tr> <td class='covered' width='100' /> <td
188
+ class='uncovered' width='0' /> </tr> </table> </td> </tr> </table> </td>
189
+ </tr> </tbody> </table><pre><span class="marked0"><a name="line1"></a> 1
190
+ module GridSearch </span><span class="inferred1"><a name="line2"></a> 2
191
+ </span><span class="inferred0"><a name="line3"></a> 3 # Finds the argument
192
+ which maximizes the function given in the block trhu grid-search
193
+ maximization. </span><span class="inferred1"><a name="line4"></a> 4 #
194
+ [-1,0,1,2].argmax {|x| x**2 } #=&gt; 2 </span><span class="inferred0"><a
195
+ name="line5"></a> 5 # </span><span class="marked1"><a name="line6"></a> 6
196
+ def argmax(&amp;block) </span><span class="marked0"><a name="line7"></a> 7
197
+ argbest(:&gt;, &amp;block) </span><span class="inferred1"><a
198
+ name="line8"></a> 8 end </span><span class="inferred0"><a name="line9"></a>
199
+ 9 </span><span class="inferred1"><a name="line10"></a>10 # Finds the
200
+ argument which minimizes the function given in the block trhu grid-search
201
+ minimization. </span><span class="inferred0"><a name="line11"></a>11 #
202
+ [-1,0,1,2].argmin {|x| x**2 } #=&gt; 0 </span><span class="inferred1"><a
203
+ name="line12"></a>12 # </span><span class="marked0"><a name="line13"></a>13
204
+ def argmin(&amp;block) </span><span class="marked1"><a name="line14"></a>14
205
+ argbest(:&lt;, &amp;block) </span><span class="inferred0"><a
206
+ name="line15"></a>15 end </span><span class="inferred1"><a
207
+ name="line16"></a>16 </span><span class="marked0"><a name="line17"></a>17
208
+ private </span><span class="inferred1"><a name="line18"></a>18 </span><span
209
+ class="marked0"><a name="line19"></a>19 def argbest(cmp) </span><span
210
+ class="marked1"><a name="line20"></a>20 best_arg, best_val = nil, nil
211
+ </span><span class="marked0"><a name="line21"></a>21 self.each do
212
+ |*curr_arg| </span><span class="marked1"><a name="line22"></a>22 curr_val =
213
+ yield(*curr_arg) </span><span class="marked0"><a name="line23"></a>23 if
214
+ best_val.nil? || curr_val.send(cmp, best_val) </span><span
215
+ class="marked1"><a name="line24"></a>24 best_val = curr_val </span><span
216
+ class="marked0"><a name="line25"></a>25 best_arg = curr_arg </span><span
217
+ class="inferred1"><a name="line26"></a>26 end </span><span
218
+ class="inferred0"><a name="line27"></a>27 end </span><span
219
+ class="marked1"><a name="line28"></a>28 best_arg </span><span
220
+ class="inferred0"><a name="line29"></a>29 end </span><span
221
+ class="inferred1"><a name="line30"></a>30 </span><span class="inferred0"><a
222
+ name="line31"></a>31 end </span><span class="inferred1"><a
223
+ name="line32"></a>32 </span><span class="marked0"><a name="line33"></a>33
224
+ module Enumerable </span><span class="marked1"><a name="line34"></a>34
225
+ include GridSearch </span><span class="inferred0"><a name="line35"></a>35
226
+ end </span><span class="inferred1"><a name="line36"></a>36 </span><span
227
+ class="marked0"><a name="line37"></a>37 class Array </span><span
228
+ class="marked1"><a name="line38"></a>38 include GridSearch </span><span
229
+ class="inferred0"><a name="line39"></a>39 end </span></pre>
230
+ <hr />
231
+ <p> Generated using the <a href='http://eigenclass.org/hiki.rb?rcov'> rcov
232
+ code coverage analysis tool for Ruby </a> version 0.8.1.2. </p>
233
+ <p>
234
+ <a href='http://validator.w3.org/check/referer'>
235
+ <img src='http://www.w3.org/Icons/valid-xhtml10' height='31' alt='Valid XHTML 1.0!' width='88' />
236
+ </a>
237
+ <a href='http://jigsaw.w3.org/css-validator/check/referer'>
238
+ <img src='http://jigsaw.w3.org/css-validator/images/vcss' alt='Valid CSS!' style='border:0;width:88px;height:31px' />
239
+ </a>
240
+ </p>
241
+ </body>
242
+ </html>
@@ -0,0 +1,141 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
+ <html lang='en' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'>
3
+ <head>
4
+ <title>
5
+ C0 code coverage information
6
+ </title>
7
+ <style type='text/css'>
8
+ body { background-color: rgb(240, 240, 245); }
9
+ </style>
10
+ <style type='text/css'>
11
+ span.cross-ref-title { font-size: 140%; } span.cross-ref a {
12
+ text-decoration: none; } span.cross-ref { background-color:#f3f7fa;
13
+ border: 1px dashed #333; margin: 1em; padding: 0.5em; overflow: hidden; }
14
+ a.crossref-toggle { text-decoration: none; } span.marked0 {
15
+ background-color: rgb(185, 210, 200); display: block; } span.marked1 {
16
+ background-color: rgb(190, 215, 205); display: block; } span.inferred0 {
17
+ background-color: rgb(175, 200, 200); display: block; } span.inferred1 {
18
+ background-color: rgb(180, 205, 205); display: block; } span.uncovered0 {
19
+ background-color: rgb(225, 110, 110); display: block; } span.uncovered1 {
20
+ background-color: rgb(235, 120, 120); display: block; } span.overview {
21
+ border-bottom: 8px solid black; } div.overview { border-bottom: 8px solid
22
+ black; } body { font-family: verdana, arial, helvetica; } div.footer {
23
+ font-size: 68%; margin-top: 1.5em; } h1, h2, h3, h4, h5, h6 {
24
+ margin-bottom: 0.5em; } h5 { margin-top: 0.5em; } .hidden { display: none;
25
+ } div.separator { height: 10px; } /* Commented out for better readability,
26
+ esp. on IE */ /* table tr td, table tr th { font-size: 68%; } td.value
27
+ table tr td { font-size: 11px; } */ table.percent_graph { height: 12px;
28
+ border: #808080 1px solid; empty-cells: show; } table.percent_graph
29
+ td.covered { height: 10px; background: #00f000; } table.percent_graph
30
+ td.uncovered { height: 10px; background: #e00000; } table.percent_graph
31
+ td.NA { height: 10px; background: #eaeaea; } table.report {
32
+ border-collapse: collapse; width: 100%; } table.report td.heading {
33
+ background: #dcecff; border: #d0d0d0 1px solid; font-weight: bold;
34
+ text-align: center; } table.report td.heading:hover { background: #c0ffc0;
35
+ } table.report td.text { border: #d0d0d0 1px solid; } table.report
36
+ td.value, table.report td.lines_total, table.report td.lines_code {
37
+ text-align: right; border: #d0d0d0 1px solid; } table.report tr.light {
38
+ background-color: rgb(240, 240, 245); } table.report tr.dark {
39
+ background-color: rgb(230, 230, 235); }
40
+ </style>
41
+ <script type='text/javascript'>
42
+ // <![CDATA[ function toggleCode( id ) { if ( document.getElementById )
43
+ elem = document.getElementById( id ); else if ( document.all ) elem =
44
+ eval( "document.all." + id ); else return false; elemStyle = elem.style;
45
+ if ( elemStyle.display != "block" ) { elemStyle.display = "block" } else {
46
+ elemStyle.display = "none" } return true; } // Make cross-references
47
+ hidden by default document.writeln( "<style
48
+ type=\"text/css\">span.cross-ref { display: none }</style>" ) // ]]>
49
+ </script>
50
+ </head>
51
+ <body>
52
+ <h3>
53
+ C0 code coverage information
54
+ </h3>
55
+ <p>
56
+ Generated on Tue Nov 04 04:48:28 -0200 2008 with
57
+ <a href='http://eigenclass.org/hiki/rcov'>
58
+ rcov 0.8.1.2
59
+ </a>
60
+ </p>
61
+ <hr />
62
+ <table class='report'> <thead> <tr> <td class='heading'> Name </td> <td
63
+ class='heading'> Total lines </td> <td class='heading'> Lines of code </td>
64
+ <td class='heading'> Total coverage </td> <td class='heading'> Code coverage
65
+ </td> </tr> </thead> <tbody> <tr class='light'> <td> TOTAL </td> <td
66
+ class='lines_total'> <tt> 320 </tt> </td> <td class='lines_code'> <tt> 172
67
+ </tt> </td> <td> <table cellspacing='0' align='right' cellpadding='0'> <tr>
68
+ <td> <tt class='coverage_total'> 100.0% </tt> &nbsp; </td> <td> <table
69
+ class='percent_graph' cellspacing='0' width='100' cellpadding='0'> <tr> <td
70
+ class='covered' width='100' /> <td class='uncovered' width='0' /> </tr>
71
+ </table> </td> </tr> </table> </td> <td> <table cellspacing='0'
72
+ align='right' cellpadding='0'> <tr> <td> <tt class='coverage_code'> 100.0%
73
+ </tt> &nbsp; </td> <td> <table class='percent_graph' cellspacing='0'
74
+ width='100' cellpadding='0'> <tr> <td class='covered' width='100' /> <td
75
+ class='uncovered' width='0' /> </tr> </table> </td> </tr> </table> </td>
76
+ </tr> <tr class='dark'> <td> <a
77
+ href='-home-adriano-software-ruby-Cartesian-lib-cartesian_rb.html'>
78
+ /home/adriano/software/ruby/Cartesian/lib/cartesian.rb </a> </td> <td
79
+ class='lines_total'> <tt> 161 </tt> </td> <td class='lines_code'> <tt> 52
80
+ </tt> </td> <td> <table cellspacing='0' align='right' cellpadding='0'> <tr>
81
+ <td> <tt class='coverage_total'> 100.0% </tt> &nbsp; </td> <td> <table
82
+ class='percent_graph' cellspacing='0' width='100' cellpadding='0'> <tr> <td
83
+ class='covered' width='100' /> <td class='uncovered' width='0' /> </tr>
84
+ </table> </td> </tr> </table> </td> <td> <table cellspacing='0'
85
+ align='right' cellpadding='0'> <tr> <td> <tt class='coverage_code'> 100.0%
86
+ </tt> &nbsp; </td> <td> <table class='percent_graph' cellspacing='0'
87
+ width='100' cellpadding='0'> <tr> <td class='covered' width='100' /> <td
88
+ class='uncovered' width='0' /> </tr> </table> </td> </tr> </table> </td>
89
+ </tr> <tr class='light'> <td> <a
90
+ href='-home-adriano-software-ruby-Cartesian-lib-cartesian_iterator_rb.html'>
91
+ /home/adriano/software/ruby/Cartesian/lib/cartesian_iterator.rb </a> </td>
92
+ <td class='lines_total'> <tt> 108 </tt> </td> <td class='lines_code'> <tt>
93
+ 89 </tt> </td> <td> <table cellspacing='0' align='right' cellpadding='0'>
94
+ <tr> <td> <tt class='coverage_total'> 100.0% </tt> &nbsp; </td> <td> <table
95
+ class='percent_graph' cellspacing='0' width='100' cellpadding='0'> <tr> <td
96
+ class='covered' width='100' /> <td class='uncovered' width='0' /> </tr>
97
+ </table> </td> </tr> </table> </td> <td> <table cellspacing='0'
98
+ align='right' cellpadding='0'> <tr> <td> <tt class='coverage_code'> 100.0%
99
+ </tt> &nbsp; </td> <td> <table class='percent_graph' cellspacing='0'
100
+ width='100' cellpadding='0'> <tr> <td class='covered' width='100' /> <td
101
+ class='uncovered' width='0' /> </tr> </table> </td> </tr> </table> </td>
102
+ </tr> <tr class='dark'> <td> <a
103
+ href='-home-adriano-software-ruby-Cartesian-lib-extensions_rb.html'>
104
+ /home/adriano/software/ruby/Cartesian/lib/extensions.rb </a> </td> <td
105
+ class='lines_total'> <tt> 12 </tt> </td> <td class='lines_code'> <tt> 5
106
+ </tt> </td> <td> <table cellspacing='0' align='right' cellpadding='0'> <tr>
107
+ <td> <tt class='coverage_total'> 100.0% </tt> &nbsp; </td> <td> <table
108
+ class='percent_graph' cellspacing='0' width='100' cellpadding='0'> <tr> <td
109
+ class='covered' width='100' /> <td class='uncovered' width='0' /> </tr>
110
+ </table> </td> </tr> </table> </td> <td> <table cellspacing='0'
111
+ align='right' cellpadding='0'> <tr> <td> <tt class='coverage_code'> 100.0%
112
+ </tt> &nbsp; </td> <td> <table class='percent_graph' cellspacing='0'
113
+ width='100' cellpadding='0'> <tr> <td class='covered' width='100' /> <td
114
+ class='uncovered' width='0' /> </tr> </table> </td> </tr> </table> </td>
115
+ </tr> <tr class='light'> <td> <a
116
+ href='-home-adriano-software-ruby-Cartesian-lib-grid_search_rb.html'>
117
+ /home/adriano/software/ruby/Cartesian/lib/grid_search.rb </a> </td> <td
118
+ class='lines_total'> <tt> 39 </tt> </td> <td class='lines_code'> <tt> 26
119
+ </tt> </td> <td> <table cellspacing='0' align='right' cellpadding='0'> <tr>
120
+ <td> <tt class='coverage_total'> 100.0% </tt> &nbsp; </td> <td> <table
121
+ class='percent_graph' cellspacing='0' width='100' cellpadding='0'> <tr> <td
122
+ class='covered' width='100' /> <td class='uncovered' width='0' /> </tr>
123
+ </table> </td> </tr> </table> </td> <td> <table cellspacing='0'
124
+ align='right' cellpadding='0'> <tr> <td> <tt class='coverage_code'> 100.0%
125
+ </tt> &nbsp; </td> <td> <table class='percent_graph' cellspacing='0'
126
+ width='100' cellpadding='0'> <tr> <td class='covered' width='100' /> <td
127
+ class='uncovered' width='0' /> </tr> </table> </td> </tr> </table> </td>
128
+ </tr> </tbody> </table>
129
+ <hr />
130
+ <p> Generated using the <a href='http://eigenclass.org/hiki.rb?rcov'> rcov
131
+ code coverage analysis tool for Ruby </a> version 0.8.1.2. </p>
132
+ <p>
133
+ <a href='http://validator.w3.org/check/referer'>
134
+ <img src='http://www.w3.org/Icons/valid-xhtml11' height='31' alt='Valid XHTML 1.1!' width='88' />
135
+ </a>
136
+ <a href='http://jigsaw.w3.org/css-validator/check/referer'>
137
+ <img src='http://jigsaw.w3.org/css-validator/images/vcss' alt='Valid CSS!' style='border:0;width:88px;height:31px' />
138
+ </a>
139
+ </p>
140
+ </body>
141
+ </html>
@@ -1,16 +1,19 @@
1
+ #!/usr/bin/env ruby
1
2
  require 'test/unit'
2
3
 
3
4
  $:.unshift File.join(File.dirname(__FILE__), "..", "lib")
4
- require 'cartesian'
5
+ require 'cartesian'
5
6
  require 'extensions'
6
7
 
7
8
  class TestCartesian < Test::Unit::TestCase
9
+
8
10
  def test_arrays
9
11
  foo = [1,2,3]
10
12
  bar = %w{a b c}
11
13
  expected = [[1, "a"], [1, "b"], [1, "c"], [2, "a"], [2, "b"],
12
14
  [2, "c"], [3, "a"], [3, "b"], [3, "c"]]
13
15
  assert(foo.x(bar).to_a == expected)
16
+ assert(Cartesian.product(foo,bar) == expected)
14
17
  end
15
18
 
16
19
  def test_ranges
@@ -19,6 +22,26 @@ class TestCartesian < Test::Unit::TestCase
19
22
  expected = [[1, 4], [1, 5], [1, 6], [2, 4], [2, 5],
20
23
  [2, 6], [3, 4], [3, 5], [3, 6]]
21
24
  assert(foo.x(bar).to_a == expected)
25
+ assert(Cartesian.product(foo,bar) == expected)
26
+ end
27
+
28
+ def test_product
29
+ c = [1].x([2])
30
+ c.x([3])
31
+ assert_equal [1].x([2]), c
32
+ end
33
+
34
+ def test_left_product
35
+ c = [1].right_product([2])
36
+ d = [1].left_product([2])
37
+ e = [2].left_product([1])
38
+ assert_not_equal c, d
39
+ assert_equal c, e
40
+ c = [1].x([2]).right_product([3])
41
+ d = [1].x([2]).left_product([3])
42
+ e = [2].x([3]).left_product([1])
43
+ assert_not_equal c, d
44
+ assert_equal c, e
22
45
  end
23
46
 
24
47
  def test_mixed
@@ -27,29 +50,34 @@ class TestCartesian < Test::Unit::TestCase
27
50
  expected = [[1, "a"], [1, "b"], [1, "c"], [2, "a"], [2, "b"],
28
51
  [2, "c"], [3, "a"], [3, "b"], [3, "c"]]
29
52
  assert(foo.x(bar).to_a == expected)
30
- end
31
-
32
- def test_power
33
- ary = [1,2,3]
34
- assert_raise(ArgumentError) { ary**(-1) }
35
- assert_equal [], ary**0
36
- assert_equal ary, ary**1
37
- expected = [[0, 0, 0], [0, 0, 1], [0, 1, 0],\
38
- [0, 1, 1], [1, 0, 0], [1, 0, 1],\
39
- [1, 1, 0], [1, 1, 1]]
40
- assert_equal expected, ([0,1]**3).to_a
41
- end
42
-
43
- def test_argmin
44
- assert_equal [0,0], ((-3..3)**2).argmin {|x,y| x**2+y**2 }
45
- end
46
-
47
- def test_argmax
48
- values = []
49
- -3.step(3, 0.25) {|val| values << val }
50
- x, y = (values**2).argmax {|x,y| x**2+y**2 }
51
- assert x.among?([-3,3])
52
- assert y.among?([-3,3])
53
- end
54
-
53
+ assert(Cartesian.product(foo,bar) == expected) ##################
54
+ end
55
+
56
+ def test_power
57
+ ary = [1,2,3]
58
+ assert_raise(ArgumentError) { ary**(-1) }
59
+ assert_equal [], ary**0
60
+ assert_equal ary, ary**1
61
+ expected = [[0, 0, 0], [0, 0, 1], [0, 1, 0],\
62
+ [0, 1, 1], [1, 0, 0], [1, 0, 1],\
63
+ [1, 1, 0], [1, 1, 1]]
64
+ assert_equal expected, ([0,1]**3).to_a
65
+ end
66
+
67
+ def test_argmin
68
+ assert_equal [0,0], ((-3..3)**2).argmin {|x,y| x**2+y**2 }
69
+ end
70
+
71
+ def test_argmax
72
+ values = []
73
+ -3.step(3, 0.25) {|val| values << val }
74
+ x, y = (values**2).argmax {|x,y| x**2+y**2 }
75
+ assert x.among?([-3,3])
76
+ assert y.among?([-3,3])
77
+ end
78
+
79
+ def test_joined_cartesian
80
+ assert_equal ["1A", "1B", "2A", "2B"], [1,2].joined_cartesian(%w<A B>)
81
+ end
82
+
55
83
  end
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env ruby
2
+ require 'test/unit'
3
+
4
+ $:.unshift File.join(File.dirname(__FILE__), "..", "lib")
5
+ require 'cartesian'
6
+ require 'extensions'
7
+
8
+ class TestCartesianIterator < Test::Unit::TestCase
9
+
10
+ def test_equal
11
+ assert_equal [1].x([2]), [1].x([2])
12
+ assert_not_equal [1].x([2]), [1].x([3])
13
+ end
14
+
15
+
16
+ def test_dup
17
+ c = [1,2].x([3,4])
18
+ d = c.dup
19
+ e = d.x([5,6])
20
+ assert_not_equal(e, c)
21
+ assert_equal(c, d)
22
+ end
23
+
24
+ def test_iterator_next_and_restart
25
+ foo = [1,2]
26
+ assert_equal 1, foo.next
27
+ assert_equal 2, foo.next
28
+ assert_equal nil, foo.next
29
+ foo.start
30
+ assert_equal 1, foo.next
31
+
32
+ end
33
+
34
+ end
metadata CHANGED
@@ -1,53 +1,68 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.9.2
3
- specification_version: 1
4
2
  name: Cartesian
5
3
  version: !ruby/object:Gem::Version
6
- version: 0.3.0
7
- date: 2007-10-29 00:00:00 -03:00
8
- summary: The Cartesian module provide methods for the calculation of the cartesian producted between two enumberable objects. It can also be easily mixed in into any enumberable class, i.e. any class with Enumerable module mixed in.
9
- require_paths:
10
- - lib
11
- email: adriano.mitre@gmail.com
12
- homepage: http://rubyforge.org/projects/cartesian/
13
- rubyforge_project:
14
- description:
15
- autorequire: cartesian.rb
16
- default_executable:
17
- bindir: bin
18
- has_rdoc: true
19
- required_ruby_version: !ruby/object:Gem::Version::Requirement
20
- requirements:
21
- - - ">"
22
- - !ruby/object:Gem::Version
23
- version: 0.0.0
24
- version:
4
+ version: 0.4.1
25
5
  platform: ruby
26
- signing_key:
27
- cert_chain:
28
- post_install_message:
29
6
  authors:
30
7
  - Adriano Brito Mitre
8
+ autorequire: cartesian.rb
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-11-04 00:00:00 -02:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description:
17
+ email: adriano.mitre@gmail.com
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files: []
23
+
31
24
  files:
32
25
  - tests/tc_cartesian.rb
33
26
  - tests/benchmark.rb
34
27
  - tests/tc_extensions.rb
35
28
  - tests/tc_grid_search.rb
29
+ - tests/coverage
30
+ - tests/coverage/-home-adriano-software-ruby-Cartesian-lib-cartesian_rb.html
31
+ - tests/coverage/-home-adriano-software-ruby-Cartesian-lib-grid_search_rb.html
32
+ - tests/coverage/index.html
33
+ - tests/coverage/-home-adriano-software-ruby-Cartesian-lib-cartesian_iterator_rb.html
34
+ - tests/coverage/-home-adriano-software-ruby-Cartesian-lib-extensions_rb.html
35
+ - tests/tc_cartesian_iterator.rb
36
+ - lib/recursive.rb
36
37
  - lib/cartesian_iterator.rb
37
38
  - lib/cartesian.rb
38
39
  - lib/grid_search.rb
39
40
  - lib/extensions.rb
40
- test_files:
41
- - tests/tc_cartesian.rb
41
+ has_rdoc: true
42
+ homepage: http://rubyforge.org/projects/cartesian/
43
+ post_install_message:
42
44
  rdoc_options: []
43
45
 
44
- extra_rdoc_files: []
45
-
46
- executables: []
47
-
48
- extensions: []
49
-
46
+ require_paths:
47
+ - lib
48
+ required_ruby_version: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: "0"
53
+ version:
54
+ required_rubygems_version: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ version: "0"
59
+ version:
50
60
  requirements: []
51
61
 
52
- dependencies: []
53
-
62
+ rubyforge_project:
63
+ rubygems_version: 1.0.1
64
+ signing_key:
65
+ specification_version: 2
66
+ summary: The Cartesian module provide methods for the calculation of the cartesian producted between two enumberable objects. It can also be easily mixed in into any enumberable class, i.e. any class with Enumerable module mixed in.
67
+ test_files:
68
+ - tests/tc_cartesian.rb