1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2025-11-18 17:41:34 -05:00

Unit test library to simplify test writing

This commit is contained in:
V2Ray
2015-09-09 14:51:26 +02:00
parent 526c3d3a9b
commit 08a96e5fe1
7 changed files with 266 additions and 33 deletions

View File

@@ -0,0 +1,31 @@
package unit
import (
"testing"
)
type Assertion struct {
t *testing.T
}
func Assert(t *testing.T) *Assertion {
assert := new(Assertion)
assert.t = t
return assert
}
func (a *Assertion) Int(value int) *IntSubject {
return NewIntSubject(NewSubject(a), value)
}
func (a *Assertion) Uint16(value uint16) *Uint16Subject {
return NewUint16Subject(NewSubject(a), value)
}
func (a *Assertion) Byte(value byte) *ByteSubject {
return NewByteSubject(NewSubject(a), value)
}
func (a *Assertion) Bytes(value []byte) *BytesSubject {
return NewBytesSubject(NewSubject(a), value)
}