src/util/atomicbool_test.go
raw| 1 | package util |
| 2 | |
| 3 | import "testing" |
| 4 | |
| 5 | func TestAtomicBool(t *testing.T) { |
| 6 | if !NewAtomicBool(true).Get() || NewAtomicBool(false).Get() { |
| 7 | t.Error("Invalid initial value") |
| 8 | } |
| 9 | |
| 10 | ab := NewAtomicBool(true) |
| 11 | if ab.Set(false) { |
| 12 | t.Error("Invalid return value") |
| 13 | } |
| 14 | if ab.Get() { |
| 15 | t.Error("Invalid state") |
| 16 | } |
| 17 | } |