zsabbagh / algorithms

Minimal examples of data structures and algorithms in Python.
MIT License
0 stars 0 forks source link

Implement branch coverage on chosen functions #1

Closed zsabbagh closed 1 year ago

zsabbagh commented 1 year ago

Manual instrumentation of branch coverage for the following functions. This is done by writing to the file data/branch-coverage with 'a' (append) flag enabled. See structure in tests/__init__.py. Each time testing is run, the file is truncated.

einaroddurpall commented 1 year ago

One thing. If we encounter if-statements without else sections, I think we need to add the else section to keep track of those branches. For example:

if pattern[i] == pattern[j]:
        branches.add(3)
        j += 1
        pi[i] = j
else:
        branches.add(4)

Agree?

einaroddurpall commented 1 year ago

One thing. If we encounter if-statements without else sections, I think we need to add the else section to keep track of those branches. For example:

if pattern[i] == pattern[j]:
        branches.add(3)
        j += 1
        pi[i] = j
else:
        branches.add(4)

Agree?

TA said it was necessary to add the else section.