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{
|
||||||
|
"REP %d",
|
||||||
|
"REP 1 CBF %d",
|
||||||
|
"REP 1 SELECT %d FROM *",
|
||||||
|
}
|
||||||
|
for i := range tmpls {
|
||||||
|
zero := fmt.Sprintf(tmpls[i], 0)
|
||||||
|
t.Run(zero, func(t *testing.T) {
|
||||||
|
_, err := Parse(zero)
|
||||||
|
require.Error(t, err)
|
||||||
})
|
})
|
||||||
t.Run("InvalidNumberInREP", func(t *testing.T) {
|
|
||||||
q := `REP 1 IN Good
|
big := fmt.Sprintf(tmpls[i], int64(math.MaxUint32)+1)
|
||||||
SELECT 0 IN City FROM *`
|
t.Run(big, func(t *testing.T) {
|
||||||
_, err := Parse(q)
|
_, err := Parse(big)
|
||||||
require.True(t, errors.Is(err, ErrSyntaxError), "got: %v", err)
|
require.Error(t, err)
|
||||||
})
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestFilterStringSymbols(t *testing.T) {
|
func TestFilterStringSymbols(t *testing.T) {
|
||||||
|
|
Loading…
Reference in a new issue