forked from TrueCloudLab/frostfs-sdk-go
[#276] Merge repo with frostfs-api-go
Signed-off-by: Pavel Pogodaev <p.pogodaev@yadro.com>
This commit is contained in:
parent
5361f0eceb
commit
6ce73790ea
337 changed files with 66666 additions and 283 deletions
28
api/status/test/codes.go
Normal file
28
api/status/test/codes.go
Normal file
|
@ -0,0 +1,28 @@
|
|||
package statustest
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/api/status"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
// TestCodes checks mapping of status codes to the numbers.
|
||||
// Args must be pairs (status.Code, int).
|
||||
func TestCodes(t *testing.T,
|
||||
localizer func(*status.Code) bool,
|
||||
globalizer func(code *status.Code),
|
||||
vals ...any,
|
||||
) {
|
||||
for i := 0; i < len(vals); i += 2 {
|
||||
c := vals[i].(status.Code)
|
||||
cp := c
|
||||
|
||||
globalizer(&cp)
|
||||
require.True(t, cp.EqualNumber(uint32(vals[i+1].(int))), c)
|
||||
|
||||
require.True(t, localizer(&cp), c)
|
||||
|
||||
require.Equal(t, cp, c, c)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue