package Tuan4;
import org.junit.Test;
import static org.junit.Assert.*;
public class JUnitTest {
@Test
public void soSanh() {
assertEquals(3, JUnit.SoSanh(2, 3));
assertEquals(4, JUnit.SoSanh(2, 4));
assertEquals(5, JUnit.SoSanh(4, 5));
assertEquals(6, JUnit.SoSanh(4, 6));
assertEquals(7, JUnit.SoSanh(1, 7));
}
@Test
public void timSoNhoNhat() {
int[] arr = {1,3,5,6,5};
assertEquals(1, JUnit.TimSoNhoNhat(arr, 5));
int[] arr1 = {5,3,5,6,5};
assertEquals(3, JUnit.TimSoNhoNhat(arr1, 5));
int[] arr2 = {11,32,5,6,5};
assertEquals(5, JUnit.TimSoNhoNhat(arr2, 5));
int[] arr3 = {1,3,-5,6,5};
assertEquals(-5, JUnit.TimSoNhoNhat(arr3, 5));
int[] arr4 = {1,3,5,-6,5};
assertEquals(-6, JUnit.TimSoNhoNhat(arr4, 5));
}
@Test
public void tinhChiSoBMI() {
float cao = 1.6f, nang = 60;
assertEquals("Thừa cân",JUnit.TinhChiSoBMI(cao, nang));
float cao1 = 1.7f, nang1 = 69.36f;
assertEquals("Thừa cân", JUnit.TinhChiSoBMI(cao1, nang1));
float cao2 = 1.8f, nang2 = 60;
assertEquals("Bình thường",JUnit.TinhChiSoBMI(cao2, nang2));
float cao3 = 1.9f, nang3 = 75.81f;
assertEquals("Bình thường",JUnit.TinhChiSoBMI(cao3, nang3));
float cao4 = 2, nang4 = 88;
assertEquals("Bình thường",JUnit.TinhChiSoBMI(cao4, nang4));
}
}
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.