rubylabs 0.5.5 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/lib/marslab.rb +1147 -0
- data/lib/randomlab.rb +436 -201
- data/lib/rubylabs.rb +15 -14
- data/test/mars_test.rb +519 -0
- data/test/random_test.rb +75 -19
- metadata +4 -4
- data/lib/temps.rb +0 -41
- data/test/temps_test.rb +0 -24
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.
|
4
|
+
version: 0.6.2
|
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: 2010-01-11 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -64,13 +64,13 @@ files:
|
|
64
64
|
- lib/hashlab.rb
|
65
65
|
- lib/introlab.rb
|
66
66
|
- lib/iterationlab.rb
|
67
|
+
- lib/marslab.rb
|
67
68
|
- lib/randomlab.rb
|
68
69
|
- lib/recursionlab.rb
|
69
70
|
- lib/rubylabs.rb
|
70
71
|
- lib/sievelab.rb
|
71
72
|
- lib/sortlab.rb
|
72
73
|
- lib/spherelab.rb
|
73
|
-
- lib/temps.rb
|
74
74
|
- lib/tsplab.rb
|
75
75
|
- lib/viewer.rb
|
76
76
|
has_rdoc: true
|
@@ -105,10 +105,10 @@ test_files:
|
|
105
105
|
- test/bit_test.rb
|
106
106
|
- test/encryption_test.rb
|
107
107
|
- test/iteration_test.rb
|
108
|
+
- test/mars_test.rb
|
108
109
|
- test/random_test.rb
|
109
110
|
- test/recursion_test.rb
|
110
111
|
- test/rubylabs_test.rb
|
111
112
|
- test/sieve_test.rb
|
112
113
|
- test/sphere_test.rb
|
113
|
-
- test/temps_test.rb
|
114
114
|
- test/test_helper.rb
|
data/lib/temps.rb
DELETED
@@ -1,41 +0,0 @@
|
|
1
|
-
|
2
|
-
=begin rdoc
|
3
|
-
|
4
|
-
== Ruby Workbench
|
5
|
-
|
6
|
-
Chapter 2, <em>The Ruby Workbench</em>, is an introduction to Ruby and IRB. There
|
7
|
-
are no "experiments," but the chapter does describe two methods. The code here is
|
8
|
-
available so students can make a copy by calling the +checkout+ method.
|
9
|
-
|
10
|
-
=end
|
11
|
-
|
12
|
-
module RubyLabs
|
13
|
-
|
14
|
-
module Temps
|
15
|
-
|
16
|
-
=begin rdoc
|
17
|
-
Convert the temperature +f+ (in degrees Fahrenheit) into the equivalent
|
18
|
-
temperature in degrees Celsius.
|
19
|
-
=end
|
20
|
-
|
21
|
-
# :begin :celsius
|
22
|
-
def celsius(f)
|
23
|
-
(f - 32) * 5 / 9
|
24
|
-
end
|
25
|
-
# :end :celsius
|
26
|
-
|
27
|
-
=begin rdoc
|
28
|
-
Fill in the body of this method with an equation that converts a number of
|
29
|
-
degrees on the Celsius scale to the equivalent on the Fahrenheit scale.
|
30
|
-
=end
|
31
|
-
|
32
|
-
# :begin :fahrenheit
|
33
|
-
def fahrenheit(c)
|
34
|
-
|
35
|
-
end
|
36
|
-
# :end :fahrenheit
|
37
|
-
|
38
|
-
|
39
|
-
end # Temp
|
40
|
-
|
41
|
-
end # RubyLabs
|
data/test/temps_test.rb
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
2
|
-
require 'test_helper'
|
3
|
-
|
4
|
-
include Temps
|
5
|
-
|
6
|
-
class TestTemps < Test::Unit::TestCase
|
7
|
-
|
8
|
-
# Check a few Faherenheit-to-Celsius conversions
|
9
|
-
|
10
|
-
def test_01_celsius
|
11
|
-
print "\n celsius"
|
12
|
-
assert_equal 100, celsius(212)
|
13
|
-
assert_equal 0, celsius(32)
|
14
|
-
assert_equal 26, celsius(80)
|
15
|
-
assert_equal "26.6666", celsius(80.0).to_s.slice(0..6)
|
16
|
-
end
|
17
|
-
|
18
|
-
# The fahrenheit method is a stub...
|
19
|
-
|
20
|
-
def test_02_fahrenheit
|
21
|
-
print "\n fahrenheit"
|
22
|
-
assert_nil fahrenheit(100)
|
23
|
-
end
|
24
|
-
end
|