Hallo,
ich bin ein java anfänger
ich habe eine bubblesort classe und eine ListItem Classe. Und ich weiß nicht kann ich eine Test generator main code Und eine Junit testcase schreiben kann.
Hier ist mein Bubblesort code:
import java.util.List;
public class bugSort{
public static ListItem bugSort (ListItem x) {
List <Integer> input = recordListNodes (x);
boolean change = true;
ListItem p, yn, t, head;
if (x == null)
return null;
while (change){
p = null;
change = false;
ListItem y = x;
yn = y.n;
while (yn != null){
if (y.data > yn.data){
change = true;
t = yn.n;
y.n = t;
yn.n = y;
if (p == null){
x = yn;
} else{p.n = y.n;
}
p = yn;
yn = t;
}
else {
p = y;
y = yn;
yn = y.n;
}
}
}
assert permutation (x, input);
assert ascendingOrder (x);
return x;
}
private static List<Integer> recordListNodes (ListItem x){
return null;
}
private static boolean permutation(ListItem x){
return false;
}
}
und die LIstItem Klasse:
public class ListItem {
public ListItem n;
public int data;
}
danke , wenn Sie mir helfen können.
Muchi