AuD
Lecture 'Algorithmen und Datenstrukturen' (code examples)
RedBlackTreeTest.java
Go to the documentation of this file.
1package aud.test;
2
3import aud.RedBlackTree;
5
6import org.junit.*;
7import static org.junit.Assert.*;
8
9public class RedBlackTreeTest {
10
11 @Test
12 public void testRedBlackTree() {
13 String[] keys={"a","b","c","d","e","f","g","h","i"};
14 int n=keys.length;
15
16 for (int[] p : new Permutations(n)) {
17
18 RedBlackTree<String,String> tree=new RedBlackTree<String,String>();
19
20 for (int i : p) {
21 String k=tree.find(keys[i]);
22 assertEquals(k,null);
23 tree.insert(keys[i],keys[i]);
24 k=tree.find(keys[i]);
25 assertTrue(k!=null);
26 assertTrue(k.compareTo(keys[i])==0);
27 tree.checkConsistency();
28 }
29 }
30 }
31
32 public static void main(String args[]) {
33 org.junit.runner.JUnitCore.main("aud.test.RedBlackTreeTest");
34 }
35}
static void main(String args[])
Generate permutations.
utilities (not related to AuD lecture)
Definition: Colormap.java:1
AuD lecture: Data structures, algorithms, examples.
Definition: A234Tree.java:1