< Summary

Class:LinearExtrapolatorTest
Assembly:bamlab.test.editmode
File(s):/github/workspace/Assets/Tests/EditMode/LinearExtrapolatorTest.cs
Covered lines:0
Uncovered lines:28
Coverable lines:28
Total lines:42
Line coverage:0% (0 of 28)
Covered branches:0
Total branches:0
Covered methods:0
Total methods:4
Method coverage:0% (0 of 4)

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
GenerateAgent()0%2100%
TestPresent()0%2100%
TestPast()0%2100%
TestFuture()0%2100%

File(s)

/github/workspace/Assets/Tests/EditMode/LinearExtrapolatorTest.cs

#LineLine coverage
 1using NUnit.Framework;
 2using System.Collections;
 3using System.Collections.Generic;
 4using UnityEngine;
 5using UnityEngine.TestTools;
 6
 7public class LinearExtrapolatorTest {
 08  public static Agent GenerateAgent() {
 09    Agent agent = new GameObject().AddComponent<DummyAgent>();
 010    Rigidbody rb = agent.gameObject.AddComponent<Rigidbody>();
 011    agent.transform.position = new Vector3(10, 0, 5);
 012    rb.linearVelocity = new Vector3(1, -2, 2);
 013    return agent;
 014  }
 15
 16  [Test]
 017  public void TestPresent() {
 018    Agent agent = GenerateAgent();
 019    LinearExtrapolator predictor = new LinearExtrapolator(agent);
 020    PredictorState predictedState = predictor.Predict(time: 0f);
 021    Assert.AreEqual(agent.GetPosition(), predictedState.Position);
 022    Assert.AreEqual(agent.GetVelocity(), predictedState.Velocity);
 023  }
 24
 25  [Test]
 026  public void TestPast() {
 027    Agent agent = GenerateAgent();
 028    LinearExtrapolator predictor = new LinearExtrapolator(agent);
 029    PredictorState predictedState = predictor.Predict(time: -5f);
 030    Assert.AreEqual(new Vector3(5, 10, -5), predictedState.Position);
 031    Assert.AreEqual(agent.GetVelocity(), predictedState.Velocity);
 032  }
 33
 34  [Test]
 035  public void TestFuture() {
 036    Agent agent = GenerateAgent();
 037    LinearExtrapolator predictor = new LinearExtrapolator(agent);
 038    PredictorState predictedState = predictor.Predict(time: 10f);
 039    Assert.AreEqual(new Vector3(20, -20, 25), predictedState.Position);
 040    Assert.AreEqual(agent.GetVelocity(), predictedState.Velocity);
 041  }
 42}