rubylabs 0.9.0 → 0.9.1

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.
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.base, :binary
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.base, :binary
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.base, :hex
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.base, :hex
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.0
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: 2010-12-19 00:00:00 -08:00
12
+ date: 2011-01-07 00:00:00 -08:00
13
13
  default_executable: lab-setup.rb
14
14
  dependencies: []
15
15