Created
January 12, 2016 00:16
-
-
Save efiku/75495266a370f156418f to your computer and use it in GitHub Desktop.
Test Delta Class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package tests; | |
import delta.Delta; | |
import org.junit.Before; | |
import org.junit.Test; | |
import static org.junit.Assert.*; | |
/** | |
* Created by efik | |
* on 12.01.16. | |
*/ | |
public class DeltaTest { | |
private Delta delta; | |
@Before | |
public void setUp() throws Exception { | |
this.delta = new Delta(); | |
} | |
@Test(expected = Exception.class) | |
public void test_sumy_pierwiastkow_delta_mniejsza_od_zera() throws Exception { | |
this.delta.oblicz(1, -5, 22); | |
} | |
@Test | |
public void test_sumy_pierwiastkow_delta_wieksza_od_zera() throws Exception { | |
assertEquals(3, this.delta.oblicz(1, -3, -4), 0); | |
assertEquals(-2, this.delta.oblicz(-1, -2, 0), 0); | |
assertEquals(0, this.delta.oblicz(-1, 0, 5), 0); | |
assertEquals(-0.3, this.delta.oblicz(10, 3, -4), 0); | |
} | |
@Test | |
public void test_sumy_pierwiastkow_delta_rowna_zeru() throws Exception { | |
assertEquals(3, this.delta.oblicz(1, -6, 9), 0); | |
assertEquals(-2, this.delta.oblicz(1, 4, 4), 0); | |
} | |
@Test(expected = Exception.class) | |
public void test_sumy_pierwiastkow_gdy_podamy_a() throws Exception { | |
this.delta.oblicz(0, -5, 22); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment