Skip to content

Latest commit

 

History

History
77 lines (44 loc) · 2.49 KB

lab-report-5-week-10.md

File metadata and controls

77 lines (44 loc) · 2.49 KB

CSE15L lab 5

Finding the difference and debugging

Run all test files use the code shown below:

for file in test-files/*.md;
do
  echo $file
  java MarkdownParse $file
done

The code above in script.sh can run the program on all .md files in the test-files directory. The command bash script.sh > results.txt, let us store all outputs in the results.txt file.

Use the following command to compare two files:

diff <Path A> <Path B> 

I compare use the command vimdiff markdown-mdparse/results.txt markdown-parse/results.txt :

Difference

The highlighted part tell us which lines and the content are different. Tests with different results are shown here.

In this lab report, I will discuss test 487 and test 488 here.

Difference 1

we take a look at test 487 first, use command cat 487.md :

Difference 1

According to the CommonMark demo site, this should not be a link:

Differ 1 expect

The expected output should be []. because /my uri is not a valid link. The provided code seen to give the right output. I think my implementation failed because I didn't check if there are break for the link after /.

Part of the implementation in my markdown-parse:

Differ 1 code

To fix the problem in the above picture of codes, I can add an if-statement to check if there are ''(space) on the contents after /. If there are breaks, I just return [] .

Difference 2

we take a look at test 488 now, use command cat 488.md :

Difference 2

According to the CommonMark demo site, this should not be a link:

Differ 2 expect

I am suspecting this is not a valid link becuase it can't take me to a valid website, but since the the CommonMark demo site show it is link, I will treat it as a link. In that case, my implementation is right and the given code is wrong.

Part of the implementation in given markdown-parse:

Difference

To fix the problem in the above picture of codes, I think the problem is that the code didn't check < and >, so if we add if-statement to get the string between < and >, it will give the right output.