-
Notifications
You must be signed in to change notification settings - Fork 0
/
usage_test.go
39 lines (37 loc) · 721 Bytes
/
usage_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package anthropic
import "testing"
func TestUsage_String(t *testing.T) {
tests := []struct {
name string
usage *Usage
want string
}{
{
name: "empty",
usage: &Usage{},
want: "Input: 0, Output: 0",
},
{
name: "input",
usage: &Usage{InputTokens: 1},
want: "Input: 1, Output: 0",
},
{
name: "output",
usage: &Usage{OutputTokens: 2},
want: "Input: 0, Output: 2",
},
{
name: "both",
usage: &Usage{InputTokens: 3, OutputTokens: 4},
want: "Input: 3, Output: 4",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := tt.usage.String(); got != tt.want {
t.Errorf("Usage.String() = %v, want %v", got, tt.want)
}
})
}
}