mirror of
https://github.com/AssetRipper/AssetRipper.git
synced 2025-12-11 20:15:29 +01:00
parent
a5cd6d3ad6
commit
4c41bc27ca
@ -159,6 +159,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AssetRipper.GUI.Web", "Sour
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AssetRipper.Export.Modules.Models", "Source\AssetRipper.Export.Modules.Models\AssetRipper.Export.Modules.Models.csproj", "{B827502A-EA76-4C16-B246-0E625A7ED80E}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AssetRipper.GUI.Web.Tests", "Source\AssetRipper.GUI.Web.Tests\AssetRipper.GUI.Web.Tests.csproj", "{9EDD3621-6E2B-41AD-8F6A-F8C4CD113566}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@ -337,6 +339,10 @@ Global
|
||||
{B827502A-EA76-4C16-B246-0E625A7ED80E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{B827502A-EA76-4C16-B246-0E625A7ED80E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{B827502A-EA76-4C16-B246-0E625A7ED80E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{9EDD3621-6E2B-41AD-8F6A-F8C4CD113566}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{9EDD3621-6E2B-41AD-8F6A-F8C4CD113566}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{9EDD3621-6E2B-41AD-8F6A-F8C4CD113566}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{9EDD3621-6E2B-41AD-8F6A-F8C4CD113566}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@ -0,0 +1,27 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<IsPackable>false</IsPackable>
|
||||
<OutputPath>..\0Bins\Other\AssetRipper.GUI.Web.Tests\$(Configuration)\</OutputPath>
|
||||
<IntermediateOutputPath>..\0Bins\obj\AssetRipper.GUI.Web.Tests\$(Configuration)\</IntermediateOutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
|
||||
<PackageReference Include="NUnit" Version="4.1.0" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
|
||||
<PackageReference Include="NUnit.Analyzers" Version="4.2.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="coverlet.collector" Version="6.0.2">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\AssetRipper.GUI.Web\AssetRipper.GUI.Web.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
35
Source/AssetRipper.GUI.Web.Tests/BundlePathTests.cs
Normal file
35
Source/AssetRipper.GUI.Web.Tests/BundlePathTests.cs
Normal file
@ -0,0 +1,35 @@
|
||||
using AssetRipper.GUI.Web.Paths;
|
||||
|
||||
namespace AssetRipper.GUI.Web.Tests;
|
||||
|
||||
public class BundlePathTests
|
||||
{
|
||||
[Test]
|
||||
public void DefaultBundlePathIsRoot()
|
||||
{
|
||||
BundlePath path = default;
|
||||
Assert.That(path.IsRoot);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void BundlePathParentWithDepthOneIsRoot()
|
||||
{
|
||||
BundlePath path = new([0]);
|
||||
Assert.That(path.Parent.IsRoot);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void BundlePathParentWithDepthTwoIsNotRoot()
|
||||
{
|
||||
BundlePath path = new([0,0]);
|
||||
Assert.That(path.Parent.IsRoot, Is.False);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ParentHasCorrectPath()
|
||||
{
|
||||
BundlePath path = new([1, 2, 3]);
|
||||
BundlePath parent = path.Parent;
|
||||
Assert.That(parent.Path.ToArray(), Is.EquivalentTo((int[])[1, 2]));
|
||||
}
|
||||
}
|
||||
2
Source/AssetRipper.GUI.Web.Tests/Usings.cs
Normal file
2
Source/AssetRipper.GUI.Web.Tests/Usings.cs
Normal file
@ -0,0 +1,2 @@
|
||||
global using NUnit.Framework;
|
||||
global using System;
|
||||
@ -39,14 +39,14 @@ public readonly record struct BundlePath : IPath<BundlePath>
|
||||
/// If <see cref="IsRoot"/>, then this will return <see langword="default"/>.
|
||||
/// </remarks>
|
||||
[JsonIgnore]
|
||||
public BundlePath Parent => Depth > 1 ? new BundlePath(Path.Span[..^-1]) : default;
|
||||
public BundlePath Parent => Depth > 1 ? new BundlePath(Path.Span[..^1]) : default;
|
||||
|
||||
public BundlePath GetChild(int index)
|
||||
{
|
||||
int[] path;
|
||||
if (_path is null)
|
||||
{
|
||||
path = new int[1] { index };
|
||||
path = [index];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user