-
Notifications
You must be signed in to change notification settings - Fork 0
/
check_vce.go
77 lines (62 loc) · 1.24 KB
/
check_vce.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
package done
import "github.com/pkg/errors"
type Vce[V comparable] struct {
V V
E error
*Ve[V]
}
// VCE accept two params. one is comparable and one is error interface
func VCE[V comparable](val V, err error) *Vce[V] {
return &Vce[V]{
V: val,
E: err,
Ve: VE[V](val, err),
}
}
func (a *Vce[V]) Sure() V {
return Sure(a.Done())
}
func (a *Vce[V]) Nice() V {
return Nice(a.Done())
}
func (a *Vce[V]) Good() {
Good(a.Done())
}
func (a *Vce[V]) Fine() {
Fine(a.Done())
}
func (a *Vce[V]) Safe() {
Safe(a.Done())
}
func (a *Vce[V]) Zero() {
Zero(a.Done())
}
func (a *Vce[V]) None() {
None(a.Done())
}
func (a *Vce[V]) Same(v V) {
if x := a.Done(); x != v {
panic(errors.New("SHOULD BE SAME BUT IS DIFFERENT"))
}
}
func (a *Vce[V]) Diff(v V) {
if x := a.Done(); x == v {
panic(errors.New("SHOULD BE DIFFERENT BUT IS SAME"))
}
}
func (a *Vce[V]) Is(v V) {
if x := a.Done(); x != v {
panic(errors.New("SHOULD BE SAME BUT IS DIFFERENT"))
}
}
func (a *Vce[V]) Equals(v V) {
if x := a.Done(); x != v {
panic(errors.New("SHOULD BE SAME BUT IS DIFFERENT"))
}
}
// Different 这个单词这么长真是万恶啊
func (a *Vce[V]) Different(v V) {
if x := a.Done(); x == v {
panic(errors.New("SHOULD BE DIFFERENT BUT IS SAME"))
}
}