-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_regression.py
94 lines (74 loc) · 2.93 KB
/
test_regression.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#!/usr/bin/env python3
from dsimplex import simplex
from dsimplex import args
from numpy.testing import assert_almost_equal
def test_integ_one():
"""Integration test for csv one."""
mock_cli: str = "-m --csv ./tests/equ1.csv --delim ,"
argparser = args.Argparser()
argparser.parse(mock_cli.split())
assert_almost_equal(simplex.parse_equ_csv_loop(argparser)[0], -17.0)
def test_integ_three():
"""Integration test for csv three."""
mock_cli: str = "-m --csv ./tests/equ3.csv --delim ,"
argparser = args.Argparser()
argparser.parse(mock_cli.split())
assert_almost_equal(simplex.parse_equ_csv_loop(argparser)[0], -16.0)
def test_integ_four():
"""Integration test for csv four."""
mock_cli: str = "-m --csv ./tests/equ4.csv --delim ,"
argparser = args.Argparser()
argparser.parse(mock_cli.split())
assert_almost_equal(simplex.parse_equ_csv_loop(argparser)[0], -5.4)
def test_integ_five():
"""Integration test for csv five."""
mock_cli: str = "-m --csv ./tests/equ5.csv --delim ,"
argparser = args.Argparser()
argparser.parse(mock_cli.split())
assert_almost_equal(simplex.parse_equ_csv_loop(argparser)[0], -1.25)
def test_integ_six():
"""Integration test for csv six."""
mock_cli: str = "-m --csv ./tests/equ6.csv --delim ,"
argparser = args.Argparser()
argparser.parse(mock_cli.split())
assert_almost_equal(simplex.parse_equ_csv_loop(argparser)[0], -6.0)
def test_integ_seven():
"""Integration test for csv six."""
mock_cli: str = "--csv ./tests/equ7.csv --delim ,"
argparser = args.Argparser()
argparser.parse(mock_cli.split())
assert_almost_equal(simplex.parse_equ_csv_loop(argparser)[0], 600)
def test_integ_eight():
"""Integration test for csv six."""
mock_cli: str = "--csv ./tests/equ8.csv --delim ,"
argparser = args.Argparser()
argparser.parse(mock_cli.split())
assert_almost_equal(simplex.parse_equ_csv_loop(argparser)[0], 13)
def test_integ_nine():
"""Integration test for csv nine."""
mock_cli: str = "--csv ./tests/equ9.csv --delim ,"
argparser = args.Argparser()
argparser.parse(mock_cli.split())
assert_almost_equal(simplex.parse_equ_csv_loop(argparser)[0], 400)
def test_integ_multi():
"""Integration test for multiple LP problems with the same equation."""
mock_cli: str = "-m --csv ./tests/equ_loop.csv --delim ,"
argparser = args.Argparser()
argparser.parse(mock_cli.split())
assert_almost_equal(
simplex.parse_equ_csv_loop(argparser),
[
-1.25,
-1.25,
-1.25,
-1.25,
],
)
def test_integ_multi_diff():
"""Integration test for multiple LP problems with different equation."""
mock_cli: str = "-m --csv ./tests/equ_loop_diff.csv --delim ,"
argparser = args.Argparser()
argparser.parse(mock_cli.split())
assert_almost_equal(
simplex.parse_equ_csv_loop(argparser), [-17.0, -6.0, -1.25]
)