| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| |
|
| | #if UNITY_EDITOR |
| |
|
| | using System; |
| | using System.Collections; |
| | using System.Collections.Generic; |
| | using System.Xml; |
| | using NUnit.Framework; |
| | using UnityEngine; |
| | using UnityEngine.TestTools; |
| |
|
| | namespace Mujoco { |
| |
|
| | [TestFixture] |
| | public class MjJointStateTests { |
| | private MjBody _body; |
| | private MjHingeJoint _joint; |
| | private MjInertial _inertial; |
| | private MjScene _scene; |
| |
|
| | [SetUp] |
| | public void SetUp() { |
| | _scene = MjScene.Instance; |
| | _body = new GameObject("body").AddComponent<MjBody>(); |
| | _joint = new GameObject("joint").AddComponent<MjHingeJoint>(); |
| | _joint.transform.parent = _body.transform; |
| | _inertial = new GameObject("inertial").AddComponent<MjInertial>(); |
| | _inertial.transform.parent = _body.transform; |
| | } |
| |
|
| | [TearDown] |
| | public void TearDown() { |
| | GameObject.DestroyImmediate(_joint.gameObject); |
| | GameObject.DestroyImmediate(_inertial.gameObject); |
| | GameObject.DestroyImmediate(_body.gameObject); |
| | GameObject.DestroyImmediate(MjScene.Instance); |
| | } |
| |
|
| | [UnityTest] |
| | public IEnumerator JointVelocityChangesTheConfiguration() { |
| | _joint.Velocity = 10; |
| | _scene.CreateScene(); |
| | yield return new WaitForFixedUpdate(); |
| | Assert.That(_joint.Configuration, Is.Not.EqualTo(0)); |
| | } |
| |
|
| | [UnityTest] |
| | public IEnumerator JointConfigurationIsUsed() { |
| | _joint.Configuration = 10; |
| | _scene.CreateScene(); |
| | yield return new WaitForFixedUpdate(); |
| | Assert.That(_joint.Configuration, Is.Not.EqualTo(0)); |
| | } |
| |
|
| | [UnityTest] |
| | public IEnumerator JointConfigurationIsReadOnly() { |
| | _scene.CreateScene(); |
| | _joint.Configuration = 10; |
| | yield return new WaitForFixedUpdate(); |
| | Assert.That(_joint.Configuration, Is.EqualTo(0)); |
| | } |
| | } |
| | } |
| |
|
| | #endif |
| |
|