From 161ed2229935028c36e43373d49946ae76e31f22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A1lint=20Hodossy?= Date: Mon, 27 May 2024 11:29:04 +0100 Subject: [PATCH] Fix Unity tests for sensornoise attribute --- unity/Runtime/Components/MjGlobalSettings.cs | 4 ++-- unity/Tests/Editor/Components/MjGlobalSettingsTests.cs | 1 - unity/Tests/Editor/Components/Sensors/MjBaseSensorTests.cs | 5 +---- unity/Tests/Editor/Importer/MjcfImporterTests.cs | 3 +-- 4 files changed, 4 insertions(+), 9 deletions(-) diff --git a/unity/Runtime/Components/MjGlobalSettings.cs b/unity/Runtime/Components/MjGlobalSettings.cs index cd1bbe40..51a245c5 100644 --- a/unity/Runtime/Components/MjGlobalSettings.cs +++ b/unity/Runtime/Components/MjGlobalSettings.cs @@ -335,8 +335,8 @@ public class MjGlobalSettings : MonoBehaviour { } else if (instances.Length == 1) { _instance = instances[0]; } - } - return _instance; + } + return _instance; } } diff --git a/unity/Tests/Editor/Components/MjGlobalSettingsTests.cs b/unity/Tests/Editor/Components/MjGlobalSettingsTests.cs index 6575bbf1..4069f45b 100644 --- a/unity/Tests/Editor/Components/MjGlobalSettingsTests.cs +++ b/unity/Tests/Editor/Components/MjGlobalSettingsTests.cs @@ -101,7 +101,6 @@ public class MjGlobalSettingsGenerationTests { Assert.That(_doc.OuterXml, Does.Contain(@"override=")); Assert.That(_doc.OuterXml, Does.Contain(@"energy=")); Assert.That(_doc.OuterXml, Does.Contain(@"fwdinv=")); - Assert.That(_doc.OuterXml, Does.Contain(@"sensornoise=")); } } diff --git a/unity/Tests/Editor/Components/Sensors/MjBaseSensorTests.cs b/unity/Tests/Editor/Components/Sensors/MjBaseSensorTests.cs index 8a15152f..c1448167 100644 --- a/unity/Tests/Editor/Components/Sensors/MjBaseSensorTests.cs +++ b/unity/Tests/Editor/Components/Sensors/MjBaseSensorTests.cs @@ -53,19 +53,16 @@ public class MjBaseSensorTests { [Test] public void GeneratingNoiseAndCutoffMjcf() { - _sensor.Noise = 2.0f; _sensor.Cutoff = 3.0f; _doc.AppendChild(_sensor.GenerateMjcf("name", _doc)); - Assert.That(_doc.OuterXml, Does.Contain("noise=\"2\"")); Assert.That(_doc.OuterXml, Does.Contain("cutoff=\"3\"")); } [Test] public void ParsingShapePropertiesMjcf() { - var mjcfString = ""; + var mjcfString = ""; var mjcfElement = Parse(mjcfString, "sensor"); _sensor.ParseMjcf(mjcfElement); - Assert.That(_sensor.Noise, Is.EqualTo(3.0f)); Assert.That(_sensor.Cutoff, Is.EqualTo(4.0f)); } } diff --git a/unity/Tests/Editor/Importer/MjcfImporterTests.cs b/unity/Tests/Editor/Importer/MjcfImporterTests.cs index a4bc5a1b..bf4e54b2 100644 --- a/unity/Tests/Editor/Importer/MjcfImporterTests.cs +++ b/unity/Tests/Editor/Importer/MjcfImporterTests.cs @@ -274,7 +274,7 @@ public class MjcfImporterTests { public void ReadingOptionFlags() { var mjcfString = @" "; @@ -283,7 +283,6 @@ public class MjcfImporterTests { var settings = _sceneRoot.GetComponentInChildren(); Assert.That(settings.GlobalOptions.Flag.Gravity, Is.EqualTo(EnableDisableFlag.disable)); Assert.That(settings.GlobalOptions.Flag.Contact, Is.EqualTo(EnableDisableFlag.disable)); - Assert.That(settings.GlobalOptions.Flag.SensorNoise, Is.EqualTo(EnableDisableFlag.enable)); } [Test]