Files
gotenberg/internal/pkg/xassert/int64_test.go
2019-07-24 14:56:12 +02:00

33 lines
636 B
Go

package xassert
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/thecodingmachine/gotenberg/test"
)
func TestInt64NotInferiorTo(t *testing.T) {
rule := Int64NotInferiorTo(0)
// should be OK.
rule.with("FOO", 10)
err := rule.validate()
assert.Nil(t, err)
// should not be OK.
rule.with("FOO", -10)
err = rule.validate()
test.AssertError(t, err)
}
func TestInt64NotSuperiorTo(t *testing.T) {
rule := Int64NotSuperiorTo(0)
// should be OK.
rule.with("FOO", -10)
err := rule.validate()
assert.Nil(t, err)
// should not be OK.
rule.with("FOO", 10)
err = rule.validate()
test.AssertError(t, err)
}