mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 19:48:20 +02:00
New tests
This commit is contained in:
parent
7247cad7f3
commit
2fb4b14e50
2 changed files with 33 additions and 0 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue