public void MaskReset() { var actuator1 = new TestActuator(ActionSpec.MakeDiscrete(new[] { 4, 5, 6 }), "actuator1"); var masker = new ActuatorDiscreteActionMask(new IActuator[] { actuator1 }, 15, 3); masker.WriteMask(1, new[] { 1, 2, 3 }); masker.ResetMask(); var mask = masker.GetMask(); for (var i = 0; i < 15; i++) { Assert.IsFalse(mask[i]); } }
public void ThrowsError() { var actuator1 = new TestActuator(ActionSpec.MakeDiscrete(new[] { 4, 5, 6 }), "actuator1"); var masker = new ActuatorDiscreteActionMask(new IActuator[] { actuator1 }, 15, 3); Assert.Catch <UnityAgentsException>( () => masker.WriteMask(0, new[] { 5 })); Assert.Catch <UnityAgentsException>( () => masker.WriteMask(1, new[] { 5 })); masker.WriteMask(2, new[] { 5 }); Assert.Catch <UnityAgentsException>( () => masker.WriteMask(3, new[] { 1 })); masker.GetMask(); masker.ResetMask(); masker.WriteMask(0, new[] { 0, 1, 2, 3 }); Assert.Catch <UnityAgentsException>( () => masker.GetMask()); }
public void ThrowsError() { var actuator1 = new TestActuator(ActionSpec.MakeDiscrete(new[] { 4, 5, 6 }), "actuator1"); var masker = new ActuatorDiscreteActionMask(new IActuator[] { actuator1 }, 15, 3); Assert.Catch <UnityAgentsException>( () => masker.SetActionEnabled(0, 5, false)); Assert.Catch <UnityAgentsException>( () => masker.SetActionEnabled(1, 5, false)); masker.SetActionEnabled(2, 5, false); Assert.Catch <UnityAgentsException>( () => masker.SetActionEnabled(3, 1, false)); masker.GetMask(); masker.ResetMask(); masker.SetActionEnabled(0, 0, false); masker.SetActionEnabled(0, 1, false); masker.SetActionEnabled(0, 2, false); masker.SetActionEnabled(0, 3, false); Assert.Catch <UnityAgentsException>( () => masker.GetMask()); }