1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-18 16:10:26 +02:00

More tests for generic constraints and mixins

This commit is contained in:
Brian Fiete 2020-06-03 12:08:37 -07:00
parent c90db82b52
commit f6f94ed40c
2 changed files with 50 additions and 0 deletions

View file

@ -0,0 +1,42 @@
using System;
using System.Collections;
namespace Tests
{
class Constraints
{
class Dicto : Dictionary<int, float>
{
}
public static bool Method1<T>(IEnumerator<T> param1)
{
return true;
}
public static bool Method2<TEnumerator, TElement>(TEnumerator param1) where TEnumerator : IEnumerator<TElement>
{
for (let val in param1)
{
}
return true;
}
public static bool Method3<K, V>(Dictionary<K, V> param1) where K : IHashable
{
Method1(param1.GetEnumerator());
Method1((IEnumerator<(K key, V value)>)param1.GetEnumerator());
return Method2<Dictionary<K, V>.Enumerator, (K key, V value)>(param1.GetEnumerator());
}
[Test]
public static void TestBasics()
{
Dicto dicto = scope .();
Method3(dicto);
}
}
}