cse15l-lab-reports

The 2 markdown repositories are as follows:
My Repository
Provided Repository

Tests were designed for each of the repos. In the following screenshots, the first array in the Junit test is the expected output as provided by the CommonMark demo site. For both implementations, none of the tests passed.

The tests for my repository is as follows: My Tests

The output for my tests is as follows:

Test1:
Test1
Test2: Test2 Test3:
Test3

The Junit Tests for the repository provided is as follows: Other repository tests
The tests and the output for the following are as follows:

Test1: Test1 Test2: Test2 Test3: Test3

Code Changes

Snippet1

For the first snipper, a code change that could work is implementing an if statement that checks if the link or any part is contained within a code block, that would therefore make the link invalid.

int open_code = markdown.indexOf("") int close_code = markdown.indexOf("", open_code) … … if(openBracket > open_code && openBracket < close_code || closeBracket < open_code && closeBracket > close_code || openParen > open_code && openParen < close_code || closeParen > open_code && closeParen < close_code){continue}

This will prevent the loop from adding any link that is intended to be shown as code.

Snippet3

For the second snippet, a code change that could work is implementing an if statment that checks if there are any more closing brackets before the final one.

openBracket = markdown.indexOf("[", closeParen ) while(markdown.indexOf(")", closeParen) > -1 && markdown.indexOf(")", closeParen) < openBracket ): closeParen=markdown.indexOf(")", nextCloseParen)

Snippet3

This will involve a code change of greater than 10 lines. THis is due to the fact that my code is designed to split the list into single lines, and then read the lines. Reforming this will involve extensive code changes and refactoring, and will lead to changes of more than 10 lines, and involve extensive changing of variable types.