diff --git a/src/Microsoft.Health.Fhir.Liquid.Converter.UnitTests/Filters/FiltersRenderingTests.cs b/src/Microsoft.Health.Fhir.Liquid.Converter.UnitTests/Filters/FiltersRenderingTests.cs index 8ea98e759..25161ccfa 100644 --- a/src/Microsoft.Health.Fhir.Liquid.Converter.UnitTests/Filters/FiltersRenderingTests.cs +++ b/src/Microsoft.Health.Fhir.Liquid.Converter.UnitTests/Filters/FiltersRenderingTests.cs @@ -16,7 +16,7 @@ public class FiltersRenderingTests {{ 'foo' | contains: 'fo' }} {{ '\E' | escape_special_chars }} {{ '\\E' | unescape_special_chars }} -{{ true | is_nan }} +{{ 1 | is_nan }} {{ -2019.6 | abs }} {{ 3 | pow: 3 }} {{ -5 | sign }} @@ -28,7 +28,7 @@ public class FiltersRenderingTests true \\E \E -true +false 2019.6 27 -1 diff --git a/src/Microsoft.Health.Fhir.Liquid.Converter.UnitTests/Filters/MathFiltersTests.cs b/src/Microsoft.Health.Fhir.Liquid.Converter.UnitTests/Filters/MathFiltersTests.cs index dc8abef12..c09ef4199 100644 --- a/src/Microsoft.Health.Fhir.Liquid.Converter.UnitTests/Filters/MathFiltersTests.cs +++ b/src/Microsoft.Health.Fhir.Liquid.Converter.UnitTests/Filters/MathFiltersTests.cs @@ -13,10 +13,10 @@ public class MathFiltersTests [Fact] public void IsNaNTest() { - Assert.True(Filters.IsNaN("2019.6")); - Assert.False(Filters.IsNaN(true)); - Assert.False(Filters.IsNaN(string.Empty)); - Assert.False(Filters.IsNaN(new Hl7v2Data())); + Assert.False(Filters.IsNan("2019.6")); + Assert.True(Filters.IsNan(true)); + Assert.True(Filters.IsNan(string.Empty)); + Assert.True(Filters.IsNan(new Hl7v2Data())); } [Fact] diff --git a/src/Microsoft.Health.Fhir.Liquid.Converter/Filters/MathFilters.cs b/src/Microsoft.Health.Fhir.Liquid.Converter/Filters/MathFilters.cs index 21156d479..b3b474f02 100644 --- a/src/Microsoft.Health.Fhir.Liquid.Converter/Filters/MathFilters.cs +++ b/src/Microsoft.Health.Fhir.Liquid.Converter/Filters/MathFilters.cs @@ -15,9 +15,9 @@ public partial class Filters { private static readonly Random RandomGenerator = new Random(); - public static bool IsNaN(object data) + public static bool IsNan(object data) { - return double.TryParse(Convert.ToString(data, CultureInfo.InvariantCulture), NumberStyles.Any, NumberFormatInfo.InvariantInfo, out _); + return !double.TryParse(Convert.ToString(data, CultureInfo.InvariantCulture), NumberStyles.Any, NumberFormatInfo.InvariantInfo, out _); } public static double Abs(double data)