1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 19:48:20 +02:00

New tests

This commit is contained in:
Brian Fiete 2019-12-13 14:19:28 -08:00
parent 7247cad7f3
commit 2fb4b14e50
2 changed files with 33 additions and 0 deletions

View file

@ -17,6 +17,19 @@ namespace Tests
let fn3 = fn + intn2;
Test.Assert(fn3 == null);
int i = intn ?? 200;
Test.Assert(i == 100);
i = intn2 ?? (int16)200;
Test.Assert(i == 200);
i = 300;
Test.Assert(intn.TryGetValue(ref i));
Test.Assert(i == 100);
Test.Assert(!intn2.TryGetValue(ref i));
Test.Assert(i == 100);
}
}
}

View file

@ -1,3 +1,5 @@
#pragma warning disable 168
using System;
namespace Tests
@ -114,5 +116,23 @@ namespace Tests
Test.Assert(alignof(StructI) == 4);
Test.Assert(strideof(StructI) == 16);
}
public int Test<T>(T val)
{
return 11;
}
static int Test<T, T2>(T val) where T : Span<T2>
{
return 22;
}
[Test]
static void TestStringView()
{
StringView sv = "Hey";
Span<char8> span = sv;
Test.Assert(Test(sv) == 22);
}
}
}