-
Notifications
You must be signed in to change notification settings - Fork 3
/
marubozu_test.go
35 lines (30 loc) · 1009 Bytes
/
marubozu_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
package golangcandles
import (
"testing"
"github.com/go-gota/gota/dataframe"
"github.com/go-gota/gota/series"
)
func TestMarubozu(t *testing.T) {
bear_df := dataframe.New(
series.New([]float64{200}, series.Float, "Open"),
series.New([]float64{200}, series.Float, "High"),
series.New([]float64{100}, series.Float, "Close"),
series.New([]float64{100}, series.Float, "Low"),
)
result_bear := Marubozu(bear_df)
expected_bear := -100
if result_bear != expected_bear {
t.Errorf("TestMarubozu Bear unexpected result: got %v want %v", result_bear, expected_bear)
}
bull_df := dataframe.New(
series.New([]float64{100}, series.Float, "Open"),
series.New([]float64{200}, series.Float, "High"),
series.New([]float64{200}, series.Float, "Close"),
series.New([]float64{100}, series.Float, "Low"),
)
result_bull := Marubozu(bull_df)
expected_bull := 100
if result_bull != expected_bull {
t.Errorf("TestMarubozu Bull unexpected result: got %v want %v", result_bear, expected_bear)
}
}