Skip to content

Commit a0d7f6a

Browse files
authored
🌍 #131 Update to prerelease package (#134)
1 parent 2f7e29b commit a0d7f6a

File tree

12 files changed

+81
-29
lines changed

12 files changed

+81
-29
lines changed

.vscode/launch.json

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
// Use IntelliSense to find out which attributes exist for C# debugging
6+
// Use hover for the description of the existing attributes
7+
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
8+
"name": ".NET Core Launch (console)",
9+
"type": "coreclr",
10+
"request": "launch",
11+
"preLaunchTask": "build",
12+
// If you have changed target frameworks, make sure to update the program path.
13+
"program": "${workspaceFolder}/src/GalaxyCheck.Sandbox/bin/Debug/net5.0/GalaxyCheck.Sandbox.dll",
14+
"args": [],
15+
"cwd": "${workspaceFolder}/src/GalaxyCheck.Sandbox",
16+
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
17+
"console": "internalConsole",
18+
"stopAtEntry": false
19+
},
20+
{
21+
"name": ".NET Core Attach",
22+
"type": "coreclr",
23+
"request": "attach",
24+
"processId": "${command:pickProcess}"
25+
}
26+
]
27+
}

.vscode/tasks.json

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"label": "build",
6+
"command": "dotnet",
7+
"type": "process",
8+
"args": [
9+
"build",
10+
"${workspaceFolder}/GalaxyCheck.sln",
11+
"/property:GenerateFullPaths=true",
12+
"/consoleloggerparameters:NoSummary"
13+
],
14+
"problemMatcher": "$msCompile",
15+
"group": {
16+
"kind": "build",
17+
"isDefault": true
18+
}
19+
},
20+
{
21+
"label": "clean",
22+
"command": "dotnet",
23+
"type": "process",
24+
"args": [
25+
"clean",
26+
"${workspaceFolder}/GalaxyCheck.sln",
27+
"/property:GenerateFullPaths=true",
28+
"/consoleloggerparameters:NoSummary"
29+
],
30+
"problemMatcher": "$msCompile"
31+
}
32+
]
33+
}

tests/GalaxyCheck.Tests.V2/DomainGen.cs

+3-12
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,6 @@ namespace Tests.V2
77
{
88
public static class DomainGen
99
{
10-
public static NebulaCheck.IGen<T> Element<T>(params T[] elements)
11-
{
12-
if (elements.Any() == false)
13-
{
14-
return NebulaCheck.Gen.Advanced.Error<T>("DomainGen.Element", "Input gens was empty");
15-
}
16-
17-
return NebulaCheck.Gen.Int32()
18-
.Between(0, elements.Length - 1)
19-
.Select(i => elements[i]);
20-
}
21-
2210
public static NebulaCheck.IGen<int> Seed() => NebulaCheck.Gen.Int32().WithBias(NebulaCheck.Gen.Bias.None).NoShrink();
2311

2412
public static NebulaCheck.IGen<int> Size(bool allowChaos = true) => allowChaos
@@ -33,6 +21,9 @@ public static NebulaCheck.IGen<int> Size(bool allowChaos = true) => allowChaos
3321
NebulaCheck.Gen.Constant(GalaxyCheck.Gen.Int32().Between(0, 1).WithBias(GalaxyCheck.Gen.Bias.None))
3422
).Select(gen => gen.Cast<object>());
3523

24+
public static NebulaCheck.IGen<GalaxyCheck.Gen.Bias> Bias() =>
25+
NebulaCheck.Gen.Element(new[] { GalaxyCheck.Gen.Bias.None, GalaxyCheck.Gen.Bias.WithSize });
26+
3627
public static NebulaCheck.IGen<(T, T)> Two<T>(this NebulaCheck.IGen<T> gen) => NebulaCheck.Gen.Zip(gen, gen);
3728

3829
public static NebulaCheck.IGen<(T, T, T)> Three<T>(this NebulaCheck.IGen<T> gen) => NebulaCheck.Gen.Zip(gen, gen, gen);

tests/GalaxyCheck.Tests.V2/ExampleSpaceTests/AboutInt32ExampleSpace.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public Fixture()
7171
Scenarios = JsonSerializer.Deserialize<List<Int32ExampleSpaceScenario>>(json)!;
7272
}
7373

74-
private static string GetTestDirectory([CallerFilePath] string path = null) => Path.GetDirectoryName(path)!;
74+
private static string GetTestDirectory([CallerFilePath] string path = null!) => Path.GetDirectoryName(path)!;
7575
}
7676
}
7777
}

tests/GalaxyCheck.Tests.V2/GalaxyCheck.Tests.V2.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
<PackageReference Include="FluentAssertions" Version="5.10.3" />
1313
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" />
1414
<PackageReference Include="Moq" Version="4.16.1" />
15-
<PackageReference Include="NebulaCheck" Version="0.0.0-686216764" />
16-
<PackageReference Include="NebulaCheck.Xunit" Version="0.0.0-686216764" />
15+
<PackageReference Include="NebulaCheck" Version="0.0.0-688872337" />
16+
<PackageReference Include="NebulaCheck.Xunit" Version="0.0.0-688872337" />
1717
<PackageReference Include="Snapshooter.Xunit" Version="0.5.8" />
1818
<PackageReference Include="xunit" Version="2.4.1" />
1919
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">

tests/GalaxyCheck.Tests.V2/GenTests/CharGenTests/AboutShrinking.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using GalaxyCheck;
33
using NebulaCheck;
44
using System.Linq;
5+
using Gen = NebulaCheck.Gen;
56
using Property = NebulaCheck.Property;
67
using Test = NebulaCheck.Test;
78

@@ -121,8 +122,8 @@ private static class TestGen
121122

122123
var candidateCharTypes = allCharTypes.Except(excludedCharType);
123124

124-
return DomainGen
125-
.Element(candidateCharTypes.ToArray())
125+
return Gen
126+
.Element(candidateCharTypes)
126127
.ListOf()
127128
.WithCountGreaterThan(0)
128129
.Select(xs => xs.Aggregate((GalaxyCheck.Gen.CharType)0, (acc, curr) => acc | curr));

tests/GalaxyCheck.Tests.V2/GenTests/FunctionGenTests/AboutShrinking.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public class AboutShrinking
1313
[Property]
1414
public NebulaCheck.IGen<Test> IfTheImageContainsTheTargetReturnValue_ItShrinksToTheFunctionWhereTheImageIsTheTargetReturnValue() =>
1515
from returnValues in Gen.Int32().ListOf().OfCount(10)
16-
from targetReturnValue in DomainGen.Element(returnValues.ToArray())
16+
from targetReturnValue in Gen.Element(returnValues.AsEnumerable())
1717
from seed in DomainGen.Seed()
1818
from size in DomainGen.Size()
1919
select Property.ForThese(() =>

tests/GalaxyCheck.Tests.V2/GenTests/Int32GenTests/AboutShrinking.cs

+5-5
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public class AboutShrinking
1212
{
1313
[Property]
1414
public NebulaCheck.IGen<Test> ItShrinksToTheOrigin() =>
15-
from bias in DomainGen.Element(GalaxyCheck.Gen.Bias.None, GalaxyCheck.Gen.Bias.WithSize)
15+
from bias in DomainGen.Bias()
1616
from origin in Gen.Int32()
1717
from seed in DomainGen.Seed()
1818
select Property.ForThese(() =>
@@ -26,7 +26,7 @@ select Property.ForThese(() =>
2626

2727
[Property]
2828
public NebulaCheck.IGen<Test> ItShrinksToTheLocalMinimum_ForAPositiveRange() =>
29-
from bias in DomainGen.Element(GalaxyCheck.Gen.Bias.None, GalaxyCheck.Gen.Bias.WithSize)
29+
from bias in DomainGen.Bias()
3030
from origin in Gen.Int32().Between(0, 100)
3131
from localMin in Gen.Int32().Between(origin, 200)
3232
from seed in DomainGen.Seed()
@@ -41,7 +41,7 @@ select Property.ForThese(() =>
4141

4242
[Property]
4343
public NebulaCheck.IGen<Test> ItShrinksToTheLocalMinimum_ForANegativeRange() =>
44-
from bias in DomainGen.Element(GalaxyCheck.Gen.Bias.None, GalaxyCheck.Gen.Bias.WithSize)
44+
from bias in DomainGen.Bias()
4545
from origin in Gen.Int32().Between(0, -100)
4646
from localMin in Gen.Int32().Between(origin, -200)
4747
from seed in DomainGen.Seed()
@@ -56,7 +56,7 @@ select Property.ForThese(() =>
5656

5757
[Property]
5858
public NebulaCheck.IGen<Test> ItShrinksAnyScenarioWithin64Attempts_ForAPositiveRange() =>
59-
from bias in DomainGen.Element(GalaxyCheck.Gen.Bias.None, GalaxyCheck.Gen.Bias.WithSize).NoShrink()
59+
from bias in DomainGen.Bias().NoShrink()
6060
from localMin in Gen.Int32().Between(0, int.MaxValue / 2).NoShrink()
6161
from seed in DomainGen.Seed()
6262
select Property.ForThese(() =>
@@ -73,7 +73,7 @@ select Property.ForThese(() =>
7373

7474
[Property]
7575
public NebulaCheck.IGen<Test> ItShrinksAnyScenarioWithin64Attempts_ForANegativeRange() =>
76-
from bias in DomainGen.Element(GalaxyCheck.Gen.Bias.None, GalaxyCheck.Gen.Bias.WithSize).NoShrink()
76+
from bias in DomainGen.Bias().NoShrink()
7777
from localMin in Gen.Int32().Between(0, int.MinValue / 2).NoShrink()
7878
from seed in DomainGen.Seed()
7979
select Property.ForThese(() =>

tests/GalaxyCheck.Tests.V2/GenTests/ListGenTests/AboutShrinking.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public class AboutShrinking
1212
{
1313
[Property]
1414
public NebulaCheck.IGen<Test> ItShrinksTheCountToTheMinimumCountWhilstShrinkingTheElementsToTheirMinimums() =>
15-
from bias in DomainGen.Element(GalaxyCheck.Gen.Bias.None, GalaxyCheck.Gen.Bias.WithSize)
15+
from bias in DomainGen.Bias()
1616
from elementGen in DomainGen.Gen()
1717
from minCount in Gen.Int32().Between(0, 20)
1818
from seed in DomainGen.Seed()
@@ -30,7 +30,7 @@ select Property.ForThese(() =>
3030

3131
[Property]
3232
public NebulaCheck.IGen<Test> ItShrinksTheCountToTheLocalMinimumCount() =>
33-
from bias in DomainGen.Element(GalaxyCheck.Gen.Bias.None, GalaxyCheck.Gen.Bias.WithSize)
33+
from bias in DomainGen.Bias()
3434
from elementGen in DomainGen.Gen()
3535
from localMinCount in Gen.Int32().Between(0, 5)
3636
from seed in DomainGen.Seed()
@@ -45,7 +45,7 @@ select Property.ForThese(() =>
4545

4646
[Property]
4747
public NebulaCheck.IGen<Test> ItShrinksToTheSinglePredicatedElement() =>
48-
from bias in DomainGen.Element(GalaxyCheck.Gen.Bias.None, GalaxyCheck.Gen.Bias.WithSize)
48+
from bias in DomainGen.Bias()
4949
from elementMinimum in Gen.Int32().Between(0, 100)
5050
from seed in DomainGen.Seed()
5151
select Property.ForThese(() =>

tests/GalaxyCheck.Tests.V2/GenTests/StringGenTests/AboutValueProduction.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ List<string> SampleTraversal(GalaxyCheck.IGen<string> gen) =>
6565
[Property]
6666
public NebulaCheck.IGen<Test> IfTheStringLengthIsRanged_ItProducesValuesLikeListOfCharConstrainedInTheSameWay() =>
6767
from lengths in Gen.Int32().Between(0, 20).Two()
68-
from lengthBias in DomainGen.Element(GalaxyCheck.Gen.Bias.None, GalaxyCheck.Gen.Bias.WithSize)
68+
from lengthBias in DomainGen.Bias()
6969
from seed in DomainGen.Seed()
7070
from size in DomainGen.Size()
7171
select Property.ForThese(() =>
@@ -137,8 +137,8 @@ private static class TestGen
137137
GalaxyCheck.Gen.CharType.Control
138138
};
139139

140-
return DomainGen
141-
.Element(allCharTypes.ToArray())
140+
return Gen
141+
.Element(allCharTypes)
142142
.ListOf()
143143
.WithCountGreaterThan(0)
144144
.Select(xs => xs.Aggregate((GalaxyCheck.Gen.CharType)0, (acc, curr) => acc | curr));

0 commit comments

Comments
 (0)