bodies
This commit is contained in:
parent
a92bee32e1
commit
71de903f13
5 changed files with 99 additions and 1 deletions
17
test/isn.tests/Engine.cs
Normal file
17
test/isn.tests/Engine.cs
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
using static isn.tests.Tests;
|
||||
|
||||
namespace isn.tests
|
||||
{
|
||||
internal class Engine : INeedEngine
|
||||
{
|
||||
public Engine()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public object Parse(string code)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
12
test/isn.tests/IBody.cs
Normal file
12
test/isn.tests/IBody.cs
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
namespace isn.tests
|
||||
{
|
||||
internal interface IBody
|
||||
{
|
||||
/// <summary>
|
||||
/// The mult
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
T Action<T>(T v);
|
||||
|
||||
}
|
||||
}
|
||||
11
test/isn.tests/IRing.cs
Normal file
11
test/isn.tests/IRing.cs
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
namespace isn.tests
|
||||
{
|
||||
internal interface IRing : IBody
|
||||
{
|
||||
|
||||
|
||||
IRing Add(IRing other);
|
||||
IRing Mult<TBody>(TBody v);
|
||||
}
|
||||
|
||||
}
|
||||
29
test/isn.tests/Ring.cs
Normal file
29
test/isn.tests/Ring.cs
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
namespace isn.tests
|
||||
{
|
||||
internal class Body : IBody
|
||||
{
|
||||
static public Ring One { get ;}
|
||||
|
||||
public T Action<T>(T v)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
}
|
||||
internal class Ring : Body, IRing
|
||||
{
|
||||
public static IRing Zero => throw new System.NotImplementedException();
|
||||
|
||||
|
||||
public IRing Add(IRing unity)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public IRing Mult<TBody>(TBody v)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -5,6 +5,15 @@ namespace isn.tests
|
|||
{
|
||||
public class Tests
|
||||
{
|
||||
private const int V = 0;
|
||||
private const int V1 = 1;
|
||||
|
||||
public interface INeedEngine
|
||||
{
|
||||
object Parse(string code);
|
||||
|
||||
}
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
|
|
@ -34,6 +43,26 @@ namespace isn.tests
|
|||
Assert.AreEqual(pass, unprotectedpass);
|
||||
Assert.Pass();
|
||||
}
|
||||
public void TestParseCplus()
|
||||
{
|
||||
INeedEngine engine = new Engine();
|
||||
IRing c = new Ring();
|
||||
Assert.Equals((INeedEngine)engine.Parse("c+"), c.Add(Ring.One));
|
||||
}
|
||||
|
||||
public void AssertIRingIsABody()
|
||||
{
|
||||
Ring c = new Ring();
|
||||
Ring one = Ring.One;
|
||||
Assert.True(c.Mult(one).Equals(c));
|
||||
}
|
||||
public void AssertIRingIsARing()
|
||||
{
|
||||
AssertIRingIsABody();
|
||||
Ring c = new Ring();
|
||||
IRing zero = Ring.Zero;
|
||||
Assert.True(c.Add(zero).Equals(c));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue