Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.
This repository was archived by the owner on Jan 12, 2024. It is now read-only.

ToString tests fail when current locale uses comma as decimal point #160

@bamarsha

Description

@bamarsha

Describe the bug

When the computer's current locale uses a comma for the decimal point, the "ToStringTests" in the "DebuggingToolsTests" fail because they call ToString on a tuple containing a double, which formats the double using a comma. However, the expected test output is hard-coded to expect a period. The test fails, for example, in the German (de-DE) locale.

To Reproduce

  1. Change your computer's locale to one that uses commas as decimal points
  2. Run the DebuggingToolsTests.ToStringTests test

Expected behavior

The tests should pass regardless of the current locale.

Actual behavior

Testname:	Microsoft.Quantum.Simulation.Simulators.Tests.DebuggingToolsTests.ToStringTests
FullName für Test:	Tests.Microsoft.Quantum.Simulation.Simulators.Microsoft.Quantum.Simulation.Simulators.Tests.DebuggingToolsTests.Microsoft.Quantum.Simulation.Simulators.Tests.DebuggingToolsTests.ToStringTests
Testquelle:	C:\Users\samarsha\Source\Repos\microsoft\qsharp-runtime\src\Simulation\Simulators.Tests\DebuggingToolsTests.cs : Zeile 23
Testergebnis:	Fehler
Testdauer:	0:00:00

Testname:	Microsoft.Quantum.Simulation.Simulators.Tests.DebuggingToolsTests.ToStringTests
Testergebnis:	Fehler
Ergebnis StackTrace:	
at Microsoft.Quantum.Simulation.Simulators.Tests.DebuggingToolsTests.<>c.<ToStringTests>b__0_0(SimulatorBase qsim) in C:\Users\samarsha\Source\Repos\microsoft\qsharp-runtime\src\Simulation\Simulators.Tests\DebuggingToolsTests.cs:line 57
   at Microsoft.Quantum.Simulation.Simulators.Tests.OperationsTestHelper.RunWithMultipleSimulators(Action`1 test) in C:\Users\samarsha\Source\Repos\microsoft\qsharp-runtime\src\Simulation\Simulators.Tests\OperationsTestHelper.cs:line 151
   at Microsoft.Quantum.Simulation.Simulators.Tests.DebuggingToolsTests.ToStringTests() in C:\Users\samarsha\Source\Repos\microsoft\qsharp-runtime\src\Simulation\Simulators.Tests\DebuggingToolsTests.cs:line 25
Ergebnis Meldung:	
Assert.Equal() Failure
                   ↓ (pos 9)
Expected: T4((3, (1.1, False, One)))
Actual:   T4((3, (1,1, False, One)))
                   ↑ (pos 9)

System information

  • OS: Windows 10

  • .NET Core Version: 3.1.101

  • IQ# Version: N/A

  • Python Version (if applicable): 3.8.2

Additional context

The Q# compiler has a similar bug in its tests: microsoft/qsharp-compiler#363

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinggood first issueGood for newcomers

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions