123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255 |
- package util
- import "testing"
- func TestMax(t *testing.T) {
- cases := []struct {
- input []int64
- }{
- {
- input: []int64{},
- },
- {
- input: []int64{
- 268826797,
- },
- },
- {
- input: []int64{
- 1,
- 2,
- 3,
- 4,
- 5,
- 272668542,
- 87759075,
- 272670403,
- 192148035,
- 189361023,
- 88269430,
- 89400131,
- 272690653,
- 269278391,
- 268823477,
- 268826797,
- },
- },
- }
- for _, c := range cases {
- t.Run("", func(t *testing.T) {
- rs := Max(c.input)
- t.Logf("input %v \noutputs:%v\n", c.input, rs)
- })
- }
- }
- func TestStdDeviation(t *testing.T) {
- cases := []struct {
- input []float64
- }{
- {
- input: []float64{},
- },
- {
- input: []float64{
- 268826797,
- },
- },
- {
- input: []float64{
- 1,
- 2,
- 3,
- 4,
- 5,
- 272668542,
- 87759075,
- 272670403,
- 192148035,
- 189361023,
- 88269430,
- 89400131,
- 272690653,
- 269278391,
- 268823477,
- 268826797,
- },
- },
- }
- for _, c := range cases {
- t.Run("", func(t *testing.T) {
- rs := StdDeviation(c.input)
- t.Logf("input %v \noutputs:%v\n", c.input, rs)
- })
- }
- }
- func TestDeviation(t *testing.T) {
- cases := []struct {
- input []float64
- }{
- {
- input: []float64{
- 1,
- 2,
- 3,
- 4,
- 5,
- 272668542,
- 87759075,
- 272670403,
- 192148035,
- 189361023,
- 88269430,
- 89400131,
- 272690653,
- 269278391,
- 268823477,
- 268826797,
- },
- },
- }
- for _, c := range cases {
- t.Run("", func(t *testing.T) {
- rs := Deviation(c.input)
- t.Logf("input %v \noutputs:%v\n", c.input, rs)
- })
- }
- }
- func TestNormallization(t *testing.T) {
- cases := []struct {
- input []int64
- }{
- {
- input: []int64{
- 1,
- 2,
- 3,
- 4,
- 5,
- 272668542,
- 87759075,
- 272670403,
- 192148035,
- 189361023,
- 88269430,
- 89400131,
- 272690653,
- 269278391,
- 268823477,
- 268826797,
- },
- },
- }
- for _, c := range cases {
- t.Run("", func(t *testing.T) {
- rs := Normallization(c.input)
- t.Logf("input %v\n, outputs:%v\n", c.input, rs)
- })
- }
- }
- func TestExpectation(t *testing.T) {
- cases := []struct {
- input []float64
- }{
- {
- input: []float64{
- 272668542,
- 87759075,
- 272670403,
- 192148035,
- 189361023,
- 88269430,
- 89400131,
- 272690653,
- 269278391,
- 268823477,
- 268826797,
- 107338074,
- 272635619,
- 272655050,
- 272280850,
- 274403561,
- 274404369,
- 274408851,
- 33561986,
- 274440108,
- 274440766,
- 274440926,
- 273730691,
- 274443040,
- 273744469,
- 274443230,
- 273749519,
- 274837710,
- 273748847,
- 274837920,
- 273814911,
- 274838433,
- 269278030,
- 273815488,
- 273819536,
- 274838710,
- 274838821,
- 274875985,
- 274876083,
- },
- },
- {
- input: []float64{
- 23062012,
- 32199188,
- 114238752,
- 35134612,
- 18289010,
- 29669239,
- 25702393,
- 19201815,
- 38191035,
- 24237961,
- 10155123,
- 36970516,
- 14015382,
- 89085165,
- 28324458,
- 38405237,
- 20190219,
- 175006499,
- 178984876,
- 34990873,
- 158026517,
- 111053972,
- 25519948,
- 39061494,
- 155286833,
- 87469728,
- 62849283,
- 210174070,
- 13841839,
- 65905090,
- 8219588,
- 37192235,
- 274356431,
- 44363565,
- 22899631,
- 43582749,
- 101217680,
- 25011431,
- 33447081,
- 222278335,
- 20785287,
- 38448378,
- 40153047,
- },
- },
- }
- for _, c := range cases {
- t.Run("", func(t *testing.T) {
- output := Expectation(c.input)
- t.Logf("input %v, output:%v", c.input, output)
- })
- }
- }
|