Add test coverage

This commit is contained in:
Dane Everitt
2022-01-30 13:58:36 -05:00
parent c4ee82c4dc
commit 3208b8579b
2 changed files with 79 additions and 3 deletions

View File

@@ -165,9 +165,9 @@ func (ab *AtomicBool) Store(v bool) {
ab.mu.Unlock()
}
// Stores the value "v" if the current value stored in the AtomicBool is the opposite
// boolean value. If successfully swapped, the response is "true", otherwise "false"
// is returned.
// SwapIf stores the value "v" if the current value stored in the AtomicBool is
// the opposite boolean value. If successfully swapped, the response is "true",
// otherwise "false" is returned.
func (ab *AtomicBool) SwapIf(v bool) bool {
ab.mu.Lock()
defer ab.mu.Unlock()