-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMilkyDoughnutTest.java
More file actions
152 lines (54 loc) · 1.85 KB
/
Copy pathMilkyDoughnutTest.java
File metadata and controls
152 lines (54 loc) · 1.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
public class MilkyDoughnutTest{
@Test
public void testCountEven(){
int numbers [] = {2,3,4,56,7,8,24,12,5,6};
MilkyDoughnut arrayFunctions = new MilkyDoughnut();
int actual = arrayFunctions.countEven(numbers);
int expected = 7;
assertEquals(actual,expected);
}
@Test
public void testLinearSearch(){
int [] numbers = {1,4,5,6,7,34,56,32};
<<<<<<< HEAD
int target = 34;
=======
int target = 5;
>>>>>>> 8015333 (added perfect squares solution)
MilkyDoughnut search = new MilkyDoughnut();
int actual = search.linearSearch(numbers,target);
<<<<<<< HEAD
int expected = 34;
=======
int expected = 2;
>>>>>>> 8015333 (added perfect squares solution)
assertEquals(actual,expected);
}
@Test
public void testSquaresOfPerfect(){
int numbers = 5;
MilkyDoughnut squares = new MilkyDoughnut();
<<<<<<< HEAD
int actual = squares.getPerfectSquares(numbers);
int expected = 25;
assertEquals(actual,expected);
=======
int actual []= squares.getPerfectSquares(numbers);
int expected []= {1,4,9,16,25};
assertArrayEquals(actual,expected);
>>>>>>> 8015333 (added perfect squares solution)
}
@Test
public void testArraysEquals(){
int []firstArray = {1,23,56,78,64,32};
int [] secondArray = {1,23,56,78,64,32};
MilkyDoughnut arraysEquals = new MilkyDoughnut();
boolean actual = arraysEquals.arraysEqualsLengthAndValues(firstArray,secondArray);
assertTrue(actual);
}
}