Skip to content
This repository has been archived by the owner on Feb 27, 2023. It is now read-only.

Commit

Permalink
add unit test for Set
Browse files Browse the repository at this point in the history
Signed-off-by: Zhou Hao <[email protected]>
  • Loading branch information
Zhou Hao committed Jan 14, 2020
1 parent b936211 commit 733a6e3
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pkg/atomiccount/atomiccount_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,13 @@ func (suite *AtomicCountUtilSuite) TestAdd(c *check.C) {
result := acount.Get()
c.Check(result, check.Equals, (int32)(12))
}

func (suite *AtomicCountUtilSuite) TestSet(c *check.C) {
acount := NewAtomicInt(3)
acount.Add(4)
acount.Add(5)

_ = acount.Set(1)
result := acount.Get()
c.Check(result, check.Equals, (int32)(1))
}

0 comments on commit 733a6e3

Please sign in to comment.