Cartesian 0.4.1 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,141 +0,0 @@
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,83 +0,0 @@
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 TestCartesian < Test::Unit::TestCase
9
-
10
- def test_arrays
11
- foo = [1,2,3]
12
- bar = %w{a b c}
13
- expected = [[1, "a"], [1, "b"], [1, "c"], [2, "a"], [2, "b"],
14
- [2, "c"], [3, "a"], [3, "b"], [3, "c"]]
15
- assert(foo.x(bar).to_a == expected)
16
- assert(Cartesian.product(foo,bar) == expected)
17
- end
18
-
19
- def test_ranges
20
- foo = 1..3
21
- bar = 4..6
22
- expected = [[1, 4], [1, 5], [1, 6], [2, 4], [2, 5],
23
- [2, 6], [3, 4], [3, 5], [3, 6]]
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
45
- end
46
-
47
- def test_mixed
48
- foo = 1..3
49
- bar = %w{a b c}
50
- expected = [[1, "a"], [1, "b"], [1, "c"], [2, "a"], [2, "b"],
51
- [2, "c"], [3, "a"], [3, "b"], [3, "c"]]
52
- assert(foo.x(bar).to_a == expected)
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
-
83
- end
@@ -1,34 +0,0 @@
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
@@ -1,12 +0,0 @@
1
- require 'test/unit'
2
-
3
- $:.unshift File.join(File.dirname(__FILE__), "..", "lib")
4
- require 'extensions'
5
-
6
- class TestExtensions < Test::Unit::TestCase
7
- def test_among?
8
- assert 1.among?([1,2,3])
9
- assert ! 7.among?([1,2,3])
10
- assert (3.0).among?([1,2,3])
11
- end
12
- end
@@ -1,15 +0,0 @@
1
- require 'test/unit'
2
-
3
- $:.unshift File.join(File.dirname(__FILE__), "..", "lib")
4
- require 'grid_search'
5
-
6
- class TestCartesian < Test::Unit::TestCase
7
- def test_argmin
8
- assert_equal 0, *[-1,0,1].argmin {|x| x**2 }
9
- end
10
-
11
- def test_argmax
12
- assert_equal 0, *[-2,-1,0].argmax {|x| x**3 }
13
- end
14
-
15
- end