rubylabs 0.9.0 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +15 -6
- data/Rakefile +3 -0
- data/VERSION +1 -1
- data/lib/bitlab.rb +593 -328
- data/lib/demos.rb +20 -9
- data/lib/elizalab.rb +660 -507
- data/lib/hashlab.rb +289 -192
- data/lib/introlab.rb +33 -38
- data/lib/iterationlab.rb +117 -61
- data/lib/marslab.rb +608 -475
- data/lib/randomlab.rb +227 -121
- data/lib/recursionlab.rb +197 -140
- data/lib/rubylabs.rb +936 -390
- data/lib/sievelab.rb +32 -24
- data/lib/spherelab.rb +308 -220
- data/lib/tsplab.rb +634 -312
- data/test/bit_test.rb +4 -4
- data/test/tsp_test.rb +18 -0
- metadata +2 -2
data/test/bit_test.rb
CHANGED
@@ -16,25 +16,25 @@ class TestBits < Test::Unit::TestCase
|
|
16
16
|
assert_equal c0.to_s, "1010"
|
17
17
|
assert_equal c0.length, 4
|
18
18
|
assert_equal c0.value, 10
|
19
|
-
assert_equal c0.
|
19
|
+
assert_equal c0.class, Code
|
20
20
|
|
21
21
|
c1 = 10.code(6)
|
22
22
|
assert_equal c1.to_s, "001010"
|
23
23
|
assert_equal c1.length, 6
|
24
24
|
assert_equal c1.value, 10
|
25
|
-
assert_equal c1.
|
25
|
+
assert_equal c1.class, Code
|
26
26
|
|
27
27
|
c2 = 10.code(:hex)
|
28
28
|
assert_equal c2.to_s, "A"
|
29
29
|
assert_equal c2.length, 4
|
30
30
|
assert_equal c2.value, 10
|
31
|
-
assert_equal c2.
|
31
|
+
assert_equal c2.class, HexCode
|
32
32
|
|
33
33
|
c3 = 10.code(:hex, 2)
|
34
34
|
assert_equal c3.to_s, "0A"
|
35
35
|
assert_equal c3.length, 8
|
36
36
|
assert_equal c3.value, 10
|
37
|
-
assert_equal c3.
|
37
|
+
assert_equal c3.class, HexCode
|
38
38
|
end
|
39
39
|
|
40
40
|
# Parity bit tests
|
data/test/tsp_test.rb
CHANGED
@@ -137,4 +137,22 @@ class TestTSP < Test::Unit::TestCase
|
|
137
137
|
assert_in_delta (popsize*ngen/2), Tour.count, 100
|
138
138
|
end
|
139
139
|
|
140
|
+
# exhaustive search -- a method named xsearch implements the strategy used in
|
141
|
+
# the test above.
|
142
|
+
|
143
|
+
def test_13_xsearch
|
144
|
+
assert_equal @@best.cost, xsearch(@@map).cost
|
145
|
+
end
|
146
|
+
|
147
|
+
# Check the structure and iterators for a random map of 10 cities.
|
148
|
+
|
149
|
+
def test_14_make_map
|
150
|
+
m = Map.new(10)
|
151
|
+
assert_equal 10, m.size
|
152
|
+
assert_equal Array(0..9), m.labels
|
153
|
+
assert_equal [0,1], m.first
|
154
|
+
m.rest { |i,j| @last_pair = [i,j] }
|
155
|
+
assert_equal [8,9], @last_pair
|
156
|
+
end
|
157
|
+
|
140
158
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubylabs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- conery
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2011-01-07 00:00:00 -08:00
|
13
13
|
default_executable: lab-setup.rb
|
14
14
|
dependencies: []
|
15
15
|
|