1package cgo 2 3import ( 4 "math" 5 "testing" 6) 7 8func TestNsqrt(t *testing.T) { 9 for _, n := range []int{1, 2, 10, 100, 1000} { 10 got, want := Nsqrt(n), int(math.Floor(math.Sqrt(float64(n)))) 11 if got != want { 12 t.Errorf("Nsqrt(n) = %d; want %d", got, want) 13 } 14 } 15} 16