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.
@@ -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