forked from mourasman/w3champions-mmr-service
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_balance.py
54 lines (40 loc) · 1.68 KB
/
test_balance.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
import numpy as np
from teambalance.balance import Balance
def test_team_balance_3v3v3v3():
ratings_G = np.round(np.random.normal(1500, 300, 12),0)
rds_G = np.array([90]*12)
game_mode = "3v3v3v3"
b = Balance()
teams_footies = b.find_best_game(ratings_G, rds_G, game_mode, "1+1+1+1+1+1+1+1+1+1+1+1")
sets = len(b.superset[game_mode])
assert sets == 15400
def test_team_balance_4rtv4rt():
ratings_G = np.round(np.random.normal(1500, 300, 8),0)
rds_G = np.array([90]*8)
game_mode = "4v4"
b = Balance()
at_constraints = "1+1+1+1+1+1+1+1"
teams_4v4 = b.find_best_game(ratings_G, rds_G, game_mode, at_constraints)
games_set_constrained = b._filter_constraints(b.superset[game_mode], at_constraints)
sets = len(games_set_constrained)
assert sets == 35
def test_team_balance_3atplus1v4rt():
ratings_G = np.round(np.random.normal(1500, 300, 8),0)
rds_G = np.array([90]*8)
game_mode = "4v4"
b = Balance()
at_constraints = "3+1+1+1+1+1"
teams_4v4 = b.find_best_game(ratings_G, rds_G, game_mode, at_constraints)
games_set_constrained = b._filter_constraints(b.superset[game_mode], at_constraints)
sets = len(games_set_constrained)
assert sets == 5
def test_team_balance_4atv4rt():
ratings_G = np.round(np.random.normal(1500, 300, 8),0)
rds_G = np.array([90]*8)
game_mode = "4v4"
b = Balance()
at_constraints = "4+1+1+1+1"
teams_4v4 = b.find_best_game(ratings_G, rds_G, game_mode, at_constraints)
games_set_constrained = b._filter_constraints(b.superset[game_mode], at_constraints)
sets = len(games_set_constrained)
assert sets == 1