DaanHoogland commented on a change in pull request #4553:
URL: https://github.com/apache/cloudstack/pull/4553#discussion_r546661690
##########
File path: utils/src/test/java/com/cloud/utils/StringUtilsTest.java
##########
@@ -258,4 +258,34 @@ public void testToCSVList() {
String output = StringUtils.toCSVList(Arrays.asList(input.split(",")));
assertTrue(input.equals(output));
}
+
+ @Test
+ public void testZeroEditDistance() {
+ String str1 = "Other 32-bit";
+ String str2 = "Other 32-bit";
+ int minDistance = StringUtils.minimumEditDistance(str1, str2);
+ assertEquals(minDistance, 0);
+ }
+
+ @Test
+ public void testBestMatchStringWithEditDistance() {
+ String str1 = "FreeBSD 11 (32bit)";
+ String str2 = "FreeBSD 12 (64bit)";
+ String targetString = "FreeBSD 64bit";
Review comment:
maybe not here but as extra:
```suggestion
public void testBestFreeBSDWithEditDistance() {
String str1 = "FreeBSD 11 (32bit)";
String str2 = "FreeBSD 22 (64bit)";
String targetString = "FreeBSD 11 (64bit)";
```
```suggestion
public void testBestFedoraWithEditDistance() {
String str1 = "Fedora 29 (32bit)";
String str2 = "FreeBSD 32 (64bit)";
String targetString = "FreeBSD 33 (32bit)";
```
```suggestion
public void testBestUbuntuWithEditDistance() {
String str1 = "ubuntu 14.04 (32bit)";
String str2 = "ubuntu 20.10 (64bit)";
String targetString = "ubuntu 18.04 (64bit)";
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]