Skip to content

Commit

Permalink
Updated for instance where boundary which had only one dimension coul…
Browse files Browse the repository at this point in the history
…d not be unioned and was counted as empty.
  • Loading branch information
DJGosnell committed Jan 6, 2023
1 parent af2fa4f commit 6ec2e27
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/.config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"dotnet-t4": {
"version": "2.2.1",
"version": "2.3.1",
"commands": [
"t4"
]
Expand Down
22 changes: 22 additions & 0 deletions src/DtronixCommon.Tests/BoundaryTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using System.Diagnostics;
using System.Threading.Tasks;
using DtronixCommon.Threading;
using NUnit.Framework;

namespace DtronixCommon.Tests;

public class BoundaryTests
{
[Test]
public void OneDimensionalBoundaryIsNotEmpty()
{
Assert.IsFalse(new Boundary(0, -1, 0, 1).IsEmpty);
Assert.IsFalse(new Boundary(-1, 0, 1, 0).IsEmpty);
}

[Test]
public void CanUnionBoundariesWithOneDimension()
{
Assert.AreEqual(new Boundary(-1, -1, 1, 1), new Boundary(0, -1, 0, 1).Union(new Boundary(-1, 0, 1, 0)));
}
}
2 changes: 1 addition & 1 deletion src/DtronixCommon.Tests/DtronixCommon.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<ProjectReference Include="..\DtronixCommon\DtronixCommon.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Mono.TextTemplating" Version="2.2.1" />
<PackageReference Include="Mono.TextTemplating" Version="2.3.1" />
<TextTemplate Include="**\*.tt" />
<Generated Include="**\*.g.cs" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/DtronixCommon/Boundary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public readonly struct Boundary
/// <summary>
/// Returns true if the boundary has no volume.
/// </summary>
public bool IsEmpty => MinY >= MaxY || MinX >= MaxX;
public bool IsEmpty => MinY >= MaxY && MinX >= MaxX;

/// <summary>
/// Creates a boundary with the specified left, bottom, right, top distances from origin.
Expand Down
6 changes: 3 additions & 3 deletions src/DtronixCommon/DtronixCommon.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<PropertyGroup>
<TargetFrameworks>net5.0;net6.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Version>0.6.8.0</Version>
<Version>0.6.9.0</Version>
<Nullable>enable</Nullable>
<LangVersion>10</LangVersion>
<Company>Dtronix</Company>
<Product>Dtronix Common</Product>
<Copyright>Copyright © Dtronix 2022</Copyright>
<Copyright>Copyright © Dtronix 2023</Copyright>
<Authors>DJGosnell</Authors>
<PackageProjectUrl>https://github.com/Dtronix/DtronixCommon</PackageProjectUrl>
<RepositoryUrl>https://github.com/Dtronix/DtronixCommon</RepositoryUrl>
Expand All @@ -27,7 +27,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
<PackageReference Include="Mono.TextTemplating" Version="2.2.1" />
<PackageReference Include="Mono.TextTemplating" Version="2.3.1" />
<TextTemplate Include="**\*.tt" />
<Generated Include="**\*.g.cs" />
</ItemGroup>
Expand Down

0 comments on commit 6ec2e27

Please sign in to comment.