| 111 | } |
| 112 | |
| 113 | func TestTickerFunc_Ticks(t *testing.T) { |
| 114 | type args struct { |
| 115 | min float64 |
| 116 | max float64 |
| 117 | } |
| 118 | tests := []struct { |
| 119 | name string |
| 120 | args args |
| 121 | want []Tick |
| 122 | f TickerFunc |
| 123 | }{ |
| 124 | { |
| 125 | name: "return exactly the same ticks as the function passed to TickerFunc", |
| 126 | args: args{0, 3}, |
| 127 | want: []Tick{{1, "a"}, {2, "b"}}, |
| 128 | f: func(min, max float64) []Tick { |
| 129 | return []Tick{{1, "a"}, {2, "b"}} |
| 130 | }, |
| 131 | }, |
| 132 | } |
| 133 | for _, tt := range tests { |
| 134 | t.Run(tt.name, func(t *testing.T) { |
| 135 | if got := tt.f.Ticks(tt.args.min, tt.args.max); !reflect.DeepEqual(got, tt.want) { |
| 136 | t.Errorf("TickerFunc.Ticks() = %v, want %v", got, tt.want) |
| 137 | } |
| 138 | }) |
| 139 | } |
| 140 | } |
| 141 | |
| 142 | func TestInvertedScale_Normalize(t *testing.T) { |
| 143 | inverter := InvertedScale{Normalizer: LinearScale{}} |