junit數組比較
以下斷言只是對整型數組進行比較,如需其它數據類型的比較則只需修改相應的數據類型;
/**
? * Asserts that two int arrays are equal. If they are not an
? * AssertionFailedError is thrown.
? */
?static public void assertEquals(int[] expected, int[] actual )
?{
??for(int i = 0; i < expected.length; i++)
??{
???assertEquals(null, expected[i], actual[i]);
??}
?}
/**
? * Asserts that two int arrays are equal. If they are not an
? * AssertionFailedError is thrown.
? */
?static public void assertEquals(int[] expected, int[] actual )
?{
??for(int i = 0; i < expected.length; i++)
??{
???assertEquals(null, expected[i], actual[i]);
??}
?}
|
posted on 2006-09-18 17:30 阿輝 閱讀(863) 評論(0) 編輯 收藏 所屬分類: junit