/* Problem Name is &&& Dist. Between Strings &&& PLEASE DO NOT REMOVE THIS LINE. */
public class Solution {
/*
* == Instructions ==
*
* Debug why the included test cases aren't succeeding and account for them in the code
*
* A description of the expected behaviour is given below
*/
public static double shortestDistance(String document, String word1, String word2) {
}
public static boolean doTestsPass() {
// todo: implement more tests if you'd like
return shortestDistance(DOCUMENT, "and", "graphic") == 6d &&
shortestDistance(DOCUMENT, "transfer", "it") == 14d &&
shortestDistance(DOCUMENT, "layout", "It" ) == 6d &&
shortestDistance(DOCUMENT, "Design", "filler" ) == 25d &&
shortestDistance(DOCUMENT, "It", "transfer") == 14d &&
Math.abs(shortestDistance(DOCUMENT, "of", "lorem") - 4.5) < 0.000001 &&
shortestDistance(DOCUMENT, "thiswordisnotthere", "lorem") == -1d;
}
public static void main(String[] args) {
// Run the tests
if (doTestsPass()) {
System.out.println("All tests pass");
} else {
System.out.println("There are test failures");
}
}