???????------?????
???????????? ???????[ 2011/7/20 15:09:27 ] ????????
??????????????????????????????????????????????????????????????????????У????9??????????????????9???????????????????????????????????????????????????????????????????????????????
??????????????д????????????????????????????????????????ú????????????????????????????????
???????????Largest???????????
????1??????????λ???????????????
????[7??8??9] ? 9
????[7??9??8] ? 9
????[9??8??7] ? 9
????2????????????????????????????????
????[7??9??8??9] ? 9
????3?????????????????????????????????
????[1] - 1
????4?????????????????
????[-7??-8??-9] - -7
??????????????????????£?
public class LargestTest extends TestCase {
public void testSimple(){
assertEquals(9??Largest.largest(new int[]{7??8??9}));
}
public void testOrder(){
assertEquals(9??Largest.largest(new int[]{7??9??8}));
assertEquals(9??Largest.largest(new int[]{9??8??7}));
}
public void testDups(){
assertEquals(9??Largest.largest(new int[]{7??9??8??9}));
}
public void testOne(){
assertEquals(1??Largest.largest(new int[]{1}));
}
public void testNegative(){
assertEquals(-7??Largest.largest(new int[]{-7??-8??-9}));
}
}
??????????????д????????????????????????????β???????????????????к???????????testNegative()??????????
????junit.framework.AssertionFailedError: expected:<-7> but was:<0>
????at test.junit.LargestTest.testNegative(LargestTest.java:24)
?????????????????????????Largest?????Bug?????????????max??????0????????????Integer.MIN_VALUE??
?????????????????????????????????????????????BUG??????????????????緢??BUG????????????????????????
??????????????????????????????????????????????????????largest()?????д????????????????????????????????????????????ɡ?
????д?????????????????????????JUnit???????????????з????????£??google?????????????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11