Skip to content

Commit

Permalink
Added further breakdown comments in test
Browse files Browse the repository at this point in the history
  • Loading branch information
DreamingRaven committed Jul 17, 2022
1 parent 84e8458 commit d494699
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions dataset/dataset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,23 @@ func TestDatasetInit(t *testing.T) {
}

func TestDatasetGet(t *testing.T) {
// construct dataset from slice of slices
sos := sliceOfSlices[float64](10, 20)
soe := sliceOfErrays(sos)

ds := NewSimpleDataset[erray.Erray[float64], float64](soe)

// now check dataset Get function returns what was originally there
// for each example row
for i := 0; i < len(*sos); i++ {
e, err := ds.Get(i)
if err != nil {
t.Fatal(err)
}
data_here := *(*e).GetData()
// for each feature in example row
for j := 0; j < len(data_here); j++ {
// if it does not match origin fail
if data_here[j] != (*sos)[i][j] {
t.Fatal(fmt.Sprintf("example [%v,%v] does not match %v != %v", i, j, data_here[j], (*sos)[i][j]))
}
Expand Down

0 comments on commit d494699

Please sign in to comment.