emory-courses / dsa-java

Data Structures and Algorithms in Java
https://emory.gitbook.io/dsa-java/
42 stars 55 forks source link

[HW2] Question Regarding Test Methods #134

Closed HallOfSam closed 3 years ago

HallOfSam commented 3 years ago

Hello! I am quite confused about the expected output of the test. In the unit test, the maximum number of candidates is set to be 20, but why do the expected outputs have only 3 strings instead of 20 strings?

Also, technically, when the given prefix is "sh", shouldn't the first candidate be "sh" since it is the shortest word that starts with "sh" in the provided text file?

Thanks in advance.

lujiaying commented 3 years ago

but why do the expected outputs have only 3 strings instead of 20 strings?

L50 examined 4 strings. So it is entirely possible we test arbitrary output strings.

shouldn't the first candidate be "sh" since it is the shortest word that starts with "sh" in the provided text file?

I agree that "sh" itself can be a candidate. For this homework, I think it is just designed to be not including "sh" itself. It all depends on dict.txt, if it exists in dict.txt, please return it.

lujiaying commented 3 years ago

Hi @HallOfSam, just a clarification, your speculation is totally correct.

In #137,

From Dr. Choi's comment:

those test cases as well as examples are dummies, not meant to be what's supposed to be implemented

That means if "sh" exists in dictonary.txt, please return it as well.

HallOfSam commented 3 years ago

Hi @HallOfSam, just a clarification, your speculation is totally correct.

In #137,

From Dr. Choi's comment:

those test cases as well as examples are dummies, not meant to be what's supposed to be implemented

That means if "sh" exists in dictonary.txt, please return it as well.

Thank you!