<Description> : Add toggled var to Bool.

<Type> : feature/test
This commit is contained in:
Arunav Sanyal 2017-01-01 15:06:25 -08:00 committed by Arunav Sanyal
parent 56bfb9a7cd
commit bcd3589df5
3 changed files with 18 additions and 3 deletions

View File

@ -4,16 +4,18 @@ All notable changes to this project will be documented in this file.
## [Unreleased]
Add subsequent changes that you make in this section.
1. **Bool**
- `public var toggled` in [[PR]](https://github.com/goktugyil/EZSwiftExtensions/pull/352) by *Khalian*
1. **CGPoint:**
2. **CGPoint:**
- `init(vector: CGVector)` in [[PR]](https://github.com/goktugyil/EZSwiftExtensions/pull/349) by *Khalian*
- `init(angle: CGFloat)` in [[PR]](https://github.com/goktugyil/EZSwiftExtensions/pull/349) by *Khalian*
2. **Date**
3. **Date**
- `var isFuture` in [[PR]](https://github.com/goktugyil/EZSwiftExtensions/pull/343) by *Khalian*
- `var isPast` in [[PR]](https://github.com/goktugyil/EZSwiftExtensions/pull/343) by *Khalian*
3. **UInt**
4. **UInt**
- `static gcd(_ firstNum:UInt, _ secondNum:UInt) -> UInt` in [[PR]](https://github.com/goktugyil/EZSwiftExtensions/pull/347) by *Khalian*
- `static lcm(_ firstNum:UInt, _ secondNum:UInt) -> UInt` in [[PR]](https://github.com/goktugyil/EZSwiftExtensions/pull/347)by *Khalian*

View File

@ -22,5 +22,13 @@ class BoolTests: XCTestCase {
value.toggle()
XCTAssertNotEqual(value, false)
}
func testToggled() {
let falseVal = false
XCTAssertTrue(falseVal.toggled)
let trueVal = true
XCTAssertFalse(trueVal.toggled)
}
}

View File

@ -16,4 +16,9 @@ extension Bool {
self = !self
return self
}
/// EZSE: Return inverted value of bool.
public var toggled: Bool {
return !self
}
}