diff --git a/CosmosDBShell.Tests/Parser/ShellObjectConversionTests.cs b/CosmosDBShell.Tests/Parser/ShellObjectConversionTests.cs index 3aa7e91..dcf497e 100644 --- a/CosmosDBShell.Tests/Parser/ShellObjectConversionTests.cs +++ b/CosmosDBShell.Tests/Parser/ShellObjectConversionTests.cs @@ -167,10 +167,15 @@ public void ShellJson_StringToNumber(string raw, int expected) Assert.Equal(expected, Json(raw).ConvertShellObject(DataType.Number)); } - [Fact] - public void ShellJson_StringToDecimal() - { - Assert.Equal(15d, Assert.IsType(Json("\"15\"").ConvertShellObject(DataType.Decimal))); + [Theory] + [InlineData("\"15\"", 15d)] + [InlineData("\"1.5\"", 1.5d)] + [InlineData("\"1e100\"", 1e100d)] + [InlineData("1e100", 1e100d)] + [InlineData("3.0", 3d)] + public void ShellJson_ToDecimal_ReturnsDouble(string raw, double expected) + { + Assert.Equal(expected, Assert.IsType(Json(raw).ConvertShellObject(DataType.Decimal))); } [Fact] diff --git a/CosmosDBShell.Tests/Parser/StatementExecutionTests.cs b/CosmosDBShell.Tests/Parser/StatementExecutionTests.cs index d54f330..deffbbf 100644 --- a/CosmosDBShell.Tests/Parser/StatementExecutionTests.cs +++ b/CosmosDBShell.Tests/Parser/StatementExecutionTests.cs @@ -30,6 +30,14 @@ public static System.Collections.Generic.IEnumerable ValueOriginCases( ("3.5", "+", "2", "Decimal", "5.5"), ("3", "/", "2", "Number", "1"), ("3.0", "/", "2", "Decimal", "1.5"), + ("\"2\"", "*", "1.5", "Decimal", "3"), + ("1.5", "*", "\"2\"", "Decimal", "3"), + ("\"2\"", "-", "1.5", "Decimal", "0.5"), + ("\"3.5\"", "/", "2.0", "Decimal", "1.75"), + ("5.0", "%", "\"2\"", "Decimal", "1"), + ("\"2\"", "**", "3.0", "Decimal", "8"), + ("\"2\"", "<", "2.5", "Boolean", "true"), + ("2.5", ">=", "\"2\"", "Boolean", "true"), ("3.0", "-", "\"2.5\"", "Decimal", "0.5"), ("\"2.5\"", "-", "3.0", "Decimal", "-0.5"), ("3.0", "*", "\"2.5\"", "Decimal", "7.5"),