Skip to content

Commit

Permalink
Added length checking
Browse files Browse the repository at this point in the history
  • Loading branch information
DreamingRaven committed Jul 17, 2022
1 parent bd593bd commit da71251
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions dataset/dataset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,20 +57,29 @@ func TestSliceOfErrays(t *testing.T) {
func TestDatasetInit(t *testing.T) {
sos := sliceOfSlices[float64](10, 20)
soe := sliceOfErrays(sos)
ds := NewSimpleDataset[erray.Erray[float64], float64](soe)
fmt.Println(ds)
NewSimpleDataset[erray.Erray[float64], float64](soe)
}

func TestDatasetGet(t *testing.T) {
sos := sliceOfSlices[float64](10, 20)
soe := sliceOfErrays(sos)
ds := NewSimpleDataset[erray.Erray[float64], float64](soe)
fmt.Println(ds)
e, err := ds.Get(len(*sos) - 1)
if err != nil {
t.Fatal(err)
}
fmt.Println(*e)
}

func TestDatasetLen(t *testing.T) {
sos := sliceOfSlices[float64](10, 20)
soe := sliceOfErrays(sos)
ds := NewSimpleDataset[erray.Erray[float64], float64](soe)
fmt.Println(ds)
dsLength, err := ds.Length()
if err != nil {
t.Fatal(err)
}
if dsLength != len(*sos) {
t.Fatal("Number of examples in slice of slices does not equal number of examples in dataset")
}
}

0 comments on commit da71251

Please sign in to comment.