}
}
public void testLoop2() throws Exception {
try {
LinearTypeOrderBuilder obuilder;
LinearTypeOrder order;
obuilder = irm.createTypeSortOrder();
obuilder.add(new String[] { "a", "b" });
check(order = obuilder.getOrder(), "aa", "bb");
checkBackwards(order, "bb", "aa");
check(order, "ab", "bb");
check(order, "aa", "ba");
check(order, "ab", "ba");
obuilder = irm.createTypeSortOrder();
obuilder.add(new String[] { "b", "a" });
check(order = obuilder.getOrder(), "ba", "aa");
check(order, "bb", "aa");
check(order, "ba", "ab");
check(order, "bb", "ab");
obuilder = irm.createTypeSortOrder();
obuilder.add(new String[] { "a", "b" });
obuilder.add(new String[] { "bb", "a" });
check(order = obuilder.getOrder(), "bb", "aa"); // these two forced to reverse
check(order, "bb", "ab"); // these two forced to reverse
check(order, "aa", "ba");
check(order, "ab", "ba");
// set a child in front of the sib of its parent,
// and one in front of the child of its prev sib.
obuilder = irm.createTypeSortOrder();
obuilder.add(new String[] { "aba", "aa" });
obuilder.add(new String[] { "b", "aa" });
check(order = obuilder.getOrder(), "aba", "aa");
check(order, "bb", "aa"); // child of b dragged along?
check(order, "b", "aaa"); // child of aa dragged?
// siblings children dragged
obuilder = irm.createTypeSortOrder();
obuilder.add(new String[] { "ab", "aa" });
obuilder.add(new String[] { "b", "aa" });
check(order = obuilder.getOrder(), "ab", "aa");
check(order, "b", "aa");
check(order, "bb", "aa"); // child of b dragged along?
check(order, "b", "aaa"); // child of aa dragged?
// siblings children dragged
obuilder = irm.createTypeSortOrder();
obuilder.add(new String[] { "ab", "aa" });
obuilder.add(new String[] { "b", "aa" });
obuilder.add(new String[] { "a", "b" });
check(order = obuilder.getOrder(), "ab", "aa");
check(order, "b", "aa");
check(order, "bb", "aa"); // child of b dragged along?
check(order, "b", "aaa"); // child of aa dragged?
check(order, "ac", "b");