Skip to content

Commit d7d2780

Browse files
author
almuthana
committed
add
1 parent 6bab0cd commit d7d2780

File tree

1 file changed

+245
-6
lines changed

1 file changed

+245
-6
lines changed

README.md

Lines changed: 245 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,24 @@
22

33
## Project chosen
44

5-
Name: <TODO>
5+
Name: algorithms
66

7-
URL: <TODO>
7+
URL: (https://github.com/keon/algorithms)
88

9-
Number of lines of code and the tool used to count it: <TODO>
9+
Number of lines of code and the tool used to count it: 18023(18 KLOC), counted using lizard
1010

11-
Programming language: <TODO>
11+
Programming language: Python
1212

1313
## Coverage measurement
1414

1515
### Existing tool
1616

17-
<Inform the name of the existing tool that was executed and how it was executed>
17+
We have used coverage.py to measure the cover of our chosen project. After installing all tools and dependencies, we have
18+
run the tool by typing coverage run --branch -m pytest tests. Afterwards, we use coverage report to generate the report. Later, Ayman has written a scrip to run the commands in a single script, and to also skip the test files, which don't need to be tested.
19+
20+
In order to not put in 8 large images, I will insert the final screenshot, with the total branch coverage:
21+
![image](https://github.com/CatalinAnt/algorithms-SEP-95/assets/113595149/f1cd3fab-b00c-4cd0-89d0-6452e7ed1a63)
1822

19-
<Show the coverage results provided by the existing tool with a screenshot>
2023

2124
### Your own coverage tool
2225

@@ -90,6 +93,75 @@ existing tool result after:
9093

9194
<Provide the same kind of information provided for Function 1>
9295

96+
#### Ayman Errahmouni
97+
98+
##### Function 1: simplify_path_v2
99+
100+
[Link the commit](https://github.com/CatalinAnt/algorithms-SEP-95/pull/2/commits/22ee6fa1df4785596c603af61a725c558973eb0b)
101+
102+
Screenshot of branch measurement (66%):<br>
103+
![image](image-7.png)
104+
105+
##### Function 2: insertion_sort
106+
107+
[Link to commit](https://github.com/CatalinAnt/algorithms-SEP-95/pull/2/commits/5dae7f28036f89b7f6ff673639a922dd714aff3e)
108+
109+
Screenshot of branch measurement (0%, was untested):<br>
110+
![alt text](image-8.png)
111+
112+
#### Catalin Antonescu
113+
114+
##### Function 1: strong_password
115+
116+
Link to commit:
117+
[https://github.com/CatalinAnt/algorithms-SEP-95/commit/eaad6d32ecd73bb8fde876a4d4852cb522aea6f8](https://github.com/CatalinAnt/algorithms-SEP-95/commit/2b0b9187c1c040e4476b1ca14f2c2249273566b7)
118+
119+
Screenshot of branch measurement:
120+
![image](https://github.com/CatalinAnt/algorithms-SEP-95/assets/113595149/e718a47f-5ea0-412c-b250-25a193412164)
121+
122+
##### Function 2: rotate_image
123+
124+
Link to commit:(same as for the first one)
125+
[https://github.com/CatalinAnt/algorithms-SEP-95/commit/eaad6d32ecd73bb8fde876a4d4852cb522aea6f8](https://github.com/CatalinAnt/algorithms-SEP-95/commit/2b0b9187c1c040e4476b1ca14f2c2249273566b7)
126+
127+
Screenshot of branch measurement:
128+
![image](https://github.com/CatalinAnt/algorithms-SEP-95/assets/113595149/94eec9b6-3dd6-46e3-b087-40892eccc10e)
129+
130+
#### Abdullah Abdelkhalik
131+
132+
133+
pythagoras
134+
135+
https://github.com/CatalinAnt/algorithms-SEP-95/commit/5651abafebe8ae3a5ea63e74883bb991acf19303
136+
137+
![pythagoras_hits](https://github.com/CatalinAnt/algorithms-SEP-95/assets/114078193/0df1fa2b-2185-4b9f-ae65-5d969edb009b)
138+
139+
140+
first_unique_char
141+
142+
https://github.com/CatalinAnt/algorithms-SEP-95/commit/c16f26e952322b2c1729778a4141a57103ba7658
143+
144+
![first_unique_char_hits](https://github.com/CatalinAnt/algorithms-SEP-95/assets/114078193/10d7c45c-398e-4408-8f11-6771f51fa95c)
145+
146+
147+
#### Abdullah Abdelkhalik
148+
149+
150+
pythagoras
151+
152+
https://github.com/CatalinAnt/algorithms-SEP-95/commit/5651abafebe8ae3a5ea63e74883bb991acf19303
153+
154+
![pythagoras_hits](https://github.com/CatalinAnt/algorithms-SEP-95/assets/114078193/0df1fa2b-2185-4b9f-ae65-5d969edb009b)
155+
156+
157+
first_unique_char
158+
159+
https://github.com/CatalinAnt/algorithms-SEP-95/commit/c16f26e952322b2c1729778a4141a57103ba7658
160+
161+
![first_unique_char_hits](https://github.com/CatalinAnt/algorithms-SEP-95/assets/114078193/10d7c45c-398e-4408-8f11-6771f51fa95c)
162+
163+
164+
93165
## Coverage improvement
94166

95167
### Individual tests
@@ -112,15 +184,182 @@ existing tool result after:
112184

113185
<Provide the same kind of information provided for Test 1>
114186

187+
## Ayman Errahmouni
188+
189+
#### <Test "test_simplify_path">
190+
191+
An enhanced existing test
192+
193+
Old coverage:<br>
194+
![old coverage result (24%)](image-2.png)
195+
196+
Diff (LHS = new code, RHS = old code):<br>
197+
![LHS: new code, RHS: old code](image.png)
198+
199+
New coverage:<br>
200+
![new coverage result (100%)](image-1.png)
201+
202+
The coverage was improved because certain cases that could happen in file paths (e.g. the "." directory, empty path) were not tested for.
203+
By added additional tests that use such cases, the coverage improved.
204+
205+
The test was also faulty on windows (i guess linux was assumed), so i added support for that in the test. (It now passes on Windows 10 too)
206+
207+
#### <Test "test_actual_insertion_sort">
208+
209+
An new test. (before, `insertion_sort` was not present in any test)
210+
211+
Diff (LHS: new code, RHS: old code):<br>
212+
(New test)<br>
213+
![LHS: new code, RHS: old code](image-5.png)<br>
214+
(Changes in imports)<br>
215+
![LHS: new code, RHS: old code](image-6.png)
216+
217+
Old coverage:<br>
218+
![Old coverage result (4%)](image-3.png)
219+
220+
New coverage:<br>
221+
![alt text](image-4.png)
222+
223+
<State the coverage improvement with a number and elaborate on why the coverage is improved>
224+
225+
## Catalin Antonescu
226+
227+
Test 1:
228+
229+
In test_string:
230+
231+
Link to commit:
232+
233+
[https://github.com/CatalinAnt/algorithms-SEP-95/commit/eaad6d32ecd73bb8fde876a4d4852cb522aea6f8](https://github.com/CatalinAnt/algorithms-SEP-95/commit/2b0b9187c1c040e4476b1ca14f2c2249273566b7)
234+
235+
Old coverage:
236+
237+
![image](https://github.com/CatalinAnt/algorithms-SEP-95/assets/113595149/5ea3487d-f024-45e6-a1e7-e6d9d1d953b7)
238+
![image](https://github.com/CatalinAnt/algorithms-SEP-95/assets/113595149/e718a47f-5ea0-412c-b250-25a193412164)
239+
240+
New coverage:
241+
242+
![image](https://github.com/CatalinAnt/algorithms-SEP-95/assets/113595149/1d179cc4-1179-40e2-b344-5e904e899647)
243+
![image](https://github.com/CatalinAnt/algorithms-SEP-95/assets/113595149/c8173a47-bcc9-4b6a-9a91-c70b5a8b002f)
244+
245+
For strong_password there was a 26% coverage improvement with the existing tool and 40% with manual measurement tool.
246+
247+
248+
Test 2:
249+
250+
In test_matrix:
251+
252+
[https://github.com/CatalinAnt/algorithms-SEP-95/commit/eaad6d32ecd73bb8fde876a4d4852cb522aea6f8](https://github.com/CatalinAnt/algorithms-SEP-95/commit/2b0b9187c1c040e4476b1ca14f2c2249273566b7)
253+
254+
Old coverage:
255+
256+
![image](https://github.com/CatalinAnt/algorithms-SEP-95/assets/113595149/94eec9b6-3dd6-46e3-b087-40892eccc10e)
257+
![image](https://github.com/CatalinAnt/algorithms-SEP-95/assets/113595149/a97a2bd6-c69e-4435-a8e2-bbdefc429bd1)
258+
259+
260+
New coverage:
261+
262+
![image](https://github.com/CatalinAnt/algorithms-SEP-95/assets/113595149/7cc337eb-5684-40b3-aedd-dc2b7180b7f3)
263+
![image](https://github.com/CatalinAnt/algorithms-SEP-95/assets/113595149/2143adff-e0aa-4113-858a-0c92ec288d20)
264+
For rotate_image, thre was a 33% coverage improvement with the existing tool and 25% with manual tool.
265+
266+
267+
## Abdullah Abdelkhalik
268+
269+
test_maths
270+
271+
https://github.com/CatalinAnt/algorithms-SEP-95/commit/60832d9c672efd586848077cc41a52630d34371b
272+
273+
![pythagoras_before](https://github.com/CatalinAnt/algorithms-SEP-95/assets/114078193/cf57112b-1aef-4a10-a41f-bd4b797e2012)
274+
275+
![pythagoras_after](https://github.com/CatalinAnt/algorithms-SEP-95/assets/114078193/1aa45c17-46fc-49d3-944a-03c2276d1be6)
276+
277+
the coverage is improved by 28%, the code only hit one of the five branches and cover only one of the three cases of the pythagoras theory. I added the other two cases, i could have a fourth case where none of the cases is present.
278+
279+
test_strings
280+
281+
https://github.com/CatalinAnt/algorithms-SEP-95/commit/5651abafebe8ae3a5ea63e74883bb991acf19303
282+
283+
![first_unique_char_before](https://github.com/CatalinAnt/algorithms-SEP-95/assets/114078193/9910ec69-73b0-4c87-afc8-abc01f65a423)
284+
285+
![first_unique_char_after](https://github.com/CatalinAnt/algorithms-SEP-95/assets/114078193/10859fac-776c-4a48-8a1c-9531afcbfa9b)
286+
287+
The coverage is improved by 13%, the code only hit three out of five branches and only set up two examples. I added a case where there is no unique letter.
288+
289+
290+
Almuthana Almustafa
291+
292+
stoogsort in stoog_sort.py
293+
294+
[Link to the commit in the founction files](https://github.com/CatalinAnt/algorithms-SEP-95/commit/57b66879c6ae0f82712c55528f540dfdb3c3ddd3)
295+
296+
result:
297+
298+
![alt text](ts.png)
299+
300+
word_break in word_break.py
301+
302+
link to commit in founction:
303+
[Link to the commit in the founction files](https://github.com/CatalinAnt/algorithms-SEP-95/commit/57b66879c6ae0f82712c55528f540dfdb3c3ddd3 )
304+
305+
result:
306+
307+
![alt text](ts.png)
308+
309+
Almuthana Almustafa
310+
311+
stoogsort function
312+
313+
link to commit in test files:
314+
[Link to the commit in the test files](https://github.com/CatalinAnt/algorithms-SEP-95/commit/157de36fd4c373b67cd03e3b3713be9ba5cf0d97)
315+
316+
existing tool result before:
317+
318+
![alt text](ss2.png)
319+
320+
existing tool result after:
321+
322+
![alt text](ss.png)
323+
324+
The coverage increased by 89%, largely attributable to the implementation of new tests.
325+
326+
word_break function
327+
328+
[Link to the commit in the test files](https://github.com/CatalinAnt/algorithms-SEP-95/commit/157de36fd4c373b67cd03e3b3713be9ba5cf0d97)
329+
330+
existing tool result before:
331+
332+
![alt text](wk1.png)
333+
334+
existing tool result after:
335+
336+
![alt text](wk2.png)
337+
338+
The coverage improved by 86% due to the creation of new tests.
339+
115340
### Overall
116341

117342
<Provide a screenshot of the old coverage results by running an existing tool (the same as you already showed above)>
343+
Old overall coverage:
344+
![image](https://github.com/CatalinAnt/algorithms-SEP-95/assets/113595149/f1cd3fab-b00c-4cd0-89d0-6452e7ed1a63)
118345

119346
<Provide a screenshot of the new coverage results by running the existing tool using all test modifications made by the group>
347+
New overall coverage:
348+
349+
![image](https://github.com/CatalinAnt/algorithms-SEP-95/assets/113595149/a53729ff-a4f1-42ce-9fe9-ff0813952658)
350+
351+
Due to the large size of the project, the percentage only went up by one percent.
120352

121353
## Statement of individual contributions
122354

123355
<Write what each group member did>
124356

125357
Abdullah -> increased the coverage for two functions.
358+
Almuthana Almustafa -> Instrumentation was added to two functions, and test cases were created for them to improve coverage.
359+
360+
361+
362+
363+
364+
126365

0 commit comments

Comments
 (0)