| 1 |
package tensor |
| 2 |
|
| 3 |
import ( |
| 4 |
"reflect" |
| 5 |
"testing" |
| 6 |
) |
| 7 |
|
| 8 |
// junkyard tests the miscelleneous things |
| 9 |
|
| 10 |
func TestRandom(t *testing.T) { |
| 11 |
const size = 50 |
| 12 |
for _, typ := range numberTypes.set { |
| 13 |
r := Random(typ, size) |
| 14 |
|
| 15 |
typR := reflect.TypeOf(r).Elem() |
| 16 |
valR := reflect.ValueOf(r) |
| 17 |
|
| 18 |
if typR != typ.Type { |
| 19 |
t.Errorf("Expected typR to be %v. Got %v instead", typ, typR) |
| 20 |
} |
| 21 |
if valR.Len() != size { |
| 22 |
t.Errorf("Expected length to be %v. Got %v instead", size, valR.Len()) |
| 23 |
} |
| 24 |
|
| 25 |
} |
| 26 |
} |