forked from TrueCloudLab/frostfs-sdk-go
[#3] policy/test: increase test coverage
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
e78eb268a9
commit
f5413e94b5
1 changed files with 23 additions and 11 deletions
|
@ -3,6 +3,7 @@ package policy
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"math"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/nspcc-dev/neofs-api-go/v2/netmap"
|
"github.com/nspcc-dev/neofs-api-go/v2/netmap"
|
||||||
|
@ -271,17 +272,28 @@ func TestValidation(t *testing.T) {
|
||||||
_, err := Parse(q)
|
_, err := Parse(q)
|
||||||
require.Error(t, err)
|
require.Error(t, err)
|
||||||
})
|
})
|
||||||
t.Run("InvalidNumberInREP", func(t *testing.T) {
|
}
|
||||||
q := `REP 0`
|
|
||||||
_, err := Parse(q)
|
// Checks that an error is returned in cases when positive 32-bit integer is expected.
|
||||||
require.True(t, errors.Is(err, ErrSyntaxError), "got: %v", err)
|
func TestInvalidNumbers(t *testing.T) {
|
||||||
})
|
tmpls := []string{
|
||||||
t.Run("InvalidNumberInREP", func(t *testing.T) {
|
"REP %d",
|
||||||
q := `REP 1 IN Good
|
"REP 1 CBF %d",
|
||||||
SELECT 0 IN City FROM *`
|
"REP 1 SELECT %d FROM *",
|
||||||
_, err := Parse(q)
|
}
|
||||||
require.True(t, errors.Is(err, ErrSyntaxError), "got: %v", err)
|
for i := range tmpls {
|
||||||
})
|
zero := fmt.Sprintf(tmpls[i], 0)
|
||||||
|
t.Run(zero, func(t *testing.T) {
|
||||||
|
_, err := Parse(zero)
|
||||||
|
require.Error(t, err)
|
||||||
|
})
|
||||||
|
|
||||||
|
big := fmt.Sprintf(tmpls[i], int64(math.MaxUint32)+1)
|
||||||
|
t.Run(big, func(t *testing.T) {
|
||||||
|
_, err := Parse(big)
|
||||||
|
require.Error(t, err)
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestFilterStringSymbols(t *testing.T) {
|
func TestFilterStringSymbols(t *testing.T) {
|
||||||
|
|
Loading…
Reference in a new issue