You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
443 B
Go
24 lines
443 B
Go
package namespace
|
|
|
|
import (
|
|
"github.com/matryer/is"
|
|
"testing"
|
|
)
|
|
|
|
func TestQuota(t *testing.T) {
|
|
is := is.New(t)
|
|
quota := FileSizeQuota{1000, 0}
|
|
|
|
is.True(quota.Allows(1000))
|
|
is.True(!quota.Allows(1001))
|
|
}
|
|
|
|
func TestQuotaManipulation(t *testing.T) {
|
|
is := is.New(t)
|
|
quota := FileSizeQuota{1000, 0}
|
|
quota = quota.Add(500)
|
|
is.Equal(quota.CurrentUsage, int64(500))
|
|
quota = quota.Remove(1000)
|
|
is.Equal(quota.CurrentUsage, int64(-500))
|
|
}
|