co_co_ge 0.0.0 → 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7c70cb2d58c3ae9be99a99bf619770bff2afa22c
4
- data.tar.gz: 306ef4ee5dd360d7f8a0bb8425203cc0d4aeac2f
3
+ metadata.gz: 212385d44111fdac4200cc9737c380e37048ecc0
4
+ data.tar.gz: 625b47d3e352245ddf2203eed391d5ec016dd793
5
5
  SHA512:
6
- metadata.gz: 4c5dbd0e6c75abd21b1d5e4538449761157d3224f79565d10fb1f6eb3c4092f8fa1ed8c16a94631d5670766bf7e3e80537b24f5522353bb6f28de8e5908e2855
7
- data.tar.gz: 27db9355b9530ecb87dba3710f442563443c73fa89d9e05624d02c0461ea544d6649d28ac107bf61dffb430a2a44c21a94b0e8bdcfa68d7177b79ae0b3e2963f
6
+ metadata.gz: 4c9c6c8b165258de5bc5d246ec37f8c197fffce1780b96f1b554db28e7285741ab81a229df1846067b9a03f04e2c84edf9e9209118d616df6ff388d8358c373d
7
+ data.tar.gz: a05efb44f0792f01f14dc2f0076af0df41e0ad934274e822be719953c1bc8f775b66a35e65ba98ed7b6558c1e657ee362242f533399192874dd40b9ce5145289
data/Rakefile CHANGED
@@ -6,7 +6,7 @@ GemHadar do
6
6
  name 'co_co_ge'
7
7
  author 'Florian Frank'
8
8
  email 'flori@ping.de'
9
- homepage "http://flori.github.com/#{name}"
9
+ homepage "https://github.com/flori/#{name}"
10
10
  summary 'Create a (un-)readable coupon code'
11
11
  description 'This library creates (un-)readable coupon codes.'
12
12
  test_dir 'spec'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.0
1
+ 0.0.1
data/co_co_ge.gemspec CHANGED
@@ -1,9 +1,9 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: co_co_ge 0.0.0 ruby lib
2
+ # stub: co_co_ge 0.0.1 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "co_co_ge".freeze
6
- s.version = "0.0.0"
6
+ s.version = "0.0.1"
7
7
 
8
8
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
9
9
  s.require_paths = ["lib".freeze]
@@ -13,7 +13,7 @@ Gem::Specification.new do |s|
13
13
  s.email = "flori@ping.de".freeze
14
14
  s.extra_rdoc_files = ["README.md".freeze, "lib/co_co_ge.rb".freeze, "lib/co_co_ge/code_generator.rb".freeze, "lib/co_co_ge/ngrams_symbol_generator.rb".freeze, "lib/co_co_ge/version.rb".freeze, "lib/co_co_ge/words_symbol_generator.rb".freeze]
15
15
  s.files = [".gitignore".freeze, ".travis.yml".freeze, ".utilsrc".freeze, "COPYING".freeze, "Gemfile".freeze, "README.md".freeze, "Rakefile".freeze, "VERSION".freeze, "co_co_ge.gemspec".freeze, "code.gemspec".freeze, "lib/co_co_ge.rb".freeze, "lib/co_co_ge/code_generator.rb".freeze, "lib/co_co_ge/ngrams_symbol_generator.rb".freeze, "lib/co_co_ge/version.rb".freeze, "lib/co_co_ge/words_symbol_generator.rb".freeze, "spec/co_co_ge/code_generator_spec.rb".freeze, "spec/co_co_ge/ngrams_symbol_generator_spec.rb".freeze, "spec/co_co_ge/words_symbol_generator_spec.rb".freeze, "spec/spec_helper.rb".freeze]
16
- s.homepage = "http://flori.github.com/co_co_ge".freeze
16
+ s.homepage = "https://github.com/flori/co_co_ge".freeze
17
17
  s.rdoc_options = ["--title".freeze, "CoCoGe".freeze, "--main".freeze, "README.md".freeze]
18
18
  s.required_ruby_version = Gem::Requirement.new(">= 2.3".freeze)
19
19
  s.rubygems_version = "2.6.11".freeze
@@ -13,7 +13,7 @@ class CoCoGe::CodeGenerator
13
13
  @length = (Math.log(1 << @bits) / Math.log(@symbols.size)).floor
14
14
  else
15
15
  @length = length
16
- @bits = (Math.log(@symbols.size ** @length) / Math.log(2)).ceil
16
+ @bits = (Math.log(@symbols.size ** @length) / Math.log(2)).floor
17
17
  end
18
18
 
19
19
  check_arguments
@@ -30,7 +30,7 @@ class CoCoGe::CodeGenerator
30
30
  attr_reader :parts_per_word
31
31
 
32
32
  def capacity
33
- 2 ** bits
33
+ @symbols.size ** @length
34
34
  end
35
35
 
36
36
  def generate(bytes: generate_bytes)
@@ -1,6 +1,6 @@
1
1
  module CoCoGe
2
2
  # CoCoGe version
3
- VERSION = '0.0.0'
3
+ VERSION = '0.0.1'
4
4
  VERSION_ARRAY = VERSION.split('.').map(&:to_i) # :nodoc:
5
5
  VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
6
6
  VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
@@ -5,8 +5,12 @@ describe CoCoGe::CodeGenerator do
5
5
  allow(generator).to receive(:generate_bytes).and_return 'abdef'.bytes
6
6
  end
7
7
 
8
+ let :symbols do
9
+ 0..9
10
+ end
11
+
8
12
  let :generator do
9
- described_class.new symbols: (0..9), length: 5
13
+ described_class.new symbols: symbols, length: 5
10
14
  end
11
15
 
12
16
  context 'with bits as argument' do
@@ -23,7 +27,7 @@ describe CoCoGe::CodeGenerator do
23
27
  end
24
28
 
25
29
  it 'has correct capacity' do
26
- expect(generator.capacity).to eq 2 ** 40
30
+ expect(generator.capacity).to eq 10 ** 12
27
31
  end
28
32
  end
29
33
 
@@ -34,7 +38,7 @@ describe CoCoGe::CodeGenerator do
34
38
 
35
39
  describe 'bits and length' do
36
40
  it 'can compute the bits that can be expressed' do
37
- expect(generator.bits).to eq 17
41
+ expect(generator.bits).to eq 7
38
42
  end
39
43
 
40
44
  it 'has the correct length' do
@@ -42,7 +46,7 @@ describe CoCoGe::CodeGenerator do
42
46
  end
43
47
 
44
48
  it 'has correct capacity' do
45
- expect(generator.capacity).to eq 2 ** 17
49
+ expect(generator.capacity).to eq 3 ** 5
46
50
  end
47
51
  end
48
52
 
@@ -82,7 +86,7 @@ describe CoCoGe::CodeGenerator do
82
86
 
83
87
  describe 'bits and length' do
84
88
  it 'can compute the bits that can be expressed' do
85
- expect(generator.bits).to eq 17
89
+ expect(generator.bits).to eq 23
86
90
  end
87
91
 
88
92
  it 'has the correct length' do
@@ -90,7 +94,7 @@ describe CoCoGe::CodeGenerator do
90
94
  end
91
95
 
92
96
  it 'has correct capacity' do
93
- expect(generator.capacity).to eq 2 ** 17
97
+ expect(generator.capacity).to eq 26 ** 5
94
98
  end
95
99
  end
96
100
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: co_co_ge
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Frank
@@ -83,7 +83,7 @@ files:
83
83
  - spec/co_co_ge/ngrams_symbol_generator_spec.rb
84
84
  - spec/co_co_ge/words_symbol_generator_spec.rb
85
85
  - spec/spec_helper.rb
86
- homepage: http://flori.github.com/co_co_ge
86
+ homepage: https://github.com/flori/co_co_ge
87
87
  licenses: []
88
88
  metadata: {}
89
89
  post_install_message: