-
Notifications
You must be signed in to change notification settings - Fork 0
/
index_test.go
64 lines (63 loc) · 1.6 KB
/
index_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
57
58
59
60
61
62
63
64
package main
//func TestIndexer(t *testing.T) {
// STs := []string{"abc123", "bcd234"}
// indexer := NewIndexer(STs)
// indexer.BitProfiles(&Profile{
// ST: "abc123",
// Matches: map[string]interface{}{
// "gene1": 1,
// "gene2": 1,
// "gene3": 1,
// },
// })
// index := indexer.profilesMap[indexer.lookup["abc123"]]
// if value := index.Genes.blocks[0]; value != 7 {
// t.Fatalf("Got %d, expected 7\n", value)
// }
//
// indexer.BitProfiles(&Profile{
// ST: "bcd234",
// Matches: map[string]interface{}{
// "gene1": 2,
// "gene2": 2,
// "gene4": 1,
// },
// })
//
// valueOfGene3 := (1 << indexer.geneTokens.Get(AlleleKey{
// "gene3",
// nil,
// }))
// valueOfGene4 := (1 << indexer.geneTokens.Get(AlleleKey{
// "gene4",
// nil,
// }))
// expectedValue := 7 - valueOfGene3 + valueOfGene4
//
// index = indexer.profilesMap[indexer.lookup["bcd234"]]
// if value := index.Genes.blocks[0]; value != uint64(expectedValue) {
// t.Fatalf("Got %d, expected %d\n", value, expectedValue)
// }
// if value := index.Alleles.blocks[0]; value != 56 {
// t.Fatalf("Got %d, expected 56\n", value)
// }
//}
//
//func TestTokeniser(t *testing.T) {
// tokens := NewTokeniser()
// if token := tokens.Get(AlleleKey{"foo", 1}); token != 0 {
// t.Fatal("Wanted 0")
// }
// if token := tokens.Get(AlleleKey{"foo", 1}); token != 0 {
// t.Fatal("Wanted 0")
// }
// if token := tokens.Get(AlleleKey{"bar", 1}); token != 1 {
// t.Fatal("Wanted 1")
// }
// if token := tokens.Get(AlleleKey{"foo", 1}); token != 0 {
// t.Fatal("Wanted 0")
// }
// if token := tokens.Get(AlleleKey{"foo", "1"}); token != 2 {
// t.Fatal("Wanted 2")
// }
//}