Files
v2fly/testing/assert/intsubject.go
T

39 lines
771 B
Go
Raw Normal View History

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