mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-05-24 11:57:21 -05:00
add test
This commit is contained in:
parent
509a3cac05
commit
64d6a6bde4
26
Assets/UniGLTF/Tests/UniGLTF/NativeArrayTests.cs
Normal file
26
Assets/UniGLTF/Tests/UniGLTF/NativeArrayTests.cs
Normal 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]; });
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/UniGLTF/Tests/UniGLTF/NativeArrayTests.cs.meta
Normal file
11
Assets/UniGLTF/Tests/UniGLTF/NativeArrayTests.cs.meta
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: d3712bde0d2a4b348ab5bb661fe1a51a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Loading…
Reference in New Issue
Block a user