1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-11-02 09:17:55 -04:00
v2fly/testing/assert/intsubject.go

39 lines
771 B
Go
Raw Normal View History

package assert
import (
2015-12-03 10:57:23 -05:00
"github.com/v2ray/v2ray-core/common/serial"
)
2016-05-24 15:55:46 -04:00
func (this *Assert) Int(value int) *IntSubject {
return &IntSubject{
Subject: Subject{
a: this,
disp: serial.IntToString(value),
},
value: value,
}
}
type IntSubject struct {
2015-12-02 15:44:01 -05:00
Subject
2016-05-24 15:55:46 -04:00
value int
}
func (subject *IntSubject) Equals(expectation int) {
2016-05-24 15:55:46 -04:00
if subject.value != expectation {
subject.Fail("is equal to", serial.IntToString(expectation))
}
}
func (subject *IntSubject) GreaterThan(expectation int) {
2016-05-24 15:55:46 -04:00
if subject.value <= expectation {
subject.Fail("is greater than", serial.IntToString(expectation))
}
}
func (subject *IntSubject) LessThan(expectation int) {
2016-05-24 15:55:46 -04:00
if subject.value >= expectation {
subject.Fail("is less than", serial.IntToString(expectation))
}
}