Skip to content

Commit 1b54cc5

Browse files
committed
ci,tests,core: apply stashed updates
- CI: update .github/workflows/build-and-test.yml - tests: adjust RandomUtility_Nullable_Tests - core: refine RandomUtility.Nullable and RandomUtility.Tuple
1 parent e201bbf commit 1b54cc5

File tree

4 files changed

+36
-4
lines changed

4 files changed

+36
-4
lines changed

.github/workflows/build-and-test.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ on:
44
pull_request:
55
push:
66
branches:
7-
- dev
7+
- main
8+
89
workflow_dispatch:
910

1011
env:

src/JSSoft.Randora/RandomUtility.Nullable.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
// Licensed under the MIT License. See LICENSE.md in the project root for license information.
44
// </copyright>
55

6-
#pragma warning disable MEN002 // Line is too long
7-
86
namespace JSSoft.Randora;
97

108
public static partial class RandomUtility

src/JSSoft.Randora/RandomUtility.Tuple.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// Licensed under the MIT License. See LICENSE.md in the project root for license information.
44
// </copyright>
55

6-
#pragma warning disable MEN002 // Line is too long
76
#pragma warning disable SA1414 // Tuple types in signatures should have element names
87
namespace JSSoft.Randora;
98

test/JSSoft.Randora.Tests/RandomUtility_Nullable_Tests.cs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -988,4 +988,38 @@ public void NullableValueTuple_Ints_WithRandom_Basic()
988988
Assert.IsType<DateTime>(t8.Value.Rest.Item1);
989989
}
990990
}
991+
992+
// Generic helpers ----------------------------------------------------
993+
994+
[Fact]
995+
public void Nullable_Int_WithRandom_ShouldContainNullAndValue()
996+
{
997+
var r = NewSeeded();
998+
const int iterations = 128; // 66% 값 생성 확률을 고려한 충분한 반복
999+
var results = new List<int?>(capacity: iterations);
1000+
1001+
for (int i = 0; i < iterations; i++)
1002+
{
1003+
results.Add(R.Nullable(r, R.Int32));
1004+
}
1005+
1006+
Assert.Contains(results, v => v.HasValue);
1007+
Assert.Contains(results, v => v is null);
1008+
}
1009+
1010+
[Fact]
1011+
public void NullableObject_String_WithRandom_ShouldContainNullAndValue()
1012+
{
1013+
var r = NewSeeded();
1014+
const int iterations = 128;
1015+
var results = new List<string?>(capacity: iterations);
1016+
1017+
for (int i = 0; i < iterations; i++)
1018+
{
1019+
results.Add(R.NullableObject(r, R.String));
1020+
}
1021+
1022+
Assert.Contains(results, v => v is not null);
1023+
Assert.Contains(results, v => v is null);
1024+
}
9911025
}

0 commit comments

Comments
 (0)