assertions.go 583 B

12345678910111213141516171819202122232425262728293031
  1. package unit
  2. import (
  3. "testing"
  4. )
  5. type Assertion struct {
  6. t *testing.T
  7. }
  8. func Assert(t *testing.T) *Assertion {
  9. assert := new(Assertion)
  10. assert.t = t
  11. return assert
  12. }
  13. func (a *Assertion) Int(value int) *IntSubject {
  14. return NewIntSubject(NewSubject(a), value)
  15. }
  16. func (a *Assertion) Uint16(value uint16) *Uint16Subject {
  17. return NewUint16Subject(NewSubject(a), value)
  18. }
  19. func (a *Assertion) Byte(value byte) *ByteSubject {
  20. return NewByteSubject(NewSubject(a), value)
  21. }
  22. func (a *Assertion) Bytes(value []byte) *BytesSubject {
  23. return NewBytesSubject(NewSubject(a), value)
  24. }