using System; using System.Collections.Generic; using System.Text; using UnitTestSharp; using Sunweaver.Commands.Abstracts; using Sunweaver.Commands.BinaryMath; using Sunweaver.DataPrototypes; namespace Sunweaver.UnitTests.Commands.BinaryMath { public class multTests : TestFixture { BasePair bp = new mult(); VirtualMachine VM; public override void TestSetup() { VM = new VirtualMachine(); } public void MultsCorrectly() { VM.Stack.Push(25); VM.Stack.Push(30); bp.Implementation(VM); CheckEqual(750, VM.Stack.Pop()); } public void NameTest() { CheckEqual("mult", bp.ToString()); } /// /// Try to weird out the mult operator. This will fail if theirs any loss of bit precision /// public void Overflow() { //9 nines VM.Stack.Push(IntStack.Min); VM.Stack.Push(IntStack.Max); bp.Implementation(VM); CheckEqual(-1, VM.Stack.Pop()); } } }