Skip to content

Latest commit

 

History

History
303 lines (141 loc) · 9.19 KB

README.md

File metadata and controls

303 lines (141 loc) · 9.19 KB

Report for Assignment 1

Project chosen

Name: algorithms

URL: (https://github.com/keon/algorithms)

Number of lines of code and the tool used to count it: 18023(18 KLOC), counted using lizard

Programming language: Python

Coverage measurement

Existing tool

We have used coverage.py to measure the cover of our chosen project. After installing all tools and dependencies, we have 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.

In order to not put in 8 large images, I will insert the final screenshot, with the total branch coverage: image

Your own coverage tool

Ayman Errahmouni

Function 1: simplify_path_v2

Link the commit

Screenshot of branch measurement:
image

Function 2: insertion_sort

Link to commit

Screenshot of branch measurement:
alt text

Catalin Antonescu

Function 1: strong_password

Link to commit: https://github.com/CatalinAnt/algorithms-SEP-95/commit/eaad6d32ecd73bb8fde876a4d4852cb522aea6f8

Screenshot of branch measurement: image

Function 2: rotate_image

Link to commit:(same as for the first one) https://github.com/CatalinAnt/algorithms-SEP-95/commit/eaad6d32ecd73bb8fde876a4d4852cb522aea6f8

Screenshot of branch measurement: image

Almuthana Almustafa

Function 1: stoogsort in stoog_sort.py

Link to the commit in the founction files

result:

alt text

Function 2: word_break in word_break.py

link to commit in founction: Link to the commit in the founction files

result:

alt text

Coverage improvement

Individual tests

Ayman Errahmouni

<Test "test_simplify_path">

An enhanced existing test

Old coverage:
old coverage result (24%)

Diff (LHS = new code, RHS = old code):
LHS: new code, RHS: old code alt text

New coverage:
new coverage result (100%)

The coverage was improved because certain cases that could happen in file paths (e.g. the "." directory, empty path) were not tested for. By added additional tests that use such cases, the coverage improved.

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)

<Test "test_actual_insertion_sort">

An new test. (before, insertion_sort was not present in any test)

Diff (LHS: new code, RHS: old code):
(New test)
LHS: new code, RHS: old code
(Changes in imports)
LHS: new code, RHS: old code (Instrumentation)
alt text

Old coverage:
Old coverage result (4%)

New coverage:
alt text

Catalin Antonescu

Test 1:

In test_string:

Link to commit:

https://github.com/CatalinAnt/algorithms-SEP-95/commit/eaad6d32ecd73bb8fde876a4d4852cb522aea6f8

Old coverage:

image image

New coverage:

image image

For strong_password there was a 26% coverage improvement with the existing tool and 40% with manual measurement tool.

Test 2:

In test_matrix:

https://github.com/CatalinAnt/algorithms-SEP-95/commit/eaad6d32ecd73bb8fde876a4d4852cb522aea6f8

Old coverage:

image image

New coverage:

image image For rotate_image, thre was a 33% coverage improvement with the existing tool and 25% with manual tool.

Almuthana Almustafa

Test 1: stoogsort

link to commit in test files: Link to the commit in the test files

existing tool result before:

alt text

existing tool result after:

alt text

The coverage increased by 89%, largely attributable to the implementation of new tests.

Test 2: word_break

Link to the commit in the test files

existing tool result before:

alt text

existing tool result after:

alt text

The coverage improved by 86% due to the creation of new tests.

Abdullah Abdelkhalik

pythagoras

https://github.com/CatalinAnt/algorithms-SEP-95/commit/5651abafebe8ae3a5ea63e74883bb991acf19303

pythagoras_hits

first_unique_char

https://github.com/CatalinAnt/algorithms-SEP-95/commit/c16f26e952322b2c1729778a4141a57103ba7658

first_unique_char_hits (2)

Improvements

test_maths

https://github.com/CatalinAnt/algorithms-SEP-95/commit/60832d9c672efd586848077cc41a52630d34371b

pythagoras_before

pythagoras_after

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.

test_strings

https://github.com/CatalinAnt/algorithms-SEP-95/commit/5651abafebe8ae3a5ea63e74883bb991acf19303

first_unique_char_before

first_unique_char_after

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.

Overall

<Provide a screenshot of the old coverage results by running an existing tool (the same as you already showed above)> Old overall coverage: image

New overall coverage:

image

Due to the large size of the project, the percentage only went up by one percent.

Statement of individual contributions

Abdullah -> increased the coverage for two functions.

Almuthana Almustafa -> Instrumentation was added to two functions, and test cases were created for them to improve coverage.

Cataline -> Instrumentation was added to two functions, and the tests for these functions were enhanced.