|
@@ -1,114 +0,0 @@
|
1
|
|
-import static org.junit.Assert.*;
|
2
|
|
-import org.junit.After;
|
3
|
|
-import org.junit.Before;
|
4
|
|
-import org.junit.Test;
|
5
|
|
-
|
6
|
|
-public class ConversionToolTest
|
7
|
|
-{
|
8
|
|
- @Test
|
9
|
|
- public void shouldConvertCentimetersToInches() {
|
10
|
|
- float inches = ConversionTool.CentimetersToInches(2f);
|
11
|
|
- assertEquals(0.7874f, inches, 0.001);
|
12
|
|
- }
|
13
|
|
- @Test
|
14
|
|
- public void shouldConvertZeroCentimetersToZeroInches() {
|
15
|
|
- float inches = ConversionTool.CentimetersToInches(0);
|
16
|
|
- assertEquals(0, inches, 0.0);
|
17
|
|
- }
|
18
|
|
- @Test
|
19
|
|
- public void shouldConvertNegativeCentimetersToZeroInches() {
|
20
|
|
- float inches = ConversionTool.CentimetersToInches(-5);
|
21
|
|
- assertEquals(0, inches, 0.0);
|
22
|
|
- }
|
23
|
|
-
|
24
|
|
- @Test
|
25
|
|
- public void shouldConvertInchesToCentimeters() {
|
26
|
|
- float centimeters = ConversionTool.InchesToCentimeters(4f);
|
27
|
|
- assertEquals(10.16f, centimeters, 0.001);
|
28
|
|
- }
|
29
|
|
- @Test
|
30
|
|
- public void shouldConvertZeroInchesToZeroCentimeters() {
|
31
|
|
- float centimeters = ConversionTool.InchesToCentimeters(0);
|
32
|
|
- assertEquals(0, centimeters, 0.0);
|
33
|
|
- }
|
34
|
|
- @Test
|
35
|
|
- public void shouldConvertNegativeInchesToZeroCentimeters() {
|
36
|
|
- float centimeters = ConversionTool.InchesToCentimeters(-5);
|
37
|
|
- assertEquals(0, centimeters, 0.0);
|
38
|
|
- }
|
39
|
|
-
|
40
|
|
- @Test
|
41
|
|
- public void shouldConvertFeetToMeters() {
|
42
|
|
- float meters = ConversionTool.FeetToMeters(5f);
|
43
|
|
- assertEquals(1.524f, meters, 0.001);
|
44
|
|
- }
|
45
|
|
- @Test
|
46
|
|
- public void shouldConvertZeroFeetToZeroMeters() {
|
47
|
|
- float meters = ConversionTool.FeetToMeters(0);
|
48
|
|
- assertEquals(0, meters, 0.0);
|
49
|
|
- }
|
50
|
|
- @Test
|
51
|
|
- public void shouldConvertNegativeFeetToZeroMeters() {
|
52
|
|
- float meters = ConversionTool.FeetToMeters(-10);
|
53
|
|
- assertEquals(0, meters, 0.0);
|
54
|
|
- }
|
55
|
|
-
|
56
|
|
- @Test
|
57
|
|
- public void shouldConvertMetersToFeet() {
|
58
|
|
- float feet = ConversionTool.MetersToFeet(9f);
|
59
|
|
- assertEquals(29.5276f, feet, 0.001);
|
60
|
|
- }
|
61
|
|
- @Test
|
62
|
|
- public void shouldConvertZeroMetersToZeroFeet() {
|
63
|
|
- float feet = ConversionTool.MetersToFeet(0);
|
64
|
|
- assertEquals(0, feet, 0.0);
|
65
|
|
- }
|
66
|
|
- @Test
|
67
|
|
- public void shouldConvertNegativeMetersToZeroFeet() {
|
68
|
|
- float feet = ConversionTool.MetersToFeet(-10);
|
69
|
|
- assertEquals(0, feet, 0.0);
|
70
|
|
- }
|
71
|
|
-
|
72
|
|
- @Test
|
73
|
|
- public void shouldConvertFahrenheitToCelsius() {
|
74
|
|
- float celsius = ConversionTool.FahrenheitToCelsius(80);
|
75
|
|
- assertEquals(26.67, celsius, 0.01);
|
76
|
|
- }
|
77
|
|
- @Test
|
78
|
|
- public void shouldConvertCelsiusToFahrenheit() {
|
79
|
|
- float fahrenheit = ConversionTool.CelsiusToFahrenheit(26.67f);
|
80
|
|
- assertEquals(80, fahrenheit, 0.01);
|
81
|
|
- }
|
82
|
|
-
|
83
|
|
- @Test
|
84
|
|
- public void shouldConvertMphToKph(){
|
85
|
|
- float kph = ConversionTool.MphToKph(24f);
|
86
|
|
- assertEquals(38.62, kph, 0.01);
|
87
|
|
- }
|
88
|
|
- @Test
|
89
|
|
- public void shouldConvertZeroMphToZeroKph(){
|
90
|
|
- float kph = ConversionTool.MphToKph(0f);
|
91
|
|
- assertEquals(0, kph, 0.0);
|
92
|
|
- }
|
93
|
|
- @Test
|
94
|
|
- public void shouldConvertNegativeMphToZeroKph(){
|
95
|
|
- float kph = ConversionTool.MphToKph(-50f);
|
96
|
|
- assertEquals(0, kph, 0.0);
|
97
|
|
- }
|
98
|
|
-
|
99
|
|
- @Test
|
100
|
|
- public void shouldConvertKphToMph(){
|
101
|
|
- float mph = ConversionTool.KphToMph(6.44f);
|
102
|
|
- assertEquals(4, mph, 0.01);
|
103
|
|
- }
|
104
|
|
- @Test
|
105
|
|
- public void shouldConvertZeroKphToZeroMph(){
|
106
|
|
- float mph = ConversionTool.KphToMph(0f);
|
107
|
|
- assertEquals(0, mph, 0.0);
|
108
|
|
- }
|
109
|
|
- @Test
|
110
|
|
- public void shouldConvertNegativeKphToZeroMph(){
|
111
|
|
- float mph = ConversionTool.KphToMph(-50f);
|
112
|
|
- assertEquals(0, mph, 0.0);
|
113
|
|
- }
|
114
|
|
-}
|