Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathcomplex.go
More file actions
Latest commit
39 lines (31 loc) · 949 Bytes
/
Copy pathcomplex.go
File metadata and controls
39 lines (31 loc) · 949 Bytes
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
package assert
typeComplexstruct {
logFacade*logFacade
actualcomplex128
}
func (a*Complex) IsZero() *Complex {
returna.isTrue(a.actual==0,
"Expected zero, but was <%v>.", a.actual)
}
func (a*Complex) IsNonZero() *Complex {
returna.isTrue(a.actual!=0,
"Expected nonzero, but was zero.")
}
func (a*Complex) IsEqualTo(expectedcomplex128) *Complex {
returna.isTrue(a.actual==expected,
"Expected <%v>, but was <%v>.", expected, a.actual)
}
func (a*Complex) IsNotEqualTo(unexpectedcomplex128) *Complex {
returna.isTrue(a.actual!=unexpected,
"Expected not equal to <%v>, but was.", unexpected)
}
func (a*Complex) Real() *Float {
return&Float{a.logFacade, real(a.actual)}
}
func (a*Complex) Imag() *Float {
return&Float{a.logFacade, imag(a.actual)}
}
func (a*Complex) isTrue(conditionbool, formatstring, args...interface{}) *Complex {
logIfFalse(a.logFacade, condition, format, args...)
returna
}