Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// <auto-generated/>
// <auto-generated/>
#pragma warning disable

// <auto-generated/>
Expand Down Expand Up @@ -265,7 +265,7 @@ internal sealed class ConstantArgumentsTests_Double_TestSource_GUID : global::TU
],
DataSources = new global::TUnit.Core.IDataSourceAttribute[]
{
new global::TUnit.Core.ArgumentsAttribute(1.23),
new global::TUnit.Core.ArgumentsAttribute(1.23d),
},
ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[]
{
Expand Down Expand Up @@ -386,7 +386,7 @@ internal sealed class ConstantArgumentsTests_Float_TestSource_GUID : global::TUn
],
DataSources = new global::TUnit.Core.IDataSourceAttribute[]
{
new global::TUnit.Core.ArgumentsAttribute(1.23),
new global::TUnit.Core.ArgumentsAttribute(1.23f),
},
ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[]
{
Expand Down Expand Up @@ -507,7 +507,7 @@ internal sealed class ConstantArgumentsTests_Long_TestSource_GUID : global::TUni
],
DataSources = new global::TUnit.Core.IDataSourceAttribute[]
{
new global::TUnit.Core.ArgumentsAttribute(123),
new global::TUnit.Core.ArgumentsAttribute(123L),
},
ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[]
{
Expand Down Expand Up @@ -628,7 +628,7 @@ internal sealed class ConstantArgumentsTests_UInt_TestSource_GUID : global::TUni
],
DataSources = new global::TUnit.Core.IDataSourceAttribute[]
{
new global::TUnit.Core.ArgumentsAttribute(123),
new global::TUnit.Core.ArgumentsAttribute(123U),
},
ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[]
{
Expand Down Expand Up @@ -749,7 +749,7 @@ internal sealed class ConstantArgumentsTests_ULong_TestSource_GUID : global::TUn
],
DataSources = new global::TUnit.Core.IDataSourceAttribute[]
{
new global::TUnit.Core.ArgumentsAttribute(123),
new global::TUnit.Core.ArgumentsAttribute(123UL),
},
ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[]
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// <auto-generated/>
// <auto-generated/>
#pragma warning disable

// <auto-generated/>
Expand Down Expand Up @@ -146,7 +146,7 @@ internal sealed class NumberArgumentTests_Double_TestSource_GUID : global::TUnit
],
DataSources = new global::TUnit.Core.IDataSourceAttribute[]
{
new global::TUnit.Core.ArgumentsAttribute(1.1),
new global::TUnit.Core.ArgumentsAttribute(1.1d),
},
ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[]
{
Expand Down Expand Up @@ -269,7 +269,7 @@ internal sealed class NumberArgumentTests_Float_TestSource_GUID : global::TUnit.
],
DataSources = new global::TUnit.Core.IDataSourceAttribute[]
{
new global::TUnit.Core.ArgumentsAttribute(1.1),
new global::TUnit.Core.ArgumentsAttribute(1.1f),
},
ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[]
{
Expand Down Expand Up @@ -392,7 +392,7 @@ internal sealed class NumberArgumentTests_Long_TestSource_GUID : global::TUnit.C
],
DataSources = new global::TUnit.Core.IDataSourceAttribute[]
{
new global::TUnit.Core.ArgumentsAttribute(1),
new global::TUnit.Core.ArgumentsAttribute(1L),
},
ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[]
{
Expand Down Expand Up @@ -515,7 +515,7 @@ internal sealed class NumberArgumentTests_ULong_TestSource_GUID : global::TUnit.
],
DataSources = new global::TUnit.Core.IDataSourceAttribute[]
{
new global::TUnit.Core.ArgumentsAttribute(1),
new global::TUnit.Core.ArgumentsAttribute(1UL),
},
ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[]
{
Expand Down Expand Up @@ -638,7 +638,7 @@ internal sealed class NumberArgumentTests_UInt_TestSource_GUID : global::TUnit.C
],
DataSources = new global::TUnit.Core.IDataSourceAttribute[]
{
new global::TUnit.Core.ArgumentsAttribute(1),
new global::TUnit.Core.ArgumentsAttribute(1U),
},
ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[]
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// <auto-generated/>
// <auto-generated/>
#pragma warning disable

// <auto-generated/>
Expand Down Expand Up @@ -146,7 +146,7 @@ internal sealed class NumberArgumentTests_Double_TestSource_GUID : global::TUnit
],
DataSources = new global::TUnit.Core.IDataSourceAttribute[]
{
new global::TUnit.Core.ArgumentsAttribute(1,1),
new global::TUnit.Core.ArgumentsAttribute(1.1d),
},
ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[]
{
Expand Down Expand Up @@ -269,7 +269,7 @@ internal sealed class NumberArgumentTests_Float_TestSource_GUID : global::TUnit.
],
DataSources = new global::TUnit.Core.IDataSourceAttribute[]
{
new global::TUnit.Core.ArgumentsAttribute(1,1),
new global::TUnit.Core.ArgumentsAttribute(1.1f),
},
ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[]
{
Expand Down Expand Up @@ -392,7 +392,7 @@ internal sealed class NumberArgumentTests_Long_TestSource_GUID : global::TUnit.C
],
DataSources = new global::TUnit.Core.IDataSourceAttribute[]
{
new global::TUnit.Core.ArgumentsAttribute(1),
new global::TUnit.Core.ArgumentsAttribute(1L),
},
ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[]
{
Expand Down Expand Up @@ -515,7 +515,7 @@ internal sealed class NumberArgumentTests_ULong_TestSource_GUID : global::TUnit.
],
DataSources = new global::TUnit.Core.IDataSourceAttribute[]
{
new global::TUnit.Core.ArgumentsAttribute(1),
new global::TUnit.Core.ArgumentsAttribute(1UL),
},
ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[]
{
Expand Down Expand Up @@ -638,7 +638,7 @@ internal sealed class NumberArgumentTests_UInt_TestSource_GUID : global::TUnit.C
],
DataSources = new global::TUnit.Core.IDataSourceAttribute[]
{
new global::TUnit.Core.ArgumentsAttribute(1),
new global::TUnit.Core.ArgumentsAttribute(1U),
},
ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[]
{
Expand Down
4 changes: 2 additions & 2 deletions TUnit.Core.SourceGenerator.Tests/Tests2083.Test.verified.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// <auto-generated/>
// <auto-generated/>
#pragma warning disable

// <auto-generated/>
Expand Down Expand Up @@ -33,7 +33,7 @@ internal sealed class Tests_MyTest_TestSource_GUID : global::TUnit.Core.Interfac
new global::TUnit.Core.ArgumentsAttribute(32767),
new global::TUnit.Core.ArgumentsAttribute('\uffff'),
new global::TUnit.Core.ArgumentsAttribute(2147483647),
new global::TUnit.Core.ArgumentsAttribute(9223372036854775807),
new global::TUnit.Core.ArgumentsAttribute(9223372036854775807L),
},
ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[]
{
Expand Down
6 changes: 3 additions & 3 deletions TUnit.Core.SourceGenerator.Tests/Tests2112.Test.verified.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// <auto-generated/>
// <auto-generated/>
#pragma warning disable

// <auto-generated/>
Expand All @@ -24,7 +24,7 @@ internal sealed class Tests_Test_TestSource_GUID : global::TUnit.Core.Interfaces
],
DataSources = new global::TUnit.Core.IDataSourceAttribute[]
{
new global::TUnit.Core.ArgumentsAttribute(0, 1),
new global::TUnit.Core.ArgumentsAttribute(0, 1L),
new global::TUnit.Core.ArgumentsAttribute(0, 1),
},
ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[]
Expand Down Expand Up @@ -192,7 +192,7 @@ internal sealed class Tests_Test2_TestSource_GUID : global::TUnit.Core.Interface
],
DataSources = new global::TUnit.Core.IDataSourceAttribute[]
{
new global::TUnit.Core.ArgumentsAttribute(0, 1, 2, 3),
new global::TUnit.Core.ArgumentsAttribute(0, 1L, 2L, 3L),
new global::TUnit.Core.ArgumentsAttribute(0, 1, 2, 3),
},
ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[]
Expand Down
4 changes: 2 additions & 2 deletions TUnit.Core.SourceGenerator.Tests/Tests2136.Test.verified.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// <auto-generated/>
// <auto-generated/>
#pragma warning disable

// <auto-generated/>
Expand Down Expand Up @@ -313,7 +313,7 @@ internal sealed class Tests_GenericArgumentsTest_TestSource_GUID : global::TUnit
],
DataSources = new global::TUnit.Core.IDataSourceAttribute[]
{
new global::TUnit.Core.ArgumentsAttribute(1.1, "1.1"),
new global::TUnit.Core.ArgumentsAttribute(1.1d, "1.1"),
},
ClassDataSources = new global::TUnit.Core.IDataSourceAttribute[]
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,25 @@ private static string FormatPrimitive(object? value)
return "double.NegativeInfinity";
case null:
return "null";
// Use InvariantCulture for numeric types to ensure consistent formatting
case double d:
return d.ToString(System.Globalization.CultureInfo.InvariantCulture) + "d";
case float f:
return f.ToString(System.Globalization.CultureInfo.InvariantCulture) + "f";
case decimal dec:
return dec.ToString(System.Globalization.CultureInfo.InvariantCulture) + "m";
case long l:
return l.ToString(System.Globalization.CultureInfo.InvariantCulture) + "L";
case ulong ul:
return ul.ToString(System.Globalization.CultureInfo.InvariantCulture) + "UL";
case uint ui:
return ui.ToString(System.Globalization.CultureInfo.InvariantCulture) + "U";
default:
// For other numeric types, use InvariantCulture
if (value is IFormattable formattable)
{
return formattable.ToString(null, System.Globalization.CultureInfo.InvariantCulture);
}
return value.ToString() ?? "null";
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,19 @@ public static string FormatPrimitive(object? value)
return "double.NegativeInfinity";
case null:
return "null";
// Use InvariantCulture for numeric types to ensure consistent formatting
case double d:
return d.ToString(System.Globalization.CultureInfo.InvariantCulture) + "d";
case float f:
return f.ToString(System.Globalization.CultureInfo.InvariantCulture) + "f";
case decimal dec:
return dec.ToString(System.Globalization.CultureInfo.InvariantCulture) + "m";
default:
// For other numeric types, use InvariantCulture
if (value is IFormattable formattable)
{
return formattable.ToString(null, System.Globalization.CultureInfo.InvariantCulture);
}
return value.ToString() ?? "null";
}
}
Expand Down
4 changes: 4 additions & 0 deletions TUnit.Core/Services/TestNameFormatter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ public string FormatArgumentValue(object? value)
string str => $"\"{str}\"",
char ch => $"'{ch}'",
bool b => b.ToString().ToLowerInvariant(),
// Use InvariantCulture for numeric types to avoid culture-specific formatting issues
double d => d.ToString(System.Globalization.CultureInfo.InvariantCulture),
float f => f.ToString(System.Globalization.CultureInfo.InvariantCulture),
decimal dec => dec.ToString(System.Globalization.CultureInfo.InvariantCulture),
IEnumerable enumerable when value.GetType() != typeof(string) => FormatEnumerable(enumerable),
_ => value.ToString() ?? "null"
};
Expand Down
18 changes: 18 additions & 0 deletions TUnit.TestProject/FloatingPointDebugTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using TUnit.Core;
using TUnit.TestProject.Attributes;

namespace TUnit.TestProject;

[EngineTest(ExpectedResult.Pass)]
public class FloatingPointDebugTests
{
[Test]
[Arguments(4)]
[Arguments(0.1)]
[Arguments(1.1)]
[Arguments(1e-1)]
public void ParameterTest(double number)
{
// This should work without throwing "Expected exactly 1 argument, but got 2"
}
}