- Timestamp:
- 12/09/11 15:56:08 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaHelperLibTest/src/de/ugoe/cs/util/ArrayToolsTest.java
r255 r291 17 17 @Test 18 18 public void testFindIndex_1() throws Exception { 19 20 19 Integer target = 3; 21 20 int expected = 3; … … 23 22 int result = ArrayTools.findIndex(array, target); 24 23 25 // add additional test code here26 24 assertEquals(expected, result); 27 25 } … … 29 27 @Test 30 28 public void testFindIndex_2() throws Exception { 31 32 29 Integer target = 4; 33 30 int expected = 4; … … 35 32 int result = ArrayTools.findIndex(array, target); 36 33 37 // add additional test code here38 34 assertEquals(expected, result); 39 35 } … … 45 41 int result = ArrayTools.findIndex(array, target); 46 42 int expected = -1; 47 48 // add additional test code here 43 49 44 assertEquals(expected, result); 50 45 } … … 65 60 int result = ArrayTools.findIndex(array, other); 66 61 67 // add additional test code here68 62 assertEquals(-1, result); 63 } 64 65 @Test 66 public void testFindMax_1() throws Exception { 67 int expected = 8; 68 69 int result = ArrayTools.findMax(array); 70 71 assertEquals(expected, result); 72 } 73 74 @Test 75 public void testFindMax_2() throws Exception { 76 Integer[] arrayUnsorted = new Integer[]{2,3,6,1,8,9,1,1,3,15,4,0,-1}; 77 int expected = 9; 78 79 int result = ArrayTools.findMax(arrayUnsorted); 80 81 assertEquals(expected, result); 82 } 83 84 @Test 85 public void testFindMax_3() throws Exception { 86 Integer[] arrayUnsorted = new Integer[]{2,3,6,1,8,9,1,1,3,15,4,15,-1}; 87 int expected = 9; 88 89 int result = ArrayTools.findMax(arrayUnsorted); 90 91 assertEquals(expected, result); 92 } 93 94 @Test 95 public void testFindMax_4() throws Exception { 96 Integer[] arrayNoLenght = new Integer[]{}; 97 int expected = -1; 98 99 int result = ArrayTools.findMax(arrayNoLenght); 100 101 assertEquals(expected, result); 102 } 103 104 @Test 105 public void testFindMax_5() throws Exception { 106 Integer[] arrayNulls = new Integer[]{null, null}; 107 int expected = -1; 108 109 int result = ArrayTools.findMax(arrayNulls); 110 111 assertEquals(expected, result); 112 } 113 114 @Test 115 public void testFindMax_6() throws Exception { 116 int expected = -1; 117 118 int result = ArrayTools.findMax(null); 119 120 assertEquals(expected, result); 121 } 122 123 @Test 124 public void testFindMin_1() throws Exception { 125 int expected = 0; 126 127 int result = ArrayTools.findMin(array); 128 129 assertEquals(expected, result); 130 } 131 132 @Test 133 public void testFindMin_2() throws Exception { 134 Integer[] arrayUnsorted = new Integer[]{2,3,6,1,8,9,1,1,-3,15,4,0,-1}; 135 int expected = 8; 136 137 int result = ArrayTools.findMin(arrayUnsorted); 138 139 assertEquals(expected, result); 140 } 141 142 @Test 143 public void testFindMin_3() throws Exception { 144 Integer[] arrayUnsorted = new Integer[]{2,3,6,1,8,9,1,-1,3,15,4,15,-1}; 145 int expected = 7; 146 147 int result = ArrayTools.findMin(arrayUnsorted); 148 149 assertEquals(expected, result); 150 } 151 152 @Test 153 public void testFindMin_4() throws Exception { 154 Integer[] arrayNoLenght = new Integer[]{}; 155 int expected = -1; 156 157 int result = ArrayTools.findMin(arrayNoLenght); 158 159 assertEquals(expected, result); 160 } 161 162 @Test 163 public void testFindMin_5() throws Exception { 164 Integer[] arrayNulls = new Integer[]{null, null}; 165 int expected = -1; 166 167 int result = ArrayTools.findMin(arrayNulls); 168 169 assertEquals(expected, result); 170 } 171 172 @Test 173 public void testFindMin_6() throws Exception { 174 int expected = -1; 175 176 int result = ArrayTools.findMin(null); 177 178 assertEquals(expected, result); 69 179 } 70 180
Note: See TracChangeset
for help on using the changeset viewer.