コード例 #1
0
func testRegionSplit(helper bigRegionSplitHelper, t *testing.T) {
	const iterlim = 255
	parent := bigbase.BigBaseNumerics{}
	parent.Precision = prec
	parent.SqrtDivergeLimit = parent.MakeBigFloat(2.0)
	parent.IterateLimit = iterlim

	initMin := bigbase.BigComplex{helper.left, helper.bottom}
	initMax := bigbase.BigComplex{helper.right, helper.top}

	topLeftMin := bigbase.BigComplex{helper.left, helper.midI}
	topLeftMax := bigbase.BigComplex{helper.midR, helper.top}

	topRightMin := bigbase.BigComplex{helper.midR, helper.midI}
	topRightMax := bigbase.BigComplex{helper.right, helper.top}

	bottomLeftMin := bigbase.BigComplex{helper.left, helper.bottom}
	bottomLeftMax := bigbase.BigComplex{helper.midR, helper.midI}

	bottomRightMin := bigbase.BigComplex{helper.midR, helper.bottom}
	bottomRightMax := bigbase.BigComplex{helper.right, helper.midI}

	subjectRegion := createBigRegion(parent, initMin, initMax)

	expected := []bigRegion{
		createBigRegion(parent, topLeftMin, topLeftMax),
		createBigRegion(parent, topRightMin, topRightMax),
		createBigRegion(parent, bottomLeftMin, bottomLeftMax),
		createBigRegion(parent, bottomRightMin, bottomRightMax),
	}

	numerics := BigRegionNumerics{}
	numerics.BigBaseNumerics = parent
	numerics.Region = subjectRegion
	numerics.Split()
	actualChildren := numerics.subregion.children

	for i, expectReg := range expected {
		actReg := actualChildren[i]
		exPoints := expectReg.points()
		acPoints := actReg.points()

		fail := false
		for j, ep := range exPoints {
			ap := acPoints[j]
			okay := bigbase.BigComplexEq(ep.C, ap.C)
			if !okay {
				fail = true
				t.Log("Region", i, "error at point", j,
					"\nexpected\t", bigbase.DbgC(*ep.C),
					"\nbut received\t", bigbase.DbgC(*ap.C))
			}
		}
		if fail {
			t.Fail()
		}
	}
}
コード例 #2
0
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)
	}
}