29 lines
420 B
Go
29 lines
420 B
Go
package service
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestCalculateBuff(t *testing.T) {
|
|
tests := []struct {
|
|
likeCount int
|
|
expected int
|
|
}{
|
|
{0, 0},
|
|
{4, 0},
|
|
{5, 10},
|
|
{9, 10},
|
|
{10, 20},
|
|
{29, 20},
|
|
{30, 30},
|
|
{100, 30},
|
|
}
|
|
|
|
for _, tt := range tests {
|
|
result := CalculateBuff(tt.likeCount)
|
|
if result != tt.expected {
|
|
t.Errorf("CalculateBuff(%d) = %d, want %d", tt.likeCount, result, tt.expected)
|
|
}
|
|
}
|
|
}
|