aboutsummaryrefslogtreecommitdiff
path: root/internal/feed/score_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/feed/score_test.go')
-rw-r--r--internal/feed/score_test.go34
1 files changed, 17 insertions, 17 deletions
diff --git a/internal/feed/score_test.go b/internal/feed/score_test.go
index 0bda1b2..2baa7ab 100644
--- a/internal/feed/score_test.go
+++ b/internal/feed/score_test.go
@@ -43,14 +43,14 @@ func TestScoreUnmarshalInvalidValues(t *testing.T) {
func TestScoreUnmarshalValidValues(t *testing.T) {
tests := []struct {
val string
- exp float32
+ exp uint8
} {
- { `0.0`, 0.0 },
- { `0.1`, 0.1 },
- { `1.2`, 1.2 },
- { `5.9`, 5.9 },
- { `9.9`, 9.9 },
- { `10.0`, 10.0 },
+ { `0.0`, 0 },
+ { `0.1`, 1 },
+ { `1.2`, 12 },
+ { `5.9`, 59 },
+ { `9.9`, 99 },
+ { `10.0`, 100 },
}
for _, test := range(tests) {
@@ -60,8 +60,8 @@ func TestScoreUnmarshalValidValues(t *testing.T) {
if err := json.Unmarshal([]byte(test.val), &got); err != nil {
t.Error(err)
return
- } else if float32(got) != test.exp {
- t.Errorf("got \"%f\", exp \"%f\"", float32(got), test.exp)
+ } else if uint8(got) != test.exp {
+ t.Errorf("got \"%d\", exp \"%d\"", uint8(got), test.exp)
}
})
}
@@ -69,16 +69,16 @@ func TestScoreUnmarshalValidValues(t *testing.T) {
func TestScoreString(t *testing.T) {
tests := []struct {
- val float32
+ val uint8
exp string
} {
- { 0.0, "0.0" },
- { 0.01, "0.0" },
- { 0.09, "0.0" },
- { 1.2222, "1.2" },
- { 5.9, "5.9" },
- { 9.99, "9.9" },
- { 10.0, "10.0" },
+ { 0, "0.0" },
+ { 1, "0.1" },
+ { 9, "0.9" },
+ { 12, "1.2" },
+ { 59, "5.9" },
+ { 99, "9.9" },
+ { 100, "10.0" },
}
for _, test := range(tests) {