Compare commits

..
5 Commits
Author SHA1 Message Date
ds5678 c663c68124 Bump version 2024-04-15 19:51:42 -07:00
dependabot[bot] fa2458cfae Bump Microsoft.NET.Test.Sdk from 17.8.0 to 17.9.0
Bumps [Microsoft.NET.Test.Sdk](https://github.com/microsoft/vstest) from 17.8.0 to 17.9.0.
- [Release notes](https://github.com/microsoft/vstest/releases)
- [Changelog](https://github.com/microsoft/vstest/blob/main/docs/releases.md)
- [Commits](https://github.com/microsoft/vstest/compare/v17.8.0...v17.9.0)

---
updated-dependencies:
- dependency-name: Microsoft.NET.Test.Sdk
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
2024-04-15 08:04:23 -07:00
dependabot[bot] ee923d8e9b Bump coverlet.collector from 6.0.0 to 6.0.2
Bumps [coverlet.collector](https://github.com/coverlet-coverage/coverlet) from 6.0.0 to 6.0.2.
- [Release notes](https://github.com/coverlet-coverage/coverlet/releases)
- [Commits](https://github.com/coverlet-coverage/coverlet/compare/v6.0.0...v6.0.2)

---
updated-dependencies:
- dependency-name: coverlet.collector
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
2024-04-15 08:04:14 -07:00
dependabot[bot] 8b23a0c671 Bump NUnit.Analyzers from 3.10.0 to 4.1.0
Bumps [NUnit.Analyzers](https://github.com/nunit/nunit.analyzers) from 3.10.0 to 4.1.0.
- [Release notes](https://github.com/nunit/nunit.analyzers/releases)
- [Changelog](https://github.com/nunit/nunit.analyzers/blob/master/CHANGES.txt)
- [Commits](https://github.com/nunit/nunit.analyzers/compare/3.10.0...4.1.0)

---
updated-dependencies:
- dependency-name: NUnit.Analyzers
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
2024-04-15 08:04:04 -07:00
ds5678 f56feaf217 Remove incorrect code for Unity 6 2024-04-14 22:20:30 -07:00
5 changed files with 10 additions and 66 deletions

No files matched your search

@@ -9,14 +9,14 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="NUnit" Version="3.14.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageReference Include="NUnit.Analyzers" Version="3.10.0">
<PackageReference Include="NUnit.Analyzers" Version="4.1.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="6.0.0" />
<PackageReference Include="coverlet.collector" Version="6.0.2" />
</ItemGroup>
<ItemGroup>
@@ -72,20 +72,4 @@ public class ComparisonTests
Assert.That(new UnityVersion(2019, 1, 0, UnityVersionType.Final, 1).LessThanOrEquals(2019, 1, 0));
});
}
[TestCase(2017)]
[TestCase(2018)]
[TestCase(2019)]
[TestCase(2020)]
[TestCase(2021)]
[TestCase(2022)]
[TestCase(2023)]
public void YearVersioningIsBetweenFiveAndSix(int year)
{
Assert.Multiple(() =>
{
Assert.That(new UnityVersion((ushort)year).GreaterThan(5));
Assert.That(new UnityVersion((ushort)year).LessThan(6));
});
}
}
@@ -6,7 +6,7 @@
<Nullable>enable</Nullable>
<Authors>ds5678</Authors>
<Company>AssetRipper</Company>
<Version>2.1.1</Version>
<Version>3.0.0</Version>
<AssemblyVersion>$(Version)</AssemblyVersion>
<PackageId>AssetRipper.Primitives</PackageId>
<PackageTags>C# assetripper unity unity3d</PackageTags>
@@ -27,47 +27,7 @@ public readonly partial struct UnityVersion : IEquatable<UnityVersion>, ICompara
/// </returns>
public int CompareTo(UnityVersion other)
{
//Unity 6 is sequentially equivalent to Unity 2024 because
//they switched to back to the old versioning scheme.
const ushort FirstNewVersion = 6;
if (this == other)
{
return 0;
}
if (UsesYearNumbering(this))
{
if (UsesYearNumbering(other))
{
return CompareByData(this, other);
}
else
{
return other.Major < FirstNewVersion ? 1 : -1;
}
}
else
{
if (UsesYearNumbering(other))
{
return Major < FirstNewVersion ? -1 : 1;
}
else
{
return CompareByData(this, other);
}
}
static int CompareByData(UnityVersion x, UnityVersion y)
{
return x.m_data < y.m_data ? -1 : 1;
}
static bool UsesYearNumbering(UnityVersion version)
{
return version.Major is >= 2017 and <= 2023;
}
return m_data.CompareTo(other.m_data);
}
/// <summary>
@@ -90,6 +50,6 @@ public readonly partial struct UnityVersion : IEquatable<UnityVersion>, ICompara
/// <inheritdoc/>
public override int GetHashCode()
{
return unchecked(827 + 911 * m_data.GetHashCode());
return m_data.GetHashCode();
}
}
@@ -32,7 +32,7 @@ public readonly partial struct UnityVersion
/// <returns></returns>
public static bool operator >(UnityVersion left, UnityVersion right)
{
return left.CompareTo(right) > 0;
return left.m_data > right.m_data;
}
/// <summary>
@@ -43,7 +43,7 @@ public readonly partial struct UnityVersion
/// <returns></returns>
public static bool operator >=(UnityVersion left, UnityVersion right)
{
return left.CompareTo(right) >= 0;
return left.m_data >= right.m_data;
}
/// <summary>
@@ -54,7 +54,7 @@ public readonly partial struct UnityVersion
/// <returns></returns>
public static bool operator <(UnityVersion left, UnityVersion right)
{
return left.CompareTo(right) < 0;
return left.m_data < right.m_data;
}
/// <summary>
@@ -65,6 +65,6 @@ public readonly partial struct UnityVersion
/// <returns></returns>
public static bool operator <=(UnityVersion left, UnityVersion right)
{
return left.CompareTo(right) <= 0;
return left.m_data <= right.m_data;
}
}