mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 12:32:20 +02:00
Added some alloctype(T) tests
This commit is contained in:
parent
9d5d5b4063
commit
4b80bcbbcf
3 changed files with 74 additions and 10 deletions
|
@ -1,3 +1,5 @@
|
|||
#pragma warning disable 168
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
|
@ -124,6 +126,29 @@ namespace Tests
|
|||
}
|
||||
}
|
||||
|
||||
public static void Alloc0<T>() where T : new, delete, IDisposable
|
||||
{
|
||||
alloctype(T) val = new T();
|
||||
val.Dispose();
|
||||
delete val;
|
||||
}
|
||||
|
||||
public static void Alloc1<T>() where T : new, delete, IDisposable, Object
|
||||
{
|
||||
alloctype(T) val = new T();
|
||||
T val2 = val;
|
||||
val.Dispose();
|
||||
delete val;
|
||||
}
|
||||
|
||||
public static void Alloc2<T>() where T : new, delete, IDisposable, struct
|
||||
{
|
||||
alloctype(T) val = new T();
|
||||
T* val2 = val;
|
||||
val2.Dispose();
|
||||
delete val;
|
||||
}
|
||||
|
||||
[Test]
|
||||
public static void TestBasics()
|
||||
{
|
||||
|
@ -169,7 +194,7 @@ namespace Tests
|
|||
Test.Assert(totals == 10+20+30+40+50);
|
||||
}
|
||||
|
||||
public static mixin TransformArray<Input, Output, InputSize>(Input[InputSize] array, delegate void(Input, ref Output) predicate) where InputSize : const int where Output : new
|
||||
public static mixin TransformArray<Input, Output, InputSize>(Input[InputSize] array, delegate void(Input, ref Output) predicate) where InputSize : const int where Output : new, class
|
||||
{
|
||||
Output[2] output = default;
|
||||
for (int i = 0; i < array.Count; i++)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue