public IEnumerator ScenarioConfigurationOverwrittenDuringDeserialization() { yield return(CreateNewScenario(10, 10)); var constants = new FixedLengthScenario.Constants { framesPerIteration = 2, totalIterations = 2 }; var changedConstants = new FixedLengthScenario.Constants { framesPerIteration = 0, totalIterations = 0 }; // Serialize some values m_Scenario.constants = constants; var serializedConfig = m_Scenario.SerializeToJson(); // Change the values m_Scenario.constants = changedConstants; m_Scenario.DeserializeFromJson(serializedConfig); // Check if the values reverted correctly Assert.AreEqual(m_Scenario.constants.framesPerIteration, constants.framesPerIteration); Assert.AreEqual(m_Scenario.constants.totalIterations, constants.totalIterations); yield return(null); }
public IEnumerator OverwritesConstantsOnSerialization() { yield return(CreateNewScenario(10, 10)); m_Scenario.serializedConstantsFileName = "perception_serialization_test"; var constants = new FixedLengthScenario.Constants { framesPerIteration = 2, totalIterations = 2 }; var changedConstants = new FixedLengthScenario.Constants { framesPerIteration = 0, totalIterations = 0 }; // Serialize some values m_Scenario.constants = constants; m_Scenario.Serialize(); // Change the values m_Scenario.constants = changedConstants; m_Scenario.Deserialize(); // Check if the values reverted correctly Assert.AreEqual(m_Scenario.constants.framesPerIteration, constants.framesPerIteration); Assert.AreEqual(m_Scenario.constants.totalIterations, constants.totalIterations); // Clean up serialized constants File.Delete(m_Scenario.serializedConstantsFilePath); yield return(null); }
public void ScenarioConfigurationOverwrittenDuringDeserialization() { m_TestObject = new GameObject(); m_Scenario = m_TestObject.AddComponent <TestFixedLengthScenario>(); var constants = new FixedLengthScenario.Constants { framesPerIteration = 2, totalIterations = 2 }; var changedConstants = new FixedLengthScenario.Constants { framesPerIteration = 0, totalIterations = 0 }; // Serialize some values m_Scenario.constants = constants; var serializedConfig = m_Scenario.SerializeToJson(); // Change the values m_Scenario.constants = changedConstants; m_Scenario.DeserializeFromJson(serializedConfig); // Check if the values reverted correctly Assert.AreEqual(m_Scenario.constants.framesPerIteration, constants.framesPerIteration); Assert.AreEqual(m_Scenario.constants.totalIterations, constants.totalIterations); }