Skip to content

Commit

Permalink
Merge pull request #73 from pfpack/release/v1.4.0-rc.1
Browse files Browse the repository at this point in the history
release/v1.4.0-rc.1
  • Loading branch information
andreise authored Mar 10, 2024
2 parents e899797 + 29450e7 commit 2f7df6d
Show file tree
Hide file tree
Showing 81 changed files with 639 additions and 313 deletions.
12 changes: 6 additions & 6 deletions src/flatcollections-array/FlatArray.Tests/FlatArray.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="coverlet.collector" Version="6.0.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="PrimeFuncPack.UnitTest.Data" Version="3.1.0" />
<PackageReference Include="xunit" Version="2.6.6" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PackageReference Include="xunit" Version="2.7.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.7">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="6.0.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@ namespace PrimeFuncPack.Core.Tests;

partial class TestHelper
{
internal static void VerifyInnerState_Default<T>(this FlatArray<T> actual)
{
var actualLength = actual.GetStructFieldValue<int>("length");
Assert.StrictEqual(default, actualLength);

var actualItems = actual.GetFieldValue<T[]?>("items");
Assert.Null(actualItems);
}

internal static void VerifyInnerState<T>(this FlatArray<T> actual, T[]? expectedItems, int expectedLength)
{
var actualLength = actual.GetStructFieldValue<int>("length");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public void MoveToFlatArray_SourceIsDefault_ExpectArrayStateIsDefault()
var source = new FlatArray<string>.Builder();
var actual = source.MoveToFlatArray();

actual.VerifyInnerState(default, default);
actual.VerifyInnerState_Default();
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public void Deserialize_SourceIsNullJsonValue_ExpectDefaultState(
const string source = "null";
var actual = JsonSerializer.Deserialize<FlatArray<StubItemJson>>(source, options);

actual.VerifyInnerState(default, default);
actual.VerifyInnerState_Default();
}

[Theory]
Expand All @@ -27,7 +27,7 @@ public void Deserialize_SourceArrayIsEmpty_ExpectDefaultState(
const string source = "[]";
var actual = JsonSerializer.Deserialize<FlatArray<StubItemJson?>>(source, options);

actual.VerifyInnerState(default, default);
actual.VerifyInnerState_Default();
}

[Theory]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ partial class FlatArrayTest
public static void ConstructFromCollectionExpression_SourceIsEmpty_ExpectDefault()
{
FlatArray<string?> actual = [];
actual.VerifyInnerState(default, default);
actual.VerifyInnerState_Default();
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ partial class FlatArrayTest
public void ConstructFromReadOnlySpan_SourceIsEmpty_ExpectInnerStateIsDefault()
{
FlatArray<bool?> actual = new(default(ReadOnlySpan<bool?>));
actual.VerifyInnerState(default, default);
actual.VerifyInnerState_Default();
}

[Theory]
Expand All @@ -30,7 +30,7 @@ public void ConstructFromReadOnlySpan_SourceIsNotEmpty_ExpectInnerStateAreSource
public void ConstructFromSpan_SourceIsEmpty_ExpectInnerStateIsDefault()
{
FlatArray<RefType> actual = new(default(Span<RefType>));
actual.VerifyInnerState(default, default);
actual.VerifyInnerState_Default();
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public void ConstructFromArray_SourceIsNull_ExpectInnerStateIsDefault()
int[]? source = null;
var actual = new FlatArray<int>(source);

actual.VerifyInnerState(default, default);
actual.VerifyInnerState_Default();
}

[Fact]
Expand All @@ -23,7 +23,7 @@ public void ConstructFromArray_SourceIsEmpty_ExpectInnerStateIsDefault()
var source = Array.Empty<RefType>();
var actual = new FlatArray<RefType>(source);

actual.VerifyInnerState(default, default);
actual.VerifyInnerState_Default();
}

[Theory]
Expand Down Expand Up @@ -57,7 +57,7 @@ public void ConstructFromFlatArray_SourceIsDefault_ExpectInnerStateIsDefault()
var source = default(FlatArray<RefType>);
var actual = new FlatArray<RefType>(source);

actual.VerifyInnerState(default, default);
actual.VerifyInnerState_Default();
}

[Theory]
Expand All @@ -80,7 +80,7 @@ public void ConstructFromNullableFlatArray_SourceIsNull_ExpectInnerStateIsDefaul
var source = default(FlatArray<StructType?>?);
var actual = new FlatArray<StructType?>(source);

actual.VerifyInnerState(default, default);
actual.VerifyInnerState_Default();
}

[Fact]
Expand All @@ -89,7 +89,7 @@ public void ConstructFromNullableFlatArray_SourceIsDefault_ExpectInnerStateIsDef
FlatArray<RecordType>? source = default(FlatArray<RecordType>);
var actual = new FlatArray<RecordType>(source);

actual.VerifyInnerState(default, default);
actual.VerifyInnerState_Default();
}

[Fact]
Expand All @@ -109,7 +109,7 @@ public void ConstructFromImmutableArray_SourceIsDefault_ExpectInnerStateIsDefaul
var source = default(ImmutableArray<long?>);
var actual = new FlatArray<long?>(source);

actual.VerifyInnerState(default, default);
actual.VerifyInnerState_Default();
}

[Theory]
Expand All @@ -132,7 +132,7 @@ public void ConstructFromNullableImmutableArray_SourceIsNull_ExpectInnerStateIsD
ImmutableArray<RecordType>? source = null;
var actual = new FlatArray<RecordType>(source);

actual.VerifyInnerState(default, default);
actual.VerifyInnerState_Default();
}

[Fact]
Expand All @@ -141,7 +141,7 @@ public void ConstructFromNullableImmutableArray_SourceIsDefault_ExpectInnerState
ImmutableArray<RefType?>? source = new ImmutableArray<RefType?>();
var actual = new FlatArray<RefType?>(source);

actual.VerifyInnerState(default, default);
actual.VerifyInnerState_Default();
}

[Theory]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ partial class FlatArrayTest
public void Empty_ExpectInnerStateIsDefault()
{
var actual = FlatArray<StructType?>.Empty;
actual.VerifyInnerState(default, default);
actual.VerifyInnerState_Default();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public void FromArray_SourceIsNull_ExpectInnerStateIsDefault()
object?[]? source = null;
var actual = FlatArray<object?>.From(source);

actual.VerifyInnerState(default, default);
actual.VerifyInnerState_Default();
}

[Fact]
Expand All @@ -22,7 +22,7 @@ public void FromArray_SourceIsEmpty_ExpectInnerStateIsDefault()
var source = Array.Empty<StructType>();
var actual = FlatArray<StructType>.From(source);

actual.VerifyInnerState(default, default);
actual.VerifyInnerState_Default();
}

[Theory]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public void FromFlatArray_SourceIsDefault_ExpectInnerStateIsDefault()
var source = default(FlatArray<RefType>);
var actual = FlatArray<RefType>.From(source);

actual.VerifyInnerState(default, default);
actual.VerifyInnerState_Default();
}

[Theory]
Expand All @@ -36,7 +36,7 @@ public void FromNullableFlatArray_SourceIsNull_ExpectInnerStateIsDefault()
var source = default(FlatArray<StructType?>?);
var actual = FlatArray<StructType?>.From(source);

actual.VerifyInnerState(default, default);
actual.VerifyInnerState_Default();
}

[Fact]
Expand All @@ -45,7 +45,7 @@ public void FromNullableFlatArray_SourceIsDefault_ExpectInnerStateIsDefault()
FlatArray<RecordType>? source = default(FlatArray<RecordType>);
var actual = FlatArray<RecordType>.From(source);

actual.VerifyInnerState(default, default);
actual.VerifyInnerState_Default();
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public void FromIEnumerable_Array_SourceIsEmpty_ExpectInnerStateIsDefault()
IEnumerable<StructType> source = Array.Empty<StructType>();
var actual = FlatArray<StructType>.From(source);

actual.VerifyInnerState(default, default);
actual.VerifyInnerState_Default();
}

[Theory]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public void FromIEnumerable_FlatList_SourceIsEmpty_ExpectInnerStateIsDefault()
var source = Array.Empty<RefType>().InitializeFlatListAsEnumerable();
var actual = FlatArray<RefType>.From(source);

actual.VerifyInnerState(default, default);
actual.VerifyInnerState_Default();
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public void FromIEnumerable_ICollection_SourceIsEmpty_ExpectInnerStateIsDefault(
var source = new StubCollection<StructType?>(new());
var actual = FlatArray<StructType?>.From(source);

actual.VerifyInnerState(default, default);
actual.VerifyInnerState_Default();
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public void FromIEnumerable_IEnumerable_SourceIsEmpty_ExpectInnerStateIsDefault(
var source = Enumerable.Empty<RefType?>();
var actual = FlatArray<RefType?>.From(source);

actual.VerifyInnerState(default, default);
actual.VerifyInnerState_Default();
}

[Theory]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public void FromIEnumerable_IReadOnlyCollection_SourceIsEmpty_ExpectInnerStateIs
var source = new StubReadOnlyCollection<string?>(sourceItems);

var actual = FlatArray<string?>.From(source);
actual.VerifyInnerState(default, default);
actual.VerifyInnerState_Default();
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public void FromIEnumerable_IReadOnlyList_SourceIsEmpty_ExpectInnerStateIsDefaul
var source = new StubReadOnlyList<RefType>(new());
var actual = FlatArray<RefType>.From(source);

actual.VerifyInnerState(default, default);
actual.VerifyInnerState_Default();
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public void FromIEnumerable_List_SourceIsEmpty_ExpectInnerStateIsDefault()
IEnumerable<RefType> source = new List<RefType>();
var actual = FlatArray<RefType>.From(source);

actual.VerifyInnerState(default, default);
actual.VerifyInnerState_Default();
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ public void FromEnumerable_SourceIsNull_ExpectInnerStateIsDefault()
IEnumerable<DateTime>? source = null;
var actual = FlatArray<DateTime>.From(source);

actual.VerifyInnerState(default, default);
actual.VerifyInnerState_Default();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public void FromImmutableArray_SourceIsDefault_ExpectInnerStateIsDefault()
var source = default(ImmutableArray<long?>);
var actual = FlatArray<long?>.From(source);

actual.VerifyInnerState(default, default);
actual.VerifyInnerState_Default();
}

[Theory]
Expand All @@ -37,7 +37,7 @@ public void FromNullableImmutableArray_SourceIsNull_ExpectInnerStateIsDefault()
ImmutableArray<RecordType>? source = null;
var actual = FlatArray<RecordType>.From(source);

actual.VerifyInnerState(default, default);
actual.VerifyInnerState_Default();
}

[Fact]
Expand All @@ -46,7 +46,7 @@ public void FromNullableImmutableArray_SourceIsDefault_ExpectInnerStateIsDefault
ImmutableArray<RefType?>? source = new ImmutableArray<RefType?>();
var actual = FlatArray<RefType?>.From(source);

actual.VerifyInnerState(default, default);
actual.VerifyInnerState_Default();
}

[Theory]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public void FromList_SourceIsNull_ExpectInnerStateIsDefault()
List<DateOnly>? source = null;
var actual = FlatArray<DateOnly>.From(source);

actual.VerifyInnerState(default, default);
actual.VerifyInnerState_Default();
}

[Fact]
Expand All @@ -23,7 +23,7 @@ public void FromList_SourceIsEmpty_ExpectInnerStateIsDefault()
var source = new List<RefType>();
var actual = FlatArray<RefType>.From(source);

actual.VerifyInnerState(default, default);
actual.VerifyInnerState_Default();
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public void FromReadOnlySpan_SourceIsEmpty_ExpectInnerStateIsDefault()
var source = default(ReadOnlySpan<RecordType>);
var actual = FlatArray<RecordType>.From(source);

actual.VerifyInnerState(default, default);
actual.VerifyInnerState_Default();
}

[Theory]
Expand All @@ -36,7 +36,7 @@ public void FromSpan_SourceIsEmpty_ExpectInnerStateIsDefault()
var source = default(Span<StructType?>);
var actual = FlatArray<StructType?>.From(source);

actual.VerifyInnerState(default, default);
actual.VerifyInnerState_Default();
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ public void ImplicitFromArray_SourceIsNull_ExpectInnerStateIsDefault()
StructType[]? source = null;
FlatArray<StructType> actual = source;

actual.VerifyInnerState(default, default);
actual.VerifyInnerState_Default();
}

[Fact]
public void ImplicitFromArray_SourceIsEmpty_ExpectInnerStateIsDefault()
{
FlatArray<RecordType> actual = Array.Empty<RecordType>();
actual.VerifyInnerState(default, default);
actual.VerifyInnerState_Default();
}

[Theory]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public void ImplicitFromImmutableArray_SourceIsDefault_ExpectInnerStateIsDefault
var source = default(ImmutableArray<RefType>);
FlatArray<RefType> actual = source;

actual.VerifyInnerState(default, default);
actual.VerifyInnerState_Default();
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ public void ImplicitFromList_SourceIsNull_ExpectInnerStateIsDefault()
List<RefType>? source = null;
FlatArray<RefType> actual = source;

actual.VerifyInnerState(default, default);
actual.VerifyInnerState_Default();
}

[Fact]
public void ImplicitFromList_SourceIsEmpty_ExpectInnerStateIsDefault()
{
FlatArray<long> actual = new List<long>();
actual.VerifyInnerState(default, default);
actual.VerifyInnerState_Default();
}

[Fact]
Expand Down
Loading

0 comments on commit 2f7df6d

Please sign in to comment.