-
Notifications
You must be signed in to change notification settings - Fork 0
/
ema_test.go
55 lines (51 loc) · 967 Bytes
/
ema_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
package ematimeout
import (
"fmt"
"math/rand"
"testing"
)
func TestEMA_Normal(t *testing.T) {
options := &Options{
Tavg: 60,
Thwm: 250,
Tmax: 500,
N: 90,
}
ema := NewFrom(options)
for i := 0; i < 100; i++ {
a := rand.Float64() * float64(200)
e := ema.Update(a)
t := ema.Get()
fmt.Println("a: ", a, ", e: ", e, ", t: ", t)
}
}
func TestEMA_Abnormal(t *testing.T) {
options := &Options{
Tavg: 60,
Thwm: 250,
Tmax: 500,
N: 90,
}
ema := NewFrom(options)
for i := 0; i < 100; i++ {
a := rand.Float64()*float64(200) + float64(500)
e := ema.Update(a)
t := ema.Get()
fmt.Println("a: ", a, ", e: ", e, ", t: ", t)
}
}
func TestEMA_Burr(t *testing.T) {
options := &Options{
Tavg: 55,
Thwm: 300,
Tmax: 500,
N: 90,
}
ema := NewFrom(options)
for i := 0; i < 100; i++ {
a := rand.Float64()*float64(200) + float64(500)
e := ema.Update(a)
t := ema.Get()
fmt.Println("a: ", a, ", e: ", e, ", t: ", t)
}
}