-
Notifications
You must be signed in to change notification settings - Fork 0
/
pairing_test.go
56 lines (46 loc) · 1.21 KB
/
pairing_test.go
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
package main
import (
"errors"
"strings"
"testing"
)
func getMockMembersMap(numMembers int) (MembersMap, error) {
alphabet := "abcdefghijklmnopqrstuvwxyz"
if numMembers > len(alphabet) {
return MembersMap{}, errors.New("Cannot mock more than 26 members")
}
members := MembersMap{}
for i := 0; i < numMembers; i++ {
letter := alphabet[i : i+1]
email := letter + "@gmail.com"
members[email] = MinimalMember{
ID: email,
Name: "Person " + strings.ToUpper(letter),
Trait: "1995",
LastRoundWith: map[string]int{},
}
for j := 0; j < numMembers; j++ {
if i == j {
continue
}
otherEmail := alphabet[j:j+1] + "@gmail.com"
members[email].LastRoundWith[otherEmail] = -1
}
}
return members, nil
}
func TestRunPairingAlgorithmCorrectness(t *testing.T) {
t.Log("Test correctness of the pairing algorithm's logic")
randomIntGenerator := func(n int) int {
return 0
}
members, err := getMockMembersMap(3)
if err != nil {
t.Error(err)
}
runPairingAlgorithm(members, 0, randomIntGenerator)
runPairingAlgorithm(members, 1, randomIntGenerator)
runPairingAlgorithm(members, 2, randomIntGenerator)
}
func TestPairingAlgorithmEndToEndTest(t *testing.T) {
}