-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Стандартное квадратное уравнение с одним решением
- Loading branch information
Showing
2 changed files
with
22 additions
and
1 deletion.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,19 @@ | ||
import org.junit.Assert; | ||
import org.junit.Test; | ||
|
||
/** | ||
* Тесты для решения квадратного уравнения | ||
*/ | ||
public class QuadraticEquationTest extends Assert { | ||
public static final double EPS = 1e-10; | ||
|
||
|
||
/** | ||
* Стандартное квадратное уравнение с одним решением | ||
*/ | ||
@Test | ||
public void testSimpleOneRoot() { | ||
assertArrayEquals("x^2 = 0", new double[]{0}, QuadraticEquation.solve(1, 0, 0), EPS); | ||
assertArrayEquals("(x-1)^2 = x^2-2x+1", new double[]{1}, QuadraticEquation.solve(1, -2, 1), EPS); | ||
assertArrayEquals("2(x-1)^2 = 2x^2-4x+2", new double[]{1}, QuadraticEquation.solve(2, -4, 2), EPS); | ||
} | ||
} |