irules/test/test.core/ClauseTests.cs

58 lines
891 B
C#

11 months ago
using Irony.Interpreter;
using irules.core;
namespace test.core;
public class ClauseTests : GrammarTester
{
public ClauseTests() : base(new Clause())
{
}
[Fact]
public void TestA()
{
Parse("A");
}
[Fact]
public void TestNotA()
{
Parse("^A");
}
[Fact]
public void TestAandB()
{
Parse("A&B");
}
[Fact]
public void TestAorB()
{
Parse("A|B");
}
[Fact]
public void TestAorNotB()
{
Parse("A|^B");
}
[Fact]
public void TestAandNotB()
{
Parse("A&^B");
}
[Fact]
public void TestNotAandNotB()
{
Parse("^A&^B");
}
[Fact]
public void TestSyntactError()
{
var ex = Assert.Throws<ScriptException>(()=>
Parse("B+A"));
Assert.Equal(0, ex.Location.Line);
Assert.Equal(1, ex.Location.Column);
}
}