using System; using System.Collections.Generic; using System.Text; using UnitTestSharp; using DNAModule.Sunweaver.Commands.Abstracts; using DNAModule.Sunweaver.Commands.BinaryMath; using DNAModule.Sunweaver.DataPrototypes; namespace DNAModule.Sunweaver.UnitTests.Commands.BinaryMath { public class storeTests : TestFixture { BasePair bp = new store(); VirtualMachine VM; public override void TestSetup() { VM = new VirtualMachine(); } public void StoresCorrectly() { VM.Stack.Push(25); VM.Stack.Push(30); bp.Implementation(VM); CheckEqual((short)25, VM.mem[30]); } public void NameTest() { CheckEqual("store", bp.ToString()); } public void NegativeLocation() { VM.Stack.Push(25); VM.Stack.Push(-30); bp.Implementation(VM); CheckEqual((short)25, VM.mem[30]); } public void OverflowValue() { VM.Stack.Push(2500001); VM.Stack.Push(30); bp.Implementation(VM); CheckEqual((short)1, VM.mem[30]); } public void OverflowLocation() { VM.Stack.Push(25); VM.Stack.Push(3000001); bp.Implementation(VM); CheckEqual((short)25, VM.mem[1]); } public void FizzlesWhenFalse() { VM.BoolStack.Push(false); VM.Stack.Push(25); VM.Stack.Push(30); bp.Implementation(VM); CheckEqual((short)0, VM.mem[30]); } } }