tile38/internal/server/atomic_test.go

20 lines
322 B
Go
Raw Permalink Normal View History

package server
2018-03-07 08:07:38 +03:00
import "testing"
func TestAtomicInt(t *testing.T) {
var x aint
x.set(10)
if x.get() != 10 {
t.Fatalf("expected %v, got %v", 10, x.get())
}
x.add(-9)
if x.get() != 1 {
t.Fatalf("expected %v, got %v", 1, x.get())
}
x.add(-1)
if x.get() != 0 {
t.Fatalf("expected %v, got %v", 0, x.get())
}
}