Skip to content
This repository was archived by the owner on Dec 20, 2024. It is now read-only.

Commit 733a6e3

Browse files
author
Zhou Hao
committed
add unit test for Set
Signed-off-by: Zhou Hao <[email protected]>
1 parent b936211 commit 733a6e3

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

pkg/atomiccount/atomiccount_test.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,13 @@ func (suite *AtomicCountUtilSuite) TestAdd(c *check.C) {
4040
result := acount.Get()
4141
c.Check(result, check.Equals, (int32)(12))
4242
}
43+
44+
func (suite *AtomicCountUtilSuite) TestSet(c *check.C) {
45+
acount := NewAtomicInt(3)
46+
acount.Add(4)
47+
acount.Add(5)
48+
49+
_ = acount.Set(1)
50+
result := acount.Get()
51+
c.Check(result, check.Equals, (int32)(1))
52+
}

0 commit comments

Comments
 (0)