This commit is contained in:
ousttrue 2022-01-25 13:35:24 +09:00
parent 509a3cac05
commit 64d6a6bde4
2 changed files with 37 additions and 0 deletions

View File

@ -0,0 +1,26 @@
using System;
using NUnit.Framework;
using Unity.Collections;
namespace UniGLTF
{
public class NativeArrayTests
{
[Test]
public void DisposeTest()
{
var array = new NativeArray<byte>(64, Allocator.Persistent);
var sub = array.GetSubArray(10, 4);
Assert.Throws<InvalidOperationException>(() => { sub.Dispose(); });
var cast = array.Reinterpret<int>(1);
// Dispose可能
cast.Dispose();
// Disposed
Assert.Throws<InvalidOperationException>(() => { var c = cast[0]; });
Assert.Throws<InvalidOperationException>(() => { var a = array[0]; });
Assert.Throws<InvalidOperationException>(() => { var s = sub[0]; });
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d3712bde0d2a4b348ab5bb661fe1a51a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: