nodeProfile
This commit is contained in:
parent
5e3c9dc760
commit
004348f024
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: bbaa68e4da2746ed9af5d76e173b5e8c
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -0,0 +1,25 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace AsmdefHelper.DependencyGraph.Editor.DependencyNode {
|
||||||
|
public readonly struct NodeId : IEquatable<NodeId> {
|
||||||
|
public readonly int value;
|
||||||
|
|
||||||
|
public NodeId(int value) => this.value = value;
|
||||||
|
|
||||||
|
public bool Equals(NodeId other) {
|
||||||
|
return value == other.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool Equals(object obj) {
|
||||||
|
return obj is NodeId other && Equals(other);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override int GetHashCode() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string ToString() {
|
||||||
|
return value.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 11a5fcf054a34f8083cdcdb038b4c70c
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -0,0 +1,27 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace AsmdefHelper.DependencyGraph.Editor.DependencyNode {
|
||||||
|
public readonly struct NodeProfile : IEquatable<NodeProfile> {
|
||||||
|
public readonly NodeId id;
|
||||||
|
public readonly string name;
|
||||||
|
|
||||||
|
public NodeProfile(NodeId id, string name) {
|
||||||
|
this.id = id;
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Equals(NodeProfile other) {
|
||||||
|
return id.Equals(other.id) && name == other.name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool Equals(object obj) {
|
||||||
|
return obj is NodeProfile other && Equals(other);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override int GetHashCode() {
|
||||||
|
unchecked {
|
||||||
|
return (id.GetHashCode() * 397) ^ (name != null ? name.GetHashCode() : 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 8cf71e8ce8054c4b95902fcd1bda7010
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 7f68a5c3b1e9b8b4aa69caf9b0838471
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"name": "AsmdefHelper.DependencyGraph.Editor.Tests",
|
||||||
|
"references": [
|
||||||
|
"GUID:53e113411e7b0e947975fcd498b539aa"
|
||||||
|
],
|
||||||
|
"includePlatforms": [
|
||||||
|
"Editor"
|
||||||
|
],
|
||||||
|
"excludePlatforms": [],
|
||||||
|
"allowUnsafeCode": false,
|
||||||
|
"overrideReferences": false,
|
||||||
|
"precompiledReferences": [],
|
||||||
|
"autoReferenced": false,
|
||||||
|
"defineConstraints": [],
|
||||||
|
"versionDefines": [],
|
||||||
|
"noEngineReferences": false
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 5b1e278775093cb40af4ebe716362ac9
|
||||||
|
AssemblyDefinitionImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -0,0 +1,31 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.TestTools;
|
||||||
|
|
||||||
|
namespace AsmdefHelper.DependencyGraph.Editor.DependencyNode.Tests {
|
||||||
|
public class NodeIdTest {
|
||||||
|
[Test]
|
||||||
|
public void TestNodeIdValue() {
|
||||||
|
var nodeId = new NodeId(123);
|
||||||
|
Assert.That(nodeId.value, Is.EqualTo(123));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestNodeIdEquals() {
|
||||||
|
var id1 = new NodeId(111);
|
||||||
|
var id2 = new NodeId(222);
|
||||||
|
var id3 = new NodeId(111);
|
||||||
|
Assert.That(id1, Is.EqualTo(id1));
|
||||||
|
Assert.That(id1, Is.Not.EqualTo(id2));
|
||||||
|
Assert.That(id1, Is.EqualTo(id3));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestNodeIdToString() {
|
||||||
|
var nodeId = new NodeId(999);
|
||||||
|
Assert.That(nodeId.ToString(), Is.EqualTo("999"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 946cb4c27532a5848a9cf8c9dea05df8
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -0,0 +1,28 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEngine.TestTools;
|
||||||
|
|
||||||
|
namespace AsmdefHelper.DependencyGraph.Editor.DependencyNode.Tests {
|
||||||
|
public class NodeProfileTest {
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestNodeProfile() {
|
||||||
|
var nodeProfile = new NodeProfile(new NodeId(123), "testNode");
|
||||||
|
Assert.That(nodeProfile.id.value, Is.EqualTo(123));
|
||||||
|
Assert.That(nodeProfile.name, Is.EqualTo("testNode"));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestNodeProfileEquals() {
|
||||||
|
var profile1 = new NodeProfile(new NodeId(111), "testNode1");
|
||||||
|
var profile2 = new NodeProfile(new NodeId(222), "testNode1");
|
||||||
|
var profile3 = new NodeProfile(new NodeId(111), "testNode2");
|
||||||
|
var profile4 = new NodeProfile(new NodeId(111), "testNode1");
|
||||||
|
Assert.That(profile1, Is.EqualTo(profile1));
|
||||||
|
Assert.That(profile1, Is.Not.EqualTo(profile2));
|
||||||
|
Assert.That(profile1, Is.Not.EqualTo(profile3));
|
||||||
|
Assert.That(profile1, Is.EqualTo(profile4));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 6550a73c9df44f0092949ddd3ea5ac06
|
||||||
|
timeCreated: 1605448488
|
Loading…
x
Reference in New Issue
Block a user