File: junkyard_test.go

package info (click to toggle)
golang-github-gorgonia-tensor 0.9.24-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,696 kB
  • sloc: sh: 18; asm: 18; makefile: 8
file content (26 lines) | stat: -rw-r--r-- 476 bytes parent folder | download
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
package tensor

import (
	"reflect"
	"testing"
)

// junkyard tests the miscelleneous things

func TestRandom(t *testing.T) {
	const size = 50
	for _, typ := range numberTypes.set {
		r := Random(typ, size)

		typR := reflect.TypeOf(r).Elem()
		valR := reflect.ValueOf(r)

		if typR != typ.Type {
			t.Errorf("Expected typR to be %v. Got %v instead", typ, typR)
		}
		if valR.Len() != size {
			t.Errorf("Expected length to be %v. Got %v instead", size, valR.Len())
		}

	}
}