ovov-calculator 0.0.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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: baabd8fd517dddc462ece5baccb58fc3203e7903
4
+ data.tar.gz: f512b3ef34172f38b0ea438b5b261d1e1df31715
5
+ SHA512:
6
+ metadata.gz: 0f0de28509da5b6e82a77b4c66f6e7d45799ddf17ffcb25b4fbc58feceec233e5841f7f0a0795194cb563b7320c54812b2f00287b0cbaca69cf213c271b8b50d
7
+ data.tar.gz: b75aa2c9bb3d7532ca55bf55f085a73f83213a3bb8c4dec17144ceee9d233a898624d5fe364c2a9b29f4af1c9961c6def197043e0007dcd0cfe2c8f20e63ba30
data/.travis.yml ADDED
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.3
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in ovov-calculator.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 Honza Hovorka
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,30 @@
1
+ # OVOV::Calculator
2
+ [![Build Status](https://travis-ci.org/honzahovorka/ovov-calculator.svg?branch=master)](https://travis-ci.org/honzahovorka/ovov-calculator)
3
+
4
+ Provide calculators for [OVOV](http://www.ovov.cz) disciplines
5
+
6
+ ## Installation
7
+
8
+ Add this line to your application's Gemfile:
9
+
10
+ gem 'ovov-calculator'
11
+
12
+ And then execute:
13
+
14
+ $ bundle
15
+
16
+ Or install it yourself as:
17
+
18
+ $ gem install ovov-calculator
19
+
20
+ ## Usage
21
+
22
+ TODO: Write usage instructions here
23
+
24
+ ## Contributing
25
+
26
+ 1. Fork it ( https://github.com/honzahovorka/ovov-calculator/fork )
27
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
28
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
29
+ 4. Push to the branch (`git push origin my-new-feature`)
30
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,7 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new
5
+
6
+ task default: :spec
7
+ task test: :spec
data/lib/calculator.rb ADDED
@@ -0,0 +1,14 @@
1
+ require 'calculator/version'
2
+ require 'calculator/base'
3
+ require 'calculator/disciplines/sprint'
4
+ require 'calculator/disciplines/run'
5
+ require 'calculator/disciplines/long_jump'
6
+ require 'calculator/disciplines/medicine_ball'
7
+ require 'calculator/disciplines/jump_rope'
8
+ require 'calculator/disciplines/pull_up'
9
+ require 'calculator/disciplines/triple_jump'
10
+ require 'calculator/disciplines/push_up'
11
+ require 'calculator/disciplines/sit_up'
12
+ require 'calculator/disciplines/ball_throw'
13
+ require 'calculator/disciplines/dribbling'
14
+ require 'calculator/disciplines/swimming'
@@ -0,0 +1,19 @@
1
+ module OVOV
2
+ module Calculator
3
+ class Base
4
+ attr_reader :points
5
+ attr_accessor :performance
6
+
7
+ def initialize(performance = 0)
8
+ @points = 0
9
+ @performance = performance
10
+ end
11
+
12
+ def calculate
13
+ raise CalculatorError.new('Should be implemented in subclass')
14
+ end
15
+ end
16
+ end
17
+
18
+ class CalculatorError < StandardError; end
19
+ end
@@ -0,0 +1,14 @@
1
+ module OVOV
2
+ module Calculator
3
+ class BallThrow < Base
4
+ POOR_PERFORMANCE = 5
5
+
6
+ def calculate
7
+ return 0 if @performance < POOR_PERFORMANCE
8
+
9
+ @points = ((@performance - 4.25) / 0.75) * 10
10
+ end
11
+
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,14 @@
1
+ module OVOV
2
+ module Calculator
3
+ class Dribbling < Base
4
+ POOR_PERFORMANCE = 120
5
+
6
+ def calculate
7
+ return 0 if @performance < POOR_PERFORMANCE
8
+
9
+ @points = ((@performance - 117.6) / 2.4) * 10
10
+ end
11
+
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,15 @@
1
+ module OVOV
2
+ module Calculator
3
+ class JumpRope < Base
4
+ POOR_PERFORMANCE = 0
5
+
6
+ def calculate
7
+ return 0 if @performance <= POOR_PERFORMANCE
8
+
9
+ @points = ((@performance - 27) / 3) * 10
10
+ end
11
+
12
+ end
13
+ end
14
+ end
15
+
@@ -0,0 +1,14 @@
1
+ module OVOV
2
+ module Calculator
3
+ class LongJump < Base
4
+ POOR_PERFORMANCE = 1
5
+
6
+ def calculate
7
+ return 0 if @performance < POOR_PERFORMANCE
8
+
9
+ @points = ((@performance - 0.945 ) / 0.055) * 10
10
+ end
11
+
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,15 @@
1
+ module OVOV
2
+ module Calculator
3
+ class MedicineBall < Base
4
+ POOR_PERFORMANCE = 3
5
+
6
+ def calculate
7
+ return 0 if @performance < POOR_PERFORMANCE
8
+
9
+ @points = ((@performance - 2.85 ) / 0.15) * 10
10
+ end
11
+
12
+ end
13
+ end
14
+ end
15
+
@@ -0,0 +1,14 @@
1
+ module OVOV
2
+ module Calculator
3
+ class PullUp < Base
4
+ POOR_PERFORMANCE = 5
5
+
6
+ def calculate
7
+ return 0 if @performance < POOR_PERFORMANCE
8
+
9
+ @points = ((@performance - 4 ) / 1 ) * 10
10
+ end
11
+
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,14 @@
1
+ module OVOV
2
+ module Calculator
3
+ class PushUp < Base
4
+ POOR_PERFORMANCE = 5
5
+
6
+ def calculate
7
+ return 0 if @performance < POOR_PERFORMANCE
8
+
9
+ @points = ((@performance - 4.3) / 0.7) * 10
10
+ end
11
+
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,28 @@
1
+ module OVOV
2
+ module Calculator
3
+ class Run < Base
4
+ POOR_PERFORMANCE = 441
5
+ IMPOSSIBLE_PERFORMANCE = 61
6
+ TIME_REGEX = /\A(?!00:00)[0-5]?[0-9]:[0-5][0-9]\Z/
7
+
8
+ def performance=(value)
9
+ super(convert_time_to_seconds(value))
10
+ end
11
+
12
+ def calculate
13
+ return 0 if @performance >= POOR_PERFORMANCE || @performance < IMPOSSIBLE_PERFORMANCE
14
+
15
+ @points = ((442.5 - @performance) / 2.5) * 10
16
+ end
17
+
18
+ private
19
+
20
+ def convert_time_to_seconds(performance)
21
+ return performance unless performance =~ TIME_REGEX
22
+
23
+ 60 * performance.split(':').first.to_i + performance.split(':').last.to_i
24
+ end
25
+
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,14 @@
1
+ module OVOV
2
+ module Calculator
3
+ class SitUp < Base
4
+ POOR_PERFORMANCE = 10
5
+
6
+ def calculate
7
+ return 0 if @performance < POOR_PERFORMANCE
8
+
9
+ @points = (@performance - 9) * 10
10
+ end
11
+
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,21 @@
1
+ module OVOV
2
+ module Calculator
3
+ class Sprint < Base
4
+ POOR_PERFORMANCE = 14.2
5
+ IMPOSSIBLE_PERFORMANCE = 2
6
+
7
+ def calculate
8
+ return 0 if @performance > POOR_PERFORMANCE || @performance < IMPOSSIBLE_PERFORMANCE
9
+
10
+ if @performance > 10.99
11
+ @points = ((14.3 - @performance) / 0.1) * 10
12
+ else
13
+ @points = ((12.65 - @performance) / 0.05) * 10
14
+ end
15
+
16
+ @points
17
+ end
18
+
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,14 @@
1
+ module OVOV
2
+ module Calculator
3
+ class Swimming < Base
4
+ POOR_PERFORMANCE = 25
5
+
6
+ def calculate
7
+ return 0 if @performance < POOR_PERFORMANCE
8
+
9
+ @points = ((@performance - 23.5) / 1.5) * 10
10
+ end
11
+
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,14 @@
1
+ module OVOV
2
+ module Calculator
3
+ class TripleJump < Base
4
+ POOR_PERFORMANCE = 2.2
5
+
6
+ def calculate
7
+ return 0 if @performance < POOR_PERFORMANCE
8
+
9
+ @points = ((@performance - 2.135 ) / 0.065) * 10
10
+ end
11
+
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,5 @@
1
+ module OVOV
2
+ module Calculator
3
+ VERSION = "0.0.1".freeze
4
+ end
5
+ end
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'calculator/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "ovov-calculator"
8
+ spec.version = OVOV::Calculator::VERSION
9
+ spec.authors = ["Honza Hovorka"]
10
+ spec.email = ["honza.hovorka@gmail.com"]
11
+ spec.summary = %q{Calculator for OVOV disciplines}
12
+ spec.description = %q{}
13
+ spec.homepage = "https://github.com/honzahovorka/ovov-calculator"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_development_dependency "bundler", "~> 1.6"
21
+ spec.add_development_dependency "rake"
22
+ spec.add_development_dependency "rspec"
23
+ end
@@ -0,0 +1,31 @@
1
+ require 'spec_helper'
2
+
3
+ describe OVOV::Calculator::BallThrow do
4
+ subject { OVOV::Calculator::BallThrow.new }
5
+
6
+ it 'calculates 0 points for poor performace' do
7
+ subject.performance = 4
8
+ expect(subject.calculate).to eq 0
9
+ end
10
+
11
+ it 'calculates roughly 10 points for poor performance of 5 metres' do
12
+ subject.performance = 5
13
+ expect(subject.calculate).to eq 10
14
+ end
15
+
16
+ it 'calculates roughly 877 for performance of 70 metres' do
17
+ subject.performance = 70
18
+ expect(subject.calculate.round).to eq 877
19
+ end
20
+
21
+ it 'calculates roughly silly 1277 for performance of 100 metres' do
22
+ subject.performance = 100
23
+ expect(subject.calculate.round).to eq 1277
24
+ end
25
+
26
+ it 'calculates roughly crazy 1677 for performance of 130 metres' do
27
+ subject.performance = 130
28
+ expect(subject.calculate.round).to eq 1677
29
+ end
30
+ end
31
+
@@ -0,0 +1,21 @@
1
+ require 'spec_helper'
2
+
3
+ describe OVOV::Calculator::Base do
4
+
5
+ subject { OVOV::Calculator::Base.new }
6
+
7
+ it 'has 0 points on initialize' do
8
+ expect(subject.points).to eq 0
9
+ end
10
+
11
+ it 'has 0 performance initialized' do
12
+ expect(subject.performance).to eq 0
13
+ end
14
+
15
+ context '.calculate' do
16
+ it 'raise an error' do
17
+ expect{ subject.calculate }.to raise_error(OVOV::CalculatorError)
18
+ end
19
+ end
20
+
21
+ end
@@ -0,0 +1,30 @@
1
+ require 'spec_helper'
2
+
3
+ describe OVOV::Calculator::Dribbling do
4
+ subject { OVOV::Calculator::Dribbling.new }
5
+
6
+ it 'calculates 0 points for poor performace' do
7
+ subject.performance = 119
8
+ expect(subject.calculate).to eq 0
9
+ end
10
+
11
+ it 'calculates roughly 10 points for poor performance of 120 metres' do
12
+ subject.performance = 120
13
+ expect(subject.calculate.round).to eq 10
14
+ end
15
+
16
+ it 'calculates roughly 968 for performance of 350 metres' do
17
+ subject.performance = 350
18
+ expect(subject.calculate.round).to eq 968
19
+ end
20
+
21
+ it 'calculates roughly silly 1177 for performance of 400 metres' do
22
+ subject.performance = 400
23
+ expect(subject.calculate.round).to eq 1177
24
+ end
25
+
26
+ it 'calculates roughly crazy 1885 for performance of 570 metres' do
27
+ subject.performance = 570
28
+ expect(subject.calculate.round).to eq 1885
29
+ end
30
+ end
@@ -0,0 +1,31 @@
1
+ require 'spec_helper'
2
+
3
+ describe OVOV::Calculator::JumpRope do
4
+ subject { OVOV::Calculator::JumpRope.new }
5
+
6
+ it 'calculates 0 points for poor performace' do
7
+ subject.performance = 0
8
+ expect(subject.calculate).to eq 0
9
+ end
10
+
11
+ it 'calculates 10 points for poor performace of 30 jumps' do
12
+ subject.performance = 30
13
+ expect(subject.calculate).to eq 10
14
+ end
15
+
16
+ it 'calculates roughly 810 for 270 jumps' do
17
+ subject.performance = 270
18
+ expect(subject.calculate).to eq 810
19
+ end
20
+
21
+ it 'calculates roughly silly 1210 for 390 jumps' do
22
+ subject.performance = 390
23
+ expect(subject.calculate.round).to eq 1210
24
+ end
25
+
26
+ it 'calculates roughly crazy 1740 for 550 jumps' do
27
+ subject.performance = 550
28
+ expect(subject.calculate.round).to eq 1740
29
+ end
30
+ end
31
+
@@ -0,0 +1,25 @@
1
+ require 'spec_helper'
2
+
3
+ describe OVOV::Calculator::LongJump do
4
+ subject { OVOV::Calculator::LongJump.new }
5
+
6
+ it 'calculates 0 points for poor performace' do
7
+ subject.performance = 0.9
8
+ expect(subject.calculate).to eq 0
9
+ end
10
+
11
+ it 'calculates roughly 1083 for 6.9 metres' do
12
+ subject.performance = 6.9
13
+ expect(subject.calculate.round).to eq 1083
14
+ end
15
+
16
+ it 'calculates roughly silly 174 for 1.9 metres' do
17
+ subject.performance = 1.9
18
+ expect(subject.calculate.round).to eq 174
19
+ end
20
+
21
+ it 'calculates roughly crazy 1628 for 9.9 metres' do
22
+ subject.performance = 9.9
23
+ expect(subject.calculate.round).to eq 1628
24
+ end
25
+ end
@@ -0,0 +1,25 @@
1
+ require 'spec_helper'
2
+
3
+ describe OVOV::Calculator::MedicineBall do
4
+ subject { OVOV::Calculator::MedicineBall.new }
5
+
6
+ it 'calculates 0 points for poor performace' do
7
+ subject.performance = 2.9
8
+ expect(subject.calculate).to eq 0
9
+ end
10
+
11
+ it 'calculates 10 points for poor performace of 3 metres' do
12
+ subject.performance = 3
13
+ expect(subject.calculate.round).to eq 10
14
+ end
15
+
16
+ it 'calculates roughly 803 for 14.9 metres' do
17
+ subject.performance = 14.9
18
+ expect(subject.calculate.round).to eq 803
19
+ end
20
+
21
+ it 'calculates roughly crazy 1537 for 25.9 metres' do
22
+ subject.performance = 25.9
23
+ expect(subject.calculate.round).to eq 1537
24
+ end
25
+ end
@@ -0,0 +1,30 @@
1
+ require 'spec_helper'
2
+
3
+ describe OVOV::Calculator::PullUp do
4
+ subject { OVOV::Calculator::PullUp.new }
5
+
6
+ it 'calculates 0 points for poor performace' do
7
+ subject.performance = 4
8
+ expect(subject.calculate).to eq 0
9
+ end
10
+
11
+ it 'calculates 10 points for poor performace of 5' do
12
+ subject.performance = 5
13
+ expect(subject.calculate.round).to eq 10
14
+ end
15
+
16
+ it 'calculates 810 points for performace of 85' do
17
+ subject.performance = 85
18
+ expect(subject.calculate.round).to eq 810
19
+ end
20
+
21
+ it 'calculates 1510 points for performace of 155' do
22
+ subject.performance = 155
23
+ expect(subject.calculate.round).to eq 1510
24
+ end
25
+
26
+ it 'calculates 1810 points for exceptional performace of 185' do
27
+ subject.performance = 185
28
+ expect(subject.calculate.round).to eq 1810
29
+ end
30
+ end
@@ -0,0 +1,30 @@
1
+ require 'spec_helper'
2
+
3
+ describe OVOV::Calculator::PushUp do
4
+ subject { OVOV::Calculator::PushUp.new }
5
+
6
+ it 'calculates 0 points for poor performace' do
7
+ subject.performance = 4
8
+ expect(subject.calculate).to eq 0
9
+ end
10
+
11
+ it 'calculates roughly 10 points for poor performance of 5 push ups' do
12
+ subject.performance = 5
13
+ expect(subject.calculate.round).to eq 10
14
+ end
15
+
16
+ it 'calculates roughly 939 for performance of 70 push ups' do
17
+ subject.performance = 70
18
+ expect(subject.calculate.round).to eq 939
19
+ end
20
+
21
+ it 'calculates roughly silly 1224 for performance of 90 push ups' do
22
+ subject.performance = 90
23
+ expect(subject.calculate.round).to eq 1224
24
+ end
25
+
26
+ it 'calculates roughly crazy 1796 for performance of 130 push ups' do
27
+ subject.performance = 130
28
+ expect(subject.calculate.round).to eq 1796
29
+ end
30
+ end
@@ -0,0 +1,35 @@
1
+ require 'spec_helper'
2
+
3
+ describe OVOV::Calculator::Run do
4
+ subject { OVOV::Calculator::Run.new }
5
+
6
+ context '.calculate' do
7
+ it 'calculates 0 points for poor performace' do
8
+ subject.performance = '7:35'
9
+ expect(subject.calculate).to eq 0
10
+ end
11
+
12
+ it 'calculates 0 points for clearly impossible performace' do
13
+ subject.performance = '1:00'
14
+ expect(subject.calculate).to eq 0
15
+ end
16
+
17
+ it 'calculates roughly 1230 points for 2:15' do
18
+ subject.performance = '2:15'
19
+ expect(subject.calculate.round).to eq 1230
20
+ end
21
+ end
22
+
23
+ context '.convert_time_to_seconds' do
24
+ it 'converts time 2:00 to 120s' do
25
+ subject.performance = '2:00'
26
+ expect(subject.performance).to eq 120
27
+ end
28
+
29
+ it 'converts time 2:40 to 160s' do
30
+ subject.performance = '2:40'
31
+ expect(subject.performance).to eq 160
32
+ end
33
+ end
34
+
35
+ end
@@ -0,0 +1,30 @@
1
+ require 'spec_helper'
2
+
3
+ describe OVOV::Calculator::SitUp do
4
+ subject { OVOV::Calculator::SitUp.new }
5
+
6
+ it 'calculates 0 points for poor performace' do
7
+ subject.performance = 9
8
+ expect(subject.calculate).to eq 0
9
+ end
10
+
11
+ it 'calculates roughly 10 points for poor performance of 10 sit ups' do
12
+ subject.performance = 10
13
+ expect(subject.calculate).to eq 10
14
+ end
15
+
16
+ it 'calculates roughly 610 for performance of 70 sit ups' do
17
+ subject.performance = 70
18
+ expect(subject.calculate).to eq 610
19
+ end
20
+
21
+ it 'calculates roughly silly 1310 for performance of 140 sit ups' do
22
+ subject.performance = 140
23
+ expect(subject.calculate).to eq 1310
24
+ end
25
+
26
+ it 'calculates roughly crazy 1710 for performance of 180 sit ups' do
27
+ subject.performance = 180
28
+ expect(subject.calculate).to eq 1710
29
+ end
30
+ end
@@ -0,0 +1,5 @@
1
+ require 'calculator'
2
+
3
+ RSpec.configure do |config|
4
+ config.color = true
5
+ end
@@ -0,0 +1,26 @@
1
+ require 'spec_helper'
2
+
3
+ describe OVOV::Calculator::Sprint do
4
+ subject { OVOV::Calculator::Sprint.new }
5
+
6
+ it 'calculates 0 points for poor performace' do
7
+ subject.performance = 15.0
8
+ expect(subject.calculate).to eq 0
9
+ end
10
+
11
+ it 'calculates 0 points for clearly impossible performace' do
12
+ subject.performance = 1.99
13
+ expect(subject.calculate).to eq 0
14
+ end
15
+
16
+ it 'calculates 830 points for 8.5s' do
17
+ subject.performance = 8.5
18
+ expect(subject.calculate).to eq 830
19
+ end
20
+
21
+ it 'calculates roughly 330 points for 11s' do
22
+ subject.performance = 11
23
+ expect(subject.calculate.round).to eq 330
24
+ end
25
+
26
+ end
@@ -0,0 +1,30 @@
1
+ require 'spec_helper'
2
+
3
+ describe OVOV::Calculator::Swimming do
4
+ subject { OVOV::Calculator::Swimming.new }
5
+
6
+ it 'calculates 0 points for poor performace' do
7
+ subject.performance = 24
8
+ expect(subject.calculate).to eq 0
9
+ end
10
+
11
+ it 'calculates roughly 10 points for poor performance of 25 metres' do
12
+ subject.performance = 25
13
+ expect(subject.calculate.round).to eq 10
14
+ end
15
+
16
+ it 'calculates roughly 977 for performance of 170 metres' do
17
+ subject.performance = 170
18
+ expect(subject.calculate.round).to eq 977
19
+ end
20
+
21
+ it 'calculates roughly silly 1310 for performance of 220 metres' do
22
+ subject.performance = 220
23
+ expect(subject.calculate.round).to eq 1310
24
+ end
25
+
26
+ it 'calculates roughly crazy 1777 for performance of 290 metres' do
27
+ subject.performance = 290
28
+ expect(subject.calculate.round).to eq 1777
29
+ end
30
+ end
@@ -0,0 +1,30 @@
1
+ require 'spec_helper'
2
+
3
+ describe OVOV::Calculator::TripleJump do
4
+ subject { OVOV::Calculator::TripleJump.new }
5
+
6
+ it 'calculates 0 points for poor performace' do
7
+ subject.performance = 2.1
8
+ expect(subject.calculate).to eq 0
9
+ end
10
+
11
+ it 'calculates roughly 10 points for poor performance of 2.2 metres' do
12
+ subject.performance = 2.2
13
+ expect(subject.calculate.round).to eq 10
14
+ end
15
+
16
+ it 'calculates roughly 979 for performance of 8.5 metres' do
17
+ subject.performance = 8.5
18
+ expect(subject.calculate.round).to eq 979
19
+ end
20
+
21
+ it 'calculates roughly silly 1210 for performance of 10 metres' do
22
+ subject.performance = 10
23
+ expect(subject.calculate.round).to eq 1210
24
+ end
25
+
26
+ it 'calculates roughly crazy 1825 for performance of 14 metres' do
27
+ subject.performance = 14
28
+ expect(subject.calculate.round).to eq 1825
29
+ end
30
+ end
metadata ADDED
@@ -0,0 +1,135 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ovov-calculator
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Honza Hovorka
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-11-23 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.6'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.6'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: ''
56
+ email:
57
+ - honza.hovorka@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".travis.yml"
63
+ - Gemfile
64
+ - LICENSE.txt
65
+ - README.md
66
+ - Rakefile
67
+ - lib/calculator.rb
68
+ - lib/calculator/base.rb
69
+ - lib/calculator/disciplines/ball_throw.rb
70
+ - lib/calculator/disciplines/dribbling.rb
71
+ - lib/calculator/disciplines/jump_rope.rb
72
+ - lib/calculator/disciplines/long_jump.rb
73
+ - lib/calculator/disciplines/medicine_ball.rb
74
+ - lib/calculator/disciplines/pull_up.rb
75
+ - lib/calculator/disciplines/push_up.rb
76
+ - lib/calculator/disciplines/run.rb
77
+ - lib/calculator/disciplines/sit_up.rb
78
+ - lib/calculator/disciplines/sprint.rb
79
+ - lib/calculator/disciplines/swimming.rb
80
+ - lib/calculator/disciplines/triple_jump.rb
81
+ - lib/calculator/version.rb
82
+ - ovov-calculator.gemspec
83
+ - spec/ball_throw_spec.rb
84
+ - spec/base_calculator_spec.rb
85
+ - spec/dribbling_spec.rb
86
+ - spec/jump_rope_spec.rb
87
+ - spec/long_jump_spec.rb
88
+ - spec/medicine_ball_spec.rb
89
+ - spec/pull_up_spec.rb
90
+ - spec/push_up_spec.rb
91
+ - spec/run_calculator_spec.rb
92
+ - spec/sit_up_spec.rb
93
+ - spec/spec_helper.rb
94
+ - spec/sprint_calculator_spec.rb
95
+ - spec/swimming_spec.rb
96
+ - spec/triple_jump_spec.rb
97
+ homepage: https://github.com/honzahovorka/ovov-calculator
98
+ licenses:
99
+ - MIT
100
+ metadata: {}
101
+ post_install_message:
102
+ rdoc_options: []
103
+ require_paths:
104
+ - lib
105
+ required_ruby_version: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - ">="
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ required_rubygems_version: !ruby/object:Gem::Requirement
111
+ requirements:
112
+ - - ">="
113
+ - !ruby/object:Gem::Version
114
+ version: '0'
115
+ requirements: []
116
+ rubyforge_project:
117
+ rubygems_version: 2.4.5.1
118
+ signing_key:
119
+ specification_version: 4
120
+ summary: Calculator for OVOV disciplines
121
+ test_files:
122
+ - spec/ball_throw_spec.rb
123
+ - spec/base_calculator_spec.rb
124
+ - spec/dribbling_spec.rb
125
+ - spec/jump_rope_spec.rb
126
+ - spec/long_jump_spec.rb
127
+ - spec/medicine_ball_spec.rb
128
+ - spec/pull_up_spec.rb
129
+ - spec/push_up_spec.rb
130
+ - spec/run_calculator_spec.rb
131
+ - spec/sit_up_spec.rb
132
+ - spec/spec_helper.rb
133
+ - spec/sprint_calculator_spec.rb
134
+ - spec/swimming_spec.rb
135
+ - spec/triple_jump_spec.rb