Fixed so many IndexedSeries bugs...

This commit is contained in:
Luke I. Wilson
2023-05-24 11:24:10 -05:00
parent c0de28664e
commit 46fd55ab8d
17 changed files with 345 additions and 2981 deletions

View File

@@ -96,11 +96,11 @@ func TestIndexedFrame(t *testing.T) {
if data.Close(-1) != 1.0 {
t.Fatalf("Expected latest close to be 1.0, got %f", data.Close(-1))
}
if !data.Date(0).Time().Equal(time.Date(2021, 5, 15, 0, 0, 0, 0, time.UTC)) {
if !data.Date(-1).Time().Equal(time.Date(2021, 5, 15, 0, 0, 0, 0, time.UTC)) {
t.Fatalf("Expected first date to be 2021-05-15, got %v", data.Date(0))
}
if index := UnixTime(time.Date(2021, 5, 15, 0, 0, 0, 0, time.UTC).Unix()); data.CloseIndex(index) != 1.4 {
t.Fatalf("Expected close at 2021-05-15 to be 1.4, got %f", data.CloseIndex(index))
if index := UnixTime(time.Date(2021, 5, 15, 0, 0, 0, 0, time.UTC).Unix()); data.CloseIndex(index) != 1.0 {
t.Fatalf("Expected close at 2021-05-15 to be 1.0, got %f", data.CloseIndex(index))
}
t.Log(data.String())