Permalink
Browse files

AdventureSample - bitwise AND expr

  • Loading branch information...
bobbymcr committed Apr 22, 2018
1 parent 774d92a commit 63a130a18eda8d72fa2c2d47bb04f48c12970c0a
@@ -298,6 +298,9 @@ public void Operator(string name, BasicExpression[] operands)
{
switch (name)
{
case "And":
this.Value = this.Binary(this.generator.BitwiseAndExpression, operands[0], operands[1]);
break;
case "Add":
this.Value = this.Binary(this.generator.AddExpression, operands[0], operands[1]);
break;
@@ -0,0 +1,48 @@
// <copyright file="AndExpressions.cs" company="Brian Rogers">
// Copyright (c) Brian Rogers. All rights reserved.
// </copyright>
namespace GWBas2CS.Test
{
using FluentAssertions;
using Xunit;
public sealed class AndExpressions
{
[Fact]
public void TwoNumericOperands()
{
const string Input = @"10 A=A AND 1";
const string Expected = @"*
private bool Main()
{
this.Init();
A_n = ((A_n) & (1));
return false;
}
*";
string actual = Test.Translate("MyProg", Input);
actual.Should().Match(Expected);
}
[Fact]
public void ThreeNumericOperands()
{
const string Input = @"10 A=A AND B AND 2";
const string Expected = @"*
private bool Main()
{
this.Init();
A_n = (((A_n) & (B_n)) & (2));
return false;
}
*";
string actual = Test.Translate("MyProg", Input);
actual.Should().Match(Expected);
}
}
}

0 comments on commit 63a130a

Please sign in to comment.