Changeset 291


Ignore:
Timestamp:
12/09/11 15:56:08 (12 years ago)
Author:
sherbold
Message:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaHelperLibTest/src/de/ugoe/cs/util/ArrayToolsTest.java

    r255 r291  
    1717        @Test 
    1818        public void testFindIndex_1() throws Exception { 
    19  
    2019                Integer target = 3; 
    2120                int expected = 3; 
     
    2322                int result = ArrayTools.findIndex(array, target); 
    2423 
    25                 // add additional test code here 
    2624                assertEquals(expected, result); 
    2725        } 
     
    2927        @Test 
    3028        public void testFindIndex_2() throws Exception { 
    31  
    3229                Integer target = 4; 
    3330                int expected = 4; 
     
    3532                int result = ArrayTools.findIndex(array, target); 
    3633 
    37                 // add additional test code here 
    3834                assertEquals(expected, result); 
    3935        } 
     
    4541                int result = ArrayTools.findIndex(array, target); 
    4642                int expected = -1; 
    47  
    48                 // add additional test code here 
     43                 
    4944                assertEquals(expected, result); 
    5045        } 
     
    6560                int result = ArrayTools.findIndex(array, other); 
    6661 
    67                 // add additional test code here 
    6862                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); 
    69179        } 
    70180 
Note: See TracChangeset for help on using the changeset viewer.