Skip to content

Instantly share code, notes, and snippets.

@efiku
Created January 12, 2016 00:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save efiku/75495266a370f156418f to your computer and use it in GitHub Desktop.
Save efiku/75495266a370f156418f to your computer and use it in GitHub Desktop.
Test Delta Class
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