-
Notifications
You must be signed in to change notification settings - Fork 10
/
limits_test.go
56 lines (48 loc) · 975 Bytes
/
limits_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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package fsquota
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestLimit_GetHard(t *testing.T) {
t.Run("Nil", func(t *testing.T) {
l := &Limit{
hard: nil,
}
assert.EqualValues(t, 0, l.GetHard())
})
t.Run("NotNil", func(t *testing.T) {
l := &Limit{
hard: new(uint64),
}
*l.hard = 16
assert.EqualValues(t, 16, l.GetHard())
})
}
func TestLimit_GetSoft(t *testing.T) {
t.Run("Nil", func(t *testing.T) {
l := &Limit{
soft: nil,
}
assert.EqualValues(t, 0, l.GetSoft())
})
t.Run("NotNil", func(t *testing.T) {
l := &Limit{
soft: new(uint64),
}
*l.soft = 16
assert.EqualValues(t, 16, l.GetSoft())
})
}
func TestLimit_SetHard(t *testing.T) {
l := &Limit{}
l.SetHard(64)
require.NotNil(t, l.hard)
assert.EqualValues(t, 64, *l.hard)
}
func TestLimit_SetSoft(t *testing.T) {
l := &Limit{}
l.SetSoft(64)
require.NotNil(t, l.soft)
assert.EqualValues(t, 64, *l.soft)
}