func TestBigProxyRegionClaimExtrinsics(t *testing.T) {
	const prec = 53
	const ilim = 255
	parent := bigbase.BigBaseNumerics{}
	parent.IterateLimit = ilim
	parent.Precision = prec
	parent.SqrtDivergeLimit = parent.MakeBigFloat(2.0)
	min := parent.MakeBigComplex(-1.0, -1.0)
	max := parent.MakeBigComplex(1.0, 1.0)

	big := BigRegionNumericsProxy{}
	big.BigRegionNumerics = &BigRegionNumerics{}
	big.LocalRegion = createBigRegion(parent, min, max)

	big.ClaimExtrinsics()

	if !regionEq(big.LocalRegion, big.BigRegionNumerics.Region) {
		t.Error("Expected", big.LocalRegion,
			"but received", big.BigRegionNumerics.Region)
	}
}
Exemplo n.º 2
0
func createBigRegion(big bigbase.BigBaseNumerics, min bigbase.BigComplex, max bigbase.BigComplex) bigRegion {
	left := min.R
	bottom := min.I
	right := max.R
	top := max.I

	bigTwo := big.MakeBigFloat(2.0)

	midR := big.MakeBigFloat(0.0)
	midR.Add(&right, &left)
	midR.Quo(&midR, &bigTwo)

	midI := big.MakeBigFloat(0.0)
	midI.Add(&top, &bottom)
	midI.Quo(&midI, &bigTwo)

	coords := []bigbase.BigComplex{
		bigbase.BigComplex{left, top},
		bigbase.BigComplex{right, top},
		bigbase.BigComplex{left, bottom},
		bigbase.BigComplex{right, bottom},
		bigbase.BigComplex{midR, midI}, // midpoint is not technically a corner
	}

	points := make([]bigbase.BigEscapeValue, len(coords))

	for i, c := range coords {
		z := big.MakeBigComplex(0.0, 0.0)
		z.R.Copy(c.Real())
		z.I.Copy(c.Imag())
		p := big.Escape(&z)
		points[i] = p
	}

	return bigRegion{
		topLeft:     points[0],
		topRight:    points[1],
		bottomLeft:  points[2],
		bottomRight: points[3],
		midPoint:    points[4],
	}
}