diff options
Diffstat (limited to 'lib/cbrt_test.go')
| -rw-r--r-- | lib/cbrt_test.go | 14 | 
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/cbrt_test.go b/lib/cbrt_test.go index a5722c8..6b3c9f3 100644 --- a/lib/cbrt_test.go +++ b/lib/cbrt_test.go @@ -21,3 +21,17 @@ func TestBigCubeRoot(t *testing.T) {  		return  	}  } + +func TestBigIntCubeRoot(t *testing.T) { +	a := big.NewInt(19683) +	acr := BigIntCubeRoot(a) +	if acr == nil { +		t.Errorf("Could not find cube root of %v\n", a) +		return +	} +	expected := big.NewInt(27) +	if big.NewInt(0).Sub(acr, expected).Cmp(big.NewInt(0)) != 0 { +		t.Errorf("Could not find cube root of %v (%v)\n", a, acr) +		return +	} +}  | 
