-
Notifications
You must be signed in to change notification settings - Fork 35
/
Copy pathfactory_test.go
32 lines (26 loc) · 972 Bytes
/
factory_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
package defaults
import . "gopkg.in/check.v1"
type FactorySuite struct{}
var _ = Suite(&FactorySuite{})
func (s *FactorySuite) TestSetDefaultsBasic(c *C) {
foo := &ExampleBasic{}
Factory(foo)
s.assertTypes(c, foo)
}
func (s *FactorySuite) assertTypes(c *C, foo *ExampleBasic) {
c.Assert(foo.String, HasLen, 32)
c.Assert(foo.Integer, Not(Equals), 0)
c.Assert(foo.Integer8, Not(Equals), int8(0))
c.Assert(foo.Integer16, Not(Equals), int16(0))
c.Assert(foo.Integer32, Not(Equals), int32(0))
c.Assert(foo.Integer64, Not(Equals), int64(0))
c.Assert(foo.UInteger, Not(Equals), uint(0))
c.Assert(foo.UInteger8, Not(Equals), uint8(0))
c.Assert(foo.UInteger16, Not(Equals), uint16(0))
c.Assert(foo.UInteger32, Not(Equals), uint32(0))
c.Assert(foo.UInteger64, Not(Equals), uint64(0))
c.Assert(foo.String, Not(Equals), "")
c.Assert(string(foo.Bytes), HasLen, 32)
c.Assert(foo.Float32, Not(Equals), float32(0))
c.Assert(foo.Float64, Not(Equals), float64(0))
}