forked from stellar/go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscval_test.go
48 lines (39 loc) · 947 Bytes
/
scval_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package xdr
import (
"testing"
"github.com/stretchr/testify/require"
"github.com/stellar/go/gxdr"
"github.com/stellar/go/randxdr"
)
func TestScValEqualsCoverage(t *testing.T) {
gen := randxdr.NewGenerator()
for i := 0; i < 30000; i++ {
scVal := ScVal{}
shape := &gxdr.SCVal{}
gen.Next(
shape,
[]randxdr.Preset{},
)
require.NoError(t, gxdr.Convert(shape, &scVal))
clonedScVal := ScVal{}
require.NoError(t, gxdr.Convert(shape, &clonedScVal))
require.True(t, scVal.Equals(clonedScVal), "scVal: %#v, clonedScVal: %#v", scVal, clonedScVal)
}
}
func TestScValStringCoverage(t *testing.T) {
gen := randxdr.NewGenerator()
for i := 0; i < 30000; i++ {
scVal := ScVal{}
shape := &gxdr.SCVal{}
gen.Next(
shape,
[]randxdr.Preset{},
)
require.NoError(t, gxdr.Convert(shape, &scVal))
var str string
require.NotPanics(t, func() {
str = scVal.String()
})
require.NotEqual(t, str, "unknown")
}
}