Skip to content

Commit fb4da69

Browse files
committed
Improve calculator thousands separator test
1 parent 649b142 commit fb4da69

1 file changed

Lines changed: 14 additions & 8 deletions

File tree

Flow.Launcher.Test/Plugins/CalculatorTest.cs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,20 +46,26 @@ public CalculatorPluginTest()
4646
public void ThousandsSeparatorTest_Enabled()
4747
{
4848
_settings.UseThousandsSeparator = true;
49+
4950
_settings.DecimalSeparator = DecimalSeparator.Dot;
50-
5151
var result = GetCalculationResult("1000+234");
52-
// When thousands separator is enabled, the result should contain a separator (comma in this case)
53-
ClassicAssert.IsTrue(result.Contains(",") || result == "1234",
54-
"Expected result to contain thousands separator or be without one if system doesn't use it");
52+
// When thousands separator is enabled, the result should contain a separator
53+
// Since decimal separator is dot, thousands separator should be comma
54+
ClassicAssert.AreEqual("1,234", result);
55+
56+
_settings.DecimalSeparator = DecimalSeparator.Comma;
57+
var result2 = GetCalculationResult("1000+234");
58+
// When thousands separator is enabled, the result should contain a separator
59+
// Since decimal separator is comma, thousands separator should be dot
60+
ClassicAssert.AreEqual("1.234", result2);
5561
}
5662

5763
[Test]
5864
public void ThousandsSeparatorTest_Disabled()
5965
{
6066
_settings.UseThousandsSeparator = false;
61-
_settings.DecimalSeparator = DecimalSeparator.Dot;
62-
67+
_settings.DecimalSeparator = DecimalSeparator.UseSystemLocale;
68+
6369
var result = GetCalculationResult("1000+234");
6470
ClassicAssert.AreEqual("1234", result);
6571
}
@@ -68,8 +74,8 @@ public void ThousandsSeparatorTest_Disabled()
6874
public void ThousandsSeparatorTest_LargeNumber()
6975
{
7076
_settings.UseThousandsSeparator = false;
71-
_settings.DecimalSeparator = DecimalSeparator.Dot;
72-
77+
_settings.DecimalSeparator = DecimalSeparator.UseSystemLocale;
78+
7379
var result = GetCalculationResult("1000000+234567");
7480
ClassicAssert.AreEqual("1234567", result);
7581
}

0 commit comments

Comments
 (0)