using System; using System.Collections.Generic; using System.Text; using UnitTestSharp; using System.Reflection.Emit; using Sunweaver.Commands.Abstracts; using Sunweaver.DataPrototypes; namespace Sunweaver.UnitTests.Commands.Abstracts { public class UnaryBooleanOperationTests : TestFixture { class UnaryOperationTester : Sunweaver.Commands.Abstracts.UnaryBooleanLogic { public bool A = false; public override void Operation(bool a) { A = a; } public override void CompileOperation( System.Reflection.Emit.ILGenerator il, DataPrototypes.Locals locals) { // Pass } } public override void TestSetup() { VM = new Sunweaver.DataPrototypes.VirtualMachine(); } UnaryOperationTester bp = new UnaryOperationTester(); Sunweaver.DataPrototypes.VirtualMachine VM; public void DecreasesStackDepthBy1() { VM.BoolStack.Push(false); bp.Implementation(VM); CheckEqual(0, VM.Stack.Count()); } public void FizzlesWhenEmpty() { bp.A = false; bp.Implementation(VM); CheckEqual((long)0, VM.BoolStack.Count()); CheckFalse( bp.A); } public void PullsStackValuesCorrectly() { VM.BoolStack.Push(false); bp.Implementation(VM); CheckFalse( bp.A); } } }