perfect-shape 0.0.1 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +23 -0
- data/README.md +85 -10
- data/VERSION +1 -1
- data/lib/perfect-shape.rb +2 -0
- data/lib/perfect_shape/arc.rb +100 -42
- data/lib/perfect_shape/ellipse.rb +78 -0
- data/lib/perfect_shape/line.rb +14 -25
- data/lib/perfect_shape/math.rb +34 -6
- data/lib/perfect_shape/rectangle.rb +44 -0
- data/lib/perfect_shape/rectangular_shape.rb +65 -0
- data/lib/perfect_shape/shape.rb +39 -0
- data/lib/perfect_shape/square.rb +56 -0
- data/perfect-shape.gemspec +10 -14
- metadata +12 -15
- data/.document +0 -5
- data/.ruby-gemset +0 -1
- data/.ruby-version +0 -1
- data/Gemfile +0 -14
- data/Gemfile.lock +0 -102
- data/Rakefile +0 -46
- data/TODO.md +0 -31
- data/test/lib/perfect_shape/test_arc.rb +0 -184
- data/test/lib/perfect_shape/test_math.rb +0 -76
@@ -1,76 +0,0 @@
|
|
1
|
-
require 'puts_debuggerer'
|
2
|
-
require 'minitest/autorun'
|
3
|
-
|
4
|
-
require_relative '../../../lib/perfect-shape'
|
5
|
-
|
6
|
-
describe PerfectShape do
|
7
|
-
describe PerfectShape::Math do
|
8
|
-
describe '#ieee754_remainder' do
|
9
|
-
it 'returns a negative number rounding ceiling' do
|
10
|
-
result = PerfectShape::Math.ieee754_remainder(7.5, 4.5)
|
11
|
-
|
12
|
-
_(result).must_equal -1.5
|
13
|
-
end
|
14
|
-
|
15
|
-
it 'returns a positive number rounding floor' do
|
16
|
-
result = PerfectShape::Math.ieee754_remainder(7.5, 3.5)
|
17
|
-
|
18
|
-
_(result).must_equal 0.5
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'returns a positive number rounding halfway to floor even number' do
|
22
|
-
result = PerfectShape::Math.ieee754_remainder(5, 10)
|
23
|
-
|
24
|
-
_(result).must_equal 5
|
25
|
-
end
|
26
|
-
|
27
|
-
it 'returns a negative number rounding halfway to ceiling even number' do
|
28
|
-
result = PerfectShape::Math.ieee754_remainder(15, 10)
|
29
|
-
|
30
|
-
_(result).must_equal -5
|
31
|
-
end
|
32
|
-
|
33
|
-
it 'returns NaN for x=NaN' do
|
34
|
-
result = PerfectShape::Math.ieee754_remainder(Float::NAN, 10)
|
35
|
-
|
36
|
-
_(result).must_be :nan?
|
37
|
-
end
|
38
|
-
|
39
|
-
it 'returns NaN for x=Infinity' do
|
40
|
-
result = PerfectShape::Math.ieee754_remainder(Float::INFINITY, 10)
|
41
|
-
|
42
|
-
_(result).must_be :nan?
|
43
|
-
end
|
44
|
-
|
45
|
-
it 'returns NaN for y=NaN' do
|
46
|
-
result = PerfectShape::Math.ieee754_remainder(10, Float::NAN)
|
47
|
-
|
48
|
-
_(result).must_be :nan?
|
49
|
-
end
|
50
|
-
|
51
|
-
it 'returns NaN for y=0' do
|
52
|
-
result = PerfectShape::Math.ieee754_remainder(10, 0)
|
53
|
-
|
54
|
-
_(result).must_be :nan?
|
55
|
-
end
|
56
|
-
|
57
|
-
it 'returns NaN for y=+0.0' do
|
58
|
-
result = PerfectShape::Math.ieee754_remainder(10, 0.0)
|
59
|
-
|
60
|
-
_(result).must_be :nan?
|
61
|
-
end
|
62
|
-
|
63
|
-
it 'returns NaN for y=-0.0' do
|
64
|
-
result = PerfectShape::Math.ieee754_remainder(10, -0.0)
|
65
|
-
|
66
|
-
_(result).must_be :nan?
|
67
|
-
end
|
68
|
-
|
69
|
-
it 'returns x for y=Infinity' do
|
70
|
-
result = PerfectShape::Math.ieee754_remainder(10, Float::INFINITY)
|
71
|
-
|
72
|
-
_(result).must_equal 10
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|