1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 11:38:21 +02:00

More tests

This commit is contained in:
Brian Fiete 2020-08-16 08:31:26 -07:00
parent 01d9bfb66f
commit 65d960a6e6
4 changed files with 90 additions and 0 deletions

View file

@ -58,6 +58,34 @@ namespace LibA
return Handle(val);
}
}
class LibA1
{
}
class LibA2
{
public static void DoDispose<T>(mut T val) where T : IDisposable
{
val.Dispose();
}
public static bool DoDispose2<T>(mut T val) where T : var
{
return
[IgnoreErrors(true)]
{
val.Dispose();
true
};
}
public static bool CheckEq<T>(T lhs, T rhs)
{
return lhs == rhs;
}
}
}
class LibClassA

View file

@ -3,6 +3,22 @@
using System;
using System.Collections;
namespace LibA
{
extension LibA1 : IDisposable
{
public void Dispose()
{
}
public static int operator<=>(Self lhs, Self rhs)
{
return 0;
}
}
}
namespace Tests
{
class Generics
@ -63,6 +79,14 @@ namespace Tests
{
}
class ClassD
{
public static int operator<=>(Self lhs, Self rhs)
{
return 0;
}
}
static void DoDispose<T>(mut T val) where T : IDisposable
{
val.Dispose();
@ -172,6 +196,17 @@ namespace Tests
ClassC cc = scope .();
Test.Assert(ClassC.mInstance == cc);
LibA.LibA1 la1 = scope .();
LibA.LibA1 la1b = scope .();
LibA.LibA2.DoDispose(la1);
Test.Assert(!LibA.LibA2.DoDispose2(la1));
Test.Assert(la1 == la1b);
Test.Assert(!LibA.LibA2.CheckEq(la1, la1b));
ClassD cd = scope .();
ClassD cd2 = scope .();
Test.Assert(LibA.LibA2.CheckEq(cd, cd2));
}
}

View file

@ -10,6 +10,14 @@ namespace Tests
public int8 mB;
}
class ClassA
{
public static int operator<=>(Self lhs, Self rhs)
{
return 0;
}
}
public static int[8] iArr = .(123, 234, 345, );
public static int[?] iArr2 = .(12, 23, 34);
@ -37,6 +45,13 @@ namespace Tests
var val4 = int[?](11, 12);
Test.Assert(val4[0] == 11);
ClassA ca0 = scope .();
ClassA ca1 = scope .();
Test.Assert(ClassA[2](ca0, ca0) == ClassA[2](ca1, ca1));
ClassA[2] caArr0 = .(ca0, ca0);
ClassA[2] caArr1 = .(ca1, ca1);
Test.Assert(caArr0 == caArr1);
}
[Test]

View file

@ -6,6 +6,14 @@ namespace Tests
{
class Tuples
{
class ClassA
{
public static int operator<=>(Self lhs, Self rhs)
{
return 0;
}
}
public static void Add(ref (int32, float) val)
{
val.0 += 100;
@ -30,6 +38,10 @@ namespace Tests
Add(ref tVal1);
Test.Assert(tVal1 == (a: 102, b: 203));
ClassA ca0 = scope .();
ClassA ca1 = scope .();
Test.Assert((ca0, ca0) == (ca1, ca1));
}
class ValClass