ppo-SnowballTarget / com.unity.ml-agents.tests /Tests /Editor /SideChannels /EngineConfigurationChannelTests.cs
Download com.unity.ml-agents.tests/Tests/Editor/SideChannels/EngineConfigurationChannelTests.cs from ashish2244/ppo-SnowballTarget: direct link, hf CLI and curl.
- Browser
- Download file 1.11 kB
-
https://huggingface.co/ashish2244/ppo-SnowballTarget/resolve/main/com.unity.ml-agents.tests/Tests/Editor/SideChannels/EngineConfigurationChannelTests.cs
- Command line
-
hf download hf://ashish2244/ppo-SnowballTarget/com.unity.ml-agents.tests/Tests/Editor/SideChannels/EngineConfigurationChannelTests.cs
-
curl -L -o EngineConfigurationChannelTests.cs https://huggingface.co/ashish2244/ppo-SnowballTarget/resolve/main/com.unity.ml-agents.tests/Tests/Editor/SideChannels/EngineConfigurationChannelTests.cs
1.11 kB
| using NUnit.Framework; | |
| using Unity.MLAgents.SideChannels; | |
| using UnityEngine; | |
| namespace Unity.MLAgents.Tests | |
| { | |
| public class EngineConfigurationChannelTests | |
| { | |
| float m_OldTimeScale = 1.0f; | |
| [] | |
| public void Setup() | |
| { | |
| m_OldTimeScale = Time.timeScale; | |
| } | |
| [] | |
| public void TearDown() | |
| { | |
| Time.timeScale = m_OldTimeScale; | |
| } | |
| [] | |
| public void TestTimeScaleClamping() | |
| { | |
| OutgoingMessage pythonMsg = new OutgoingMessage(); | |
| pythonMsg.WriteInt32((int)EngineConfigurationChannel.ConfigurationType.TimeScale); | |
| pythonMsg.WriteFloat32(1000f); | |
| var sideChannel = new EngineConfigurationChannel(); | |
| sideChannel.ProcessMessage(pythonMsg.ToByteArray()); | |
| // Should be clamped | |
| Assert.AreEqual(100.0f, Time.timeScale); | |
| // Not sure we can run this test from a player, but just in case, shouldn't clamp. | |
| Assert.AreEqual(1000.0f, Time.timeScale); | |
| } | |
| } | |
| } | |