-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_pytest.py
29 lines (23 loc) · 931 Bytes
/
test_pytest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from quadratic_equation import *
import pytest
@pytest.mark.delta
@pytest.mark.parametrize("a,b,c,output",
[(6, 4, -4, 112),
(4, 8, 4, 0),
(7, 2, 4, -108)])
def test_delta_calculator(a, b, c, output):
assert delta_calculator(a, b, c) == output
@pytest.mark.statement_coverage
@pytest.mark.parametrize("a,b,delta,output",
[(2, 2, 36, (1, -2)),
(2, 4, 0, (-1)),
(2, 4, -16, (-1, 1))])
def test_solve_statement(a, b, delta, output):
assert solve(a, b, delta) == output
@pytest.mark.branch_coverage
@pytest.mark.parametrize("a,b,delta,output",
[(4, 4, 16, (0, -1)),
(3, 6, 0, (-1)),
(8, 0, -64, (0, 0.5))])
def test_solve_branch(a, b, delta, output):
assert solve(a, b, delta) == output