ruby-fizzbuzz 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/CHANGES +12 -0
- data/CHANGES.rdoc +12 -0
- data/README.rdoc +2 -0
- data/Rakefile +2 -2
- data/TODO +4 -4
- data/VERSION +1 -1
- data/ext/fizzbuzz/fizzbuzz.c +11 -26
- data/ext/fizzbuzz/fizzbuzz.h +9 -7
- data/lib/fizzbuzz/version.rb +1 -1
- data/ruby-fizzbuzz.gemspec +5 -5
- metadata +49 -25
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MWYzNWE4ZTE5NzkyODAwMmM0ZjA5N2UxODZmYmUwNTNmZTI0N2YzNQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YWRjODkyYmU3MTFkNjQxMWVjOGUxNTQ0YTliZjkyOTgxMDIwMTk3Ng==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MzlmMzNmMDRkYzRmODUxMDRiMTZlNzZmZjMxY2YwYzQyMmVkYTU3YmJiODNk
|
10
|
+
OTM4OWZlYzQ5YjY4NDEzNGNiNzU5YWUxZDNkN2UwYTRmZDk5ZWJkODU4Y2Jm
|
11
|
+
Njc3MzVhNTRhNDc5ZGQ0OWFjYjAyM2MyMTM0ZmYxNDI1MmRlZmU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ODE4OGU2ZTU5MTAzNDJkYjVmZGM5MzY1NzBiZWFlOGM3NThjMWY4MDhiNWE5
|
14
|
+
ZWYxYzljZjIzZDYyYzgyYTNkNTZkNTBlZjk5NjdiZGMwY2RlZTcyNWMwYzM5
|
15
|
+
ZjAxNDkxM2Y1ZGEwMThkYTI4NWM3MTUwMTRiOGVjNmViNDczMWQ=
|
data/CHANGES
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
fizzbuzz (0.0.6)
|
2
|
+
|
3
|
+
* Fixed issue reported by LLVM (clang);
|
4
|
+
* Updated development dependencies;
|
5
|
+
* Added Ruby 2.1.0 to Travis CI;
|
6
|
+
* Added BitDeli and Gemnasium integration;
|
7
|
+
* Re-factored and cleaned up small portions of code;
|
8
|
+
* Made Rake "test" task to be the default tasks;
|
9
|
+
* Updated the ".gitignore" file to cover Bundler, rbenv, etc.
|
10
|
+
|
11
|
+
-- Krzysztof Wilczynski <krzysztof.wilczynski@linux.com> Sun, 23 Feb 2014 13:52:08 +0000
|
12
|
+
|
1
13
|
fizzbuzz (0.0.5)
|
2
14
|
|
3
15
|
* Added integration with Array and Range types;
|
data/CHANGES.rdoc
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
fizzbuzz (0.0.6)
|
2
|
+
|
3
|
+
* Fixed issue reported by LLVM (clang);
|
4
|
+
* Updated development dependencies;
|
5
|
+
* Added Ruby 2.1.0 to Travis CI;
|
6
|
+
* Added BitDeli and Gemnasium integration;
|
7
|
+
* Re-factored and cleaned up small portions of code;
|
8
|
+
* Made Rake "test" task to be the default tasks;
|
9
|
+
* Updated the ".gitignore" file to cover Bundler, rbenv, etc.
|
10
|
+
|
11
|
+
-- Krzysztof Wilczynski <krzysztof.wilczynski@linux.com> Sun, 23 Feb 2014 13:52:08 +0000
|
12
|
+
|
1
13
|
fizzbuzz (0.0.5)
|
2
14
|
|
3
15
|
* Added integration with Array and Range types;
|
data/README.rdoc
CHANGED
@@ -8,3 +8,5 @@ for arbitrary large numeric values via the Bignum class.
|
|
8
8
|
{<img src="https://badge.fury.io/rb/ruby-fizzbuzz.png" alt="Gem Version" />}[http://badge.fury.io/rb/ruby-fizzbuzz]
|
9
9
|
{<img src="https://coveralls.io/repos/kwilczynski/ruby-fizzbuzz/badge.png?branch=master" alt="Coverage Status" />}[https://coveralls.io/r/kwilczynski/ruby-fizzbuzz?branch=master]
|
10
10
|
{<img src="https://codeclimate.com/github/kwilczynski/ruby-fizzbuzz.png" />}[https://codeclimate.com/github/kwilczynski/ruby-fizzbuzz]
|
11
|
+
{<img src="https://gemnasium.com/kwilczynski/ruby-fizzbuzz.png" alt="Dependency Status" />}[https://gemnasium.com/kwilczynski/ruby-fizzbuzz]
|
12
|
+
{<img src="https://d2weczhvl823v0.cloudfront.net/kwilczynski/ruby-fizzbuzz/trend.png" alt="Bitdeli Badge" />}[https://bitdeli.com/free]
|
data/Rakefile
CHANGED
@@ -20,7 +20,7 @@
|
|
20
20
|
# limitations under the License.
|
21
21
|
#
|
22
22
|
|
23
|
-
gem 'rdoc', '>=
|
23
|
+
gem 'rdoc', '>= 4.1.1'
|
24
24
|
|
25
25
|
begin
|
26
26
|
require 'rake'
|
@@ -90,7 +90,7 @@ task :benchmark, [:first] => :test do |t,argument|
|
|
90
90
|
end
|
91
91
|
end
|
92
92
|
|
93
|
-
task :default => :
|
93
|
+
task :default => :test
|
94
94
|
|
95
95
|
# vim: set ts=2 sw=2 sts=2 et :
|
96
96
|
# encoding: utf-8
|
data/TODO
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
fizzbuzz (0.0.
|
1
|
+
fizzbuzz (0.0.8)
|
2
2
|
|
3
3
|
* Improve github project page;
|
4
4
|
* Re-factor unit tests to make them more idiomatic (maybe move to Rspec and BDD?).
|
5
5
|
|
6
|
-
-- Krzysztof Wilczynski <krzysztof.wilczynski@linux.com>
|
6
|
+
-- Krzysztof Wilczynski <krzysztof.wilczynski@linux.com> Sun, 23 Feb 2014 13:52:08 +0000
|
7
7
|
|
8
|
-
fizzbuzz (0.0.
|
8
|
+
fizzbuzz (0.0.7)
|
9
9
|
|
10
10
|
* Move to YARD from RDoc (as RDoc is very bad, really);
|
11
11
|
* Add pure-Ruby implementation;
|
@@ -13,4 +13,4 @@ fizzbuzz (0.0.6)
|
|
13
13
|
* Add Doxygen style comments for other functions in the source code;
|
14
14
|
* Improve documentation i.e. source code commenting, README file, etc.
|
15
15
|
|
16
|
-
-- Krzysztof Wilczynski <krzysztof.wilczynski@linux.com>
|
16
|
+
-- Krzysztof Wilczynski <krzysztof.wilczynski@linux.com> Sun, 23 Feb 2014 13:52:08 +0000
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.6
|
data/ext/fizzbuzz/fizzbuzz.c
CHANGED
@@ -31,8 +31,8 @@ VALUE rb_fb_eRangeError = Qnil;
|
|
31
31
|
void Init_fizzbuzz(void);
|
32
32
|
|
33
33
|
static VALUE fizzbuzz_evaluate(VALUE value);
|
34
|
-
static VALUE fizzbuzz_values(VALUE object,
|
35
|
-
|
34
|
+
static VALUE fizzbuzz_values(VALUE object, fizzbuzz_return_t type,
|
35
|
+
fizzbuzz_direction_t direction);
|
36
36
|
|
37
37
|
static VALUE fizzbuzz_exception_wrapper(VALUE value);
|
38
38
|
static VALUE fizzbuzz_exception(void *data);
|
@@ -399,34 +399,19 @@ fizzbuzz_evaluate(VALUE value)
|
|
399
399
|
{
|
400
400
|
int8_t score;
|
401
401
|
|
402
|
-
VALUE result = Qnil;
|
403
|
-
|
404
402
|
if (ZERO_P(value)) {
|
405
403
|
return value;
|
406
404
|
}
|
407
405
|
|
408
406
|
score = SCORE_VALUE(value);
|
407
|
+
assert((score >= 0 && score <= 3) && \
|
408
|
+
"Score value out of bounds, must be between 0 and 3 inclusive");
|
409
409
|
|
410
|
-
|
411
|
-
case 0:
|
412
|
-
result = value;
|
413
|
-
break;
|
414
|
-
case 1:
|
415
|
-
result = CSTR2RVAL(words[score - 1]);
|
416
|
-
break;
|
417
|
-
case 2:
|
418
|
-
result = CSTR2RVAL(words[score - 1]);
|
419
|
-
break;
|
420
|
-
case 3:
|
421
|
-
result = CSTR2RVAL(words[score - 1]);
|
422
|
-
break;
|
423
|
-
}
|
424
|
-
|
425
|
-
return result;
|
410
|
+
return score < 1 ? value : CSTR2RVAL(word(score));
|
426
411
|
}
|
427
412
|
|
428
413
|
static VALUE
|
429
|
-
fizzbuzz_values(VALUE object,
|
414
|
+
fizzbuzz_values(VALUE object, fizzbuzz_return_t type, fizzbuzz_direction_t direction)
|
430
415
|
{
|
431
416
|
VALUE i = Qnil;
|
432
417
|
|
@@ -462,7 +447,7 @@ fizzbuzz_values(VALUE object, return_type_t type, direction_t direction)
|
|
462
447
|
static VALUE
|
463
448
|
fizzbuzz_exception_wrapper(VALUE value)
|
464
449
|
{
|
465
|
-
|
450
|
+
fizzbuzz_exception_t *e = (struct fizzbuzz_exception *)value;
|
466
451
|
|
467
452
|
return rb_exc_new2(e->klass, e->message);
|
468
453
|
}
|
@@ -473,8 +458,8 @@ fizzbuzz_exception(void *data)
|
|
473
458
|
int exception = 0;
|
474
459
|
VALUE object = Qnil;
|
475
460
|
|
476
|
-
|
477
|
-
assert(e != NULL && "Must be a valid pointer to `
|
461
|
+
fizzbuzz_exception_t *e = data;
|
462
|
+
assert(e != NULL && "Must be a valid pointer to `fizzbuzz_exception_t' type");
|
478
463
|
|
479
464
|
object = rb_protect(fizzbuzz_exception_wrapper, (VALUE)e, &exception);
|
480
465
|
|
@@ -491,7 +476,7 @@ fizzbuzz_exception(void *data)
|
|
491
476
|
static VALUE
|
492
477
|
fizzbuzz_type_error(VALUE klass, const char *message)
|
493
478
|
{
|
494
|
-
|
479
|
+
fizzbuzz_exception_t e;
|
495
480
|
|
496
481
|
e.start = Qnil;
|
497
482
|
e.stop = Qnil;
|
@@ -504,7 +489,7 @@ fizzbuzz_type_error(VALUE klass, const char *message)
|
|
504
489
|
static VALUE
|
505
490
|
fizzbuzz_range_error(VALUE klass, VALUE start, VALUE stop, const char *message)
|
506
491
|
{
|
507
|
-
|
492
|
+
fizzbuzz_exception_t e;
|
508
493
|
|
509
494
|
e.start = start;
|
510
495
|
e.stop = stop;
|
data/ext/fizzbuzz/fizzbuzz.h
CHANGED
@@ -83,8 +83,9 @@ extern "C" {
|
|
83
83
|
} while (0)
|
84
84
|
|
85
85
|
#define error(t) errors[(t)]
|
86
|
+
#define word(n) words[(n) - 1]
|
86
87
|
|
87
|
-
enum
|
88
|
+
enum fizzbuzz_error {
|
88
89
|
E_INVALID_TYPE = 0,
|
89
90
|
E_INVALID_START_TYPE,
|
90
91
|
E_INVALID_STOP_TYPE,
|
@@ -92,26 +93,27 @@ enum error {
|
|
92
93
|
E_BAD_VALUE_STOP
|
93
94
|
};
|
94
95
|
|
95
|
-
enum
|
96
|
+
enum fizzbuzz_return {
|
96
97
|
R_TYPE_ARRAY = 0,
|
97
98
|
R_TYPE_ENUMERATOR
|
98
99
|
};
|
99
100
|
|
100
|
-
enum
|
101
|
+
enum fizzbuzz_direction {
|
101
102
|
D_LOOP_FORWARD = 0,
|
102
103
|
D_LOOP_REVERSE
|
103
104
|
};
|
104
105
|
|
105
|
-
|
106
|
+
typedef enum fizzbuzz_return fizzbuzz_return_t;
|
107
|
+
typedef enum fizzbuzz_direction fizzbuzz_direction_t;
|
108
|
+
|
109
|
+
struct fizzbuzz_exception {
|
106
110
|
VALUE start;
|
107
111
|
VALUE stop;
|
108
112
|
const char *message;
|
109
113
|
VALUE klass;
|
110
114
|
};
|
111
115
|
|
112
|
-
typedef
|
113
|
-
typedef enum direction direction_t;
|
114
|
-
typedef struct exception exception_t;
|
116
|
+
typedef struct fizzbuzz_exception fizzbuzz_exception_t;
|
115
117
|
|
116
118
|
static const char *errors[] = {
|
117
119
|
"must be an Integer or Bignum type",
|
data/lib/fizzbuzz/version.rb
CHANGED
data/ruby-fizzbuzz.gemspec
CHANGED
@@ -42,7 +42,7 @@ arbitrary large numeric values via the Bignum class.
|
|
42
42
|
s.homepage = 'http://about.me/kwilczynski'
|
43
43
|
|
44
44
|
s.rubyforge_project = 'ruby-fizzbuzz'
|
45
|
-
s.rubygems_version = '~>
|
45
|
+
s.rubygems_version = '~> 2.2.0'
|
46
46
|
s.has_rdoc = true
|
47
47
|
|
48
48
|
s.summary = 'Yet another FizzBuzz in Ruby'
|
@@ -59,10 +59,10 @@ arbitrary large numeric values via the Bignum class.
|
|
59
59
|
s.require_paths << 'lib'
|
60
60
|
s.extensions << 'ext/fizzbuzz/extconf.rb'
|
61
61
|
|
62
|
-
s.add_development_dependency 'rake', '>=
|
63
|
-
s.add_development_dependency 'rdoc', '>=
|
64
|
-
s.add_development_dependency 'test-unit', '>= 2.5.
|
65
|
-
s.add_development_dependency 'rake-compiler', '>= 0.
|
62
|
+
s.add_development_dependency 'rake', '~> 10.1', '>= 10.1.1'
|
63
|
+
s.add_development_dependency 'rdoc', '~> 4.1', '>= 4.1.1'
|
64
|
+
s.add_development_dependency 'test-unit', '~> 2.5', '>= 2.5.5'
|
65
|
+
s.add_development_dependency 'rake-compiler', '~> 0.9', '>= 0.9.2'
|
66
66
|
|
67
67
|
s.signing_key = signing_key if File.exists?(signing_key)
|
68
68
|
end
|
metadata
CHANGED
@@ -1,71 +1,95 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-fizzbuzz
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Krzysztof Wilczynski
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-02-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '10.1'
|
17
20
|
- - ! '>='
|
18
21
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
22
|
+
version: 10.1.1
|
20
23
|
type: :development
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '10.1'
|
24
30
|
- - ! '>='
|
25
31
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
32
|
+
version: 10.1.1
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: rdoc
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
30
36
|
requirements:
|
37
|
+
- - ~>
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '4.1'
|
31
40
|
- - ! '>='
|
32
41
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
42
|
+
version: 4.1.1
|
34
43
|
type: :development
|
35
44
|
prerelease: false
|
36
45
|
version_requirements: !ruby/object:Gem::Requirement
|
37
46
|
requirements:
|
47
|
+
- - ~>
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '4.1'
|
38
50
|
- - ! '>='
|
39
51
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
52
|
+
version: 4.1.1
|
41
53
|
- !ruby/object:Gem::Dependency
|
42
54
|
name: test-unit
|
43
55
|
requirement: !ruby/object:Gem::Requirement
|
44
56
|
requirements:
|
57
|
+
- - ~>
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '2.5'
|
45
60
|
- - ! '>='
|
46
61
|
- !ruby/object:Gem::Version
|
47
|
-
version: 2.5.
|
62
|
+
version: 2.5.5
|
48
63
|
type: :development
|
49
64
|
prerelease: false
|
50
65
|
version_requirements: !ruby/object:Gem::Requirement
|
51
66
|
requirements:
|
67
|
+
- - ~>
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '2.5'
|
52
70
|
- - ! '>='
|
53
71
|
- !ruby/object:Gem::Version
|
54
|
-
version: 2.5.
|
72
|
+
version: 2.5.5
|
55
73
|
- !ruby/object:Gem::Dependency
|
56
74
|
name: rake-compiler
|
57
75
|
requirement: !ruby/object:Gem::Requirement
|
58
76
|
requirements:
|
77
|
+
- - ~>
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '0.9'
|
59
80
|
- - ! '>='
|
60
81
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.
|
82
|
+
version: 0.9.2
|
62
83
|
type: :development
|
63
84
|
prerelease: false
|
64
85
|
version_requirements: !ruby/object:Gem::Requirement
|
65
86
|
requirements:
|
87
|
+
- - ~>
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0.9'
|
66
90
|
- - ! '>='
|
67
91
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0.
|
92
|
+
version: 0.9.2
|
69
93
|
description: ! 'Yet another FizzBuzz in Ruby.
|
70
94
|
|
71
95
|
|
@@ -84,20 +108,6 @@ extensions:
|
|
84
108
|
- ext/fizzbuzz/extconf.rb
|
85
109
|
extra_rdoc_files: []
|
86
110
|
files:
|
87
|
-
- ext/fizzbuzz/fizzbuzz.c
|
88
|
-
- ext/fizzbuzz/common.h
|
89
|
-
- ext/fizzbuzz/fizzbuzz.h
|
90
|
-
- ext/fizzbuzz/extconf.rb
|
91
|
-
- lib/fizzbuzz/bignum.rb
|
92
|
-
- lib/fizzbuzz/array.rb
|
93
|
-
- lib/fizzbuzz/integer.rb
|
94
|
-
- lib/fizzbuzz/range.rb
|
95
|
-
- lib/fizzbuzz/version.rb
|
96
|
-
- lib/fizzbuzz.rb
|
97
|
-
- benchmark/benchmark_fizzbuzz.rb
|
98
|
-
- test/test_fizzbuzz.rb
|
99
|
-
- Rakefile
|
100
|
-
- ruby-fizzbuzz.gemspec
|
101
111
|
- AUTHORS
|
102
112
|
- CHANGES
|
103
113
|
- CHANGES.rdoc
|
@@ -105,9 +115,23 @@ files:
|
|
105
115
|
- LICENSE
|
106
116
|
- README
|
107
117
|
- README.rdoc
|
118
|
+
- Rakefile
|
108
119
|
- TODO
|
109
120
|
- VERSION
|
121
|
+
- benchmark/benchmark_fizzbuzz.rb
|
110
122
|
- bin/fizzbuzz
|
123
|
+
- ext/fizzbuzz/common.h
|
124
|
+
- ext/fizzbuzz/extconf.rb
|
125
|
+
- ext/fizzbuzz/fizzbuzz.c
|
126
|
+
- ext/fizzbuzz/fizzbuzz.h
|
127
|
+
- lib/fizzbuzz.rb
|
128
|
+
- lib/fizzbuzz/array.rb
|
129
|
+
- lib/fizzbuzz/bignum.rb
|
130
|
+
- lib/fizzbuzz/integer.rb
|
131
|
+
- lib/fizzbuzz/range.rb
|
132
|
+
- lib/fizzbuzz/version.rb
|
133
|
+
- ruby-fizzbuzz.gemspec
|
134
|
+
- test/test_fizzbuzz.rb
|
111
135
|
homepage: http://about.me/kwilczynski
|
112
136
|
licenses:
|
113
137
|
- Apache License, Version 2.0
|
@@ -129,7 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
129
153
|
version: '0'
|
130
154
|
requirements: []
|
131
155
|
rubyforge_project: ruby-fizzbuzz
|
132
|
-
rubygems_version: 2.
|
156
|
+
rubygems_version: 2.2.2
|
133
157
|
signing_key:
|
134
158
|
specification_version: 4
|
135
159
|
summary: Yet another FizzBuzz in Ruby
|