1 package uk.co.jezuk.mango; 2 3 import junit.framework.*; 4 5 import java.util.List ; 6 import java.util.ArrayList ; 7 8 public class SymmetricDifferenceTest extends TestCase 9 { 10 public SymmetricDifferenceTest(String name) { super(name); } 11 public static Test suite() { return new TestSuite(SymmetricDifferenceTest.class); } 12 13 public void test1() 14 { 15 List l1 = new java.util.ArrayList (); 16 Algorithms.symmetricDifference(l1, l1, l1); 17 18 assertEquals(0, l1.size()); 19 } 21 public void test2() 22 { 23 List l1 = new java.util.ArrayList (); 24 l1.add("1"); 25 l1.add("2"); 26 l1.add("3"); 27 List i = new java.util.ArrayList (); 28 Algorithms.symmetricDifference(l1, l1, i); 29 30 assertEquals(0, i.size()); 31 } 33 public void test3() 34 { 35 List l1 = new java.util.ArrayList (); 36 l1.add("1"); 37 l1.add("2"); 38 l1.add("3"); 39 List l2 = new java.util.ArrayList (); 40 l2.add("1"); 41 l2.add("2"); 42 l2.add("3"); 43 List i = new java.util.ArrayList (); 44 Algorithms.symmetricDifference(l1, l2, i); 45 46 assertEquals(0, i.size()); 47 } 49 public void test4() 50 { 51 List l1 = new java.util.ArrayList (); 52 l1.add("1"); 53 l1.add("2"); 54 l1.add("3"); 55 List l2 = new java.util.ArrayList (); 56 l2.add("1"); 57 l2.add("3"); 58 List i = new java.util.ArrayList (); 59 Algorithms.symmetricDifference(l1, l2, i); 60 61 assertEquals(1, i.size()); 62 assertEquals("2", i.get(0)); 63 } 65 public void test5() 66 { 67 List l1 = new java.util.ArrayList (); 68 l1.add("1"); 69 l1.add("2"); 70 l1.add("3"); 71 List l2 = new java.util.ArrayList (); 72 l2.add("2"); 73 List i = new java.util.ArrayList (); 74 Algorithms.symmetricDifference(l1, l2, i); 75 76 assertEquals(2, i.size()); 77 assertEquals("1", i.get(0)); 78 assertEquals("3", i.get(1)); 79 } 81 public void test6() 82 { 83 List l1 = new java.util.ArrayList (); 84 l1.add("1"); 85 l1.add("2"); 86 l1.add("3"); 87 List l2 = new java.util.ArrayList (); 88 l2.add("2"); 89 l2.add("1"); 90 List i = new java.util.ArrayList (); 91 Algorithms.symmetricDifference(l1, l2, i); 92 93 assertEquals(1, i.size()); 94 assertEquals("3", i.get(0)); 95 } 97 public void test7() 98 { 99 List l1 = new java.util.ArrayList (); 100 l1.add("1"); 101 l1.add("3"); 102 List l2 = new java.util.ArrayList (); 103 l2.add("1"); 104 l2.add("2"); 105 l2.add("3"); 106 List i = new java.util.ArrayList (); 107 Algorithms.symmetricDifference(l1, l2, i); 108 109 assertEquals(1, i.size()); 110 assertEquals("2", i.get(0)); 111 } 113 public void test8() 114 { 115 List l1 = new java.util.ArrayList (); 116 l1.add("2"); 117 List l2 = new java.util.ArrayList (); 118 l2.add("1"); 119 l2.add("2"); 120 l2.add("3"); 121 List i = new java.util.ArrayList (); 122 Algorithms.symmetricDifference(l1, l2, i); 123 124 assertEquals(2, i.size()); 125 assertEquals("1", i.get(0)); 126 assertEquals("3", i.get(1)); 127 } 129 public void test9() 130 { 131 List l1 = new java.util.ArrayList (); 132 l1.add("1"); 133 l1.add("2"); 134 l1.add("3"); 135 List l2 = new java.util.ArrayList (); 136 l2.add("4"); 137 l2.add("5"); 138 l2.add("6"); 139 List i = new java.util.ArrayList (); 140 Algorithms.symmetricDifference(l1, l2, i); 141 142 assertEquals(6, i.size()); 143 assertEquals("1", i.get(0)); 144 assertEquals("2", i.get(1)); 145 assertEquals("3", i.get(2)); 146 assertEquals("4", i.get(3)); 147 assertEquals("5", i.get(4)); 148 assertEquals("6", i.get(5)); 149 } } | Popular Tags |