-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathVanilla_test.go
43 lines (33 loc) · 966 Bytes
/
Vanilla_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
package SPADE
import (
"SPADE/utils"
"fmt"
"testing"
)
func TestVanilla(t *testing.T) {
queryValue := 1
datasetDir := "./usecases/hypnogram/dataset/"
fileName := "b000101.txt"
data := utils.ReadHypnogramFile(datasetDir + fileName)
num := testQueryTotalNum(t, data, queryValue)
resMap := testQueryNumRep(t, data, queryValue)
fmt.Println("=== Number of (", queryValue, "): ", num)
fmt.Println("=== Duration of (", queryValue, "): ", resMap)
fmt.Println("=== #Transitions of (", queryValue, "): ", len(resMap))
}
func testQueryNumRep(t *testing.T, data []int, value int) map[int]int {
var res map[int]int
vanilla := NewVanilla()
t.Run("Query Num Rep", func(t *testing.T) {
res = vanilla.QueryNumRep(data, value)
})
return res
}
func testQueryTotalNum(t *testing.T, data []int, value int) int {
var res int
vanilla := NewVanilla()
t.Run("Query Total Num", func(t *testing.T) {
res = vanilla.QueryTotalNum(data, value)
})
return res
}