xref: /aosp_15_r20/external/bazelbuild-rules_go/tests/legacy/examples/cgo/cgo_lib_test.go (revision 9bb1b549b6a84214c53be0924760be030e66b93a)
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