fizz-buzz 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,21 +1,23 @@
1
1
  = fizz-buzz
2
2
 
3
+ {<img src="https://secure.travis-ci.org/kerrizor/fizz-buzz.png" />}[http://travis-ci.org/kerrizor/fizz-buzz]
4
+
5
+
3
6
  == Why?
4
7
 
5
8
  In interviews, I'm constantly asked to whiteboard (or actually code) my solution to the FizzBuzz problem. Its not a terribly challenging question:
6
9
 
7
10
  "Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”."
8
11
 
9
- Most solid programmers who know their chops should be able to write it on paper in under 5 minutes. Lately its become one of the more fashionable interview questions, and while FizzBuzz problems will weed out the utterly lost and clueless, it really should be the first step in evaluating a candidate's potential, not the last.
12
+ Most solid programmers who know their chops should be able to write it on paper in under 5 minutes. Lately its become one of the more fashionable interview questions, and while FizzBuzz problems will weed out the utterly lost and clueless, it really should be the first step, not the last, in evaluating a candidate's potential.
10
13
 
11
- With that in mind, and suffer from insomnia, I decided to go a step further:
14
+ With that in mind (and suffering from insomnia), I decided to go a step further:
12
15
 
13
16
  * TDD
14
- * making it a gem
15
- * query methods
17
+ * release it a gem
18
+ * extending Fixnum to add query methods
16
19
  * putting it on the githubs
17
20
 
18
-
19
21
  More on FizzBuzz problems, and how they fit into the interview process
20
22
 
21
23
  * http://c2.com/cgi/wiki?FizzBuzzTest
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.0
1
+ 0.3.1
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{fizz-buzz}
8
- s.version = "0.3.0"
8
+ s.version = "0.3.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Kerri Miller"]
12
- s.date = %q{2011-11-26}
12
+ s.date = %q{2011-11-28}
13
13
  s.description = %q{I got sick of doing this test in interviews, so next time someone asks me to do so, I'm going to instead hand them a business card with a URL for this gem on it.}
14
14
  s.email = %q{kerrizor@kerrizor.com}
15
15
  s.extra_rdoc_files = [
@@ -28,19 +28,19 @@ class Fixnum
28
28
 
29
29
  # For testing the Fizz-, Buzz-, or Fizzbuzz-ness of a Fixnum
30
30
  # 3.fizz? # => true
31
- # 5.buzz? # => nil
31
+ # 3.buzz? # => false
32
32
  # 15.fizzbuzz? # => true
33
33
 
34
34
  def fizz?
35
- return true if (self % 3) == 0
35
+ self % 3 == 0
36
36
  end
37
37
 
38
38
  def buzz?
39
- return true if (self % 5) == 0
39
+ self % 5 == 0
40
40
  end
41
41
 
42
42
  def fizzbuzz?
43
- return true if (self % 15) == 0
43
+ self % 15 == 0
44
44
  end
45
45
 
46
46
  end
@@ -1,6 +1,6 @@
1
1
  require 'helper'
2
2
 
3
- class TestFizzBuzz < MiniTest::Unit::TestCase
3
+ class TestFizzBuzz < Test::Unit::TestCase
4
4
 
5
5
  def test_new_fizzbuzz
6
6
  assert_instance_of FizzBuzz, FizzBuzz.new
@@ -36,21 +36,21 @@ class TestFizzBuzz < MiniTest::Unit::TestCase
36
36
  def test_will_it_fizz
37
37
  assert_respond_to 4, :fizz?
38
38
  assert 3.fizz?
39
- assert_nil 2.fizz?
39
+ assert !2.fizz?
40
40
  end
41
41
 
42
42
 
43
43
  def test_will_it_buzz
44
44
  assert_respond_to 4, :buzz?
45
45
  assert 5.buzz?
46
- assert_nil 2.buzz?
46
+ assert !2.buzz?
47
47
  end
48
48
 
49
49
 
50
50
  def test_will_it_fizzbuzz
51
51
  assert_respond_to 4, :fizzbuzz?
52
52
  assert 30.fizzbuzz?
53
- assert_nil 2.fizzbuzz?
53
+ assert !2.fizzbuzz?
54
54
  end
55
55
 
56
56
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fizz-buzz
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,12 +9,12 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-11-26 00:00:00.000000000 -08:00
12
+ date: 2011-11-28 00:00:00.000000000 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: shoulda
17
- requirement: &2152149300 !ruby/object:Gem::Requirement
17
+ requirement: &2172678740 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: '0'
23
23
  type: :development
24
24
  prerelease: false
25
- version_requirements: *2152149300
25
+ version_requirements: *2172678740
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: bundler
28
- requirement: &2152148820 !ruby/object:Gem::Requirement
28
+ requirement: &2172678260 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ~>
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: 1.0.0
34
34
  type: :development
35
35
  prerelease: false
36
- version_requirements: *2152148820
36
+ version_requirements: *2172678260
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: jeweler
39
- requirement: &2152148340 !ruby/object:Gem::Requirement
39
+ requirement: &2172677780 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ~>
@@ -44,10 +44,10 @@ dependencies:
44
44
  version: 1.6.4
45
45
  type: :development
46
46
  prerelease: false
47
- version_requirements: *2152148340
47
+ version_requirements: *2172677780
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: rcov
50
- requirement: &2152147860 !ruby/object:Gem::Requirement
50
+ requirement: &2172677300 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
53
  - - ! '>='
@@ -55,7 +55,7 @@ dependencies:
55
55
  version: '0'
56
56
  type: :development
57
57
  prerelease: false
58
- version_requirements: *2152147860
58
+ version_requirements: *2172677300
59
59
  description: I got sick of doing this test in interviews, so next time someone asks
60
60
  me to do so, I'm going to instead hand them a business card with a URL for this
61
61
  gem on it.
@@ -93,7 +93,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
93
93
  version: '0'
94
94
  segments:
95
95
  - 0
96
- hash: 1542606764575001063
96
+ hash: 2653157410594330350
97
97
  required_rubygems_version: !ruby/object:Gem::Requirement
98
98
  none: false
99
99
  requirements: