func TestParameterValidation(t *testing.T) { peer, _ := NewPeer(EPP8_d) bruss := problems.NewBruss2D(10) instance := bruss.Initialize() c := Config{ BlockSize: 0, Fcn: bruss.Fcn, } peer.Integrate(0, 1, instance, &c) if c.BlockSize == 0 { t.Errorf("Peer didn't correct block size.") } }
func TestAllPeer(t *testing.T) { if testing.Short() { t.Skipf("Skipping because we're running in short test mode.") } integrators := make([]Integrator, NumberOfPeerMethods) for j := 0; j < int(NumberOfPeerMethods); j++ { p, err := NewPeer(PeerMethod(j)) if err != nil { t.Errorf("Couldn't create Peer Method %d: %s", j, err.Error()) } else { integrators[j] = p } } RunIntegratorTests(t, integrators, 1) }
func TestPeerMBody4h(t *testing.T) { peer, _ := NewPeer(EPP8_d) mbody := problems.NewMBody(4) instance := mbody.Initialize() config := Config{ Fcn: mbody.Fcn, AbsoluteTolerance: 1.e-5, RelativeTolerance: 1.e-5, } var t0, te float64 = 0.0, 0.1 stat, err := peer.Integrate(t0, te, instance, &config) if err != nil { t.Fatalf("Integration failed - %s", err.Error()) } if testing.Verbose() { t.Logf("MBody4H: %d steps, %d rejected, %d evaluations", stat.StepCount, stat.RejectedCount, stat.EvaluationCount) t.Logf("MBody: result[0..10] = %f", instance[:10]) } }