github.com/0xKiwi/rules_go@v0.24.3/tests/legacy/examples/cgo/cgo_lib_test.go (about)

     1  package cgo
     2  
     3  import (
     4  	"math"
     5  	"testing"
     6  )
     7  
     8  func 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  }