public void Compute_ShouldReturnZero_WhenBothInputsEmpty() { // Arrange string inputOne = ""; string inputTwo = ""; // Act double distance = LevenshteinDistance.GetLevenshteinDistance(inputOne, inputTwo); // Assert Assert.AreEqual <double>(expected: 0, actual: distance); }
/// <summary> /// Returns true if there is a duplicate icon in the scene. Uses locality hashing to do so /// </summary> Boolean SameIconExists(Vector3 point, string text) { int key = LevenshteinDistance.GetLevenshteinKey(text); List <GameObject> iconList; // Compare icon against all other icons that have a similar text if (iconDictionary.TryGetValue(key, out iconList)) { foreach (GameObject go in iconList) { string goText = go.GetComponent <IconAction>().Text; if (LevenshteinDistance.GetLevenshteinDistance(text, goText) < LevenshteinDistance.ToleranceLevel && Vector3.Distance(point, go.transform.position) < 0.135) { return(true); } } } return(false); }