public void TestEnsureICanParseTermsFromExpression() { BasicTasks doSomething = new BasicTasks(); doSomething.IdentifyOperator("3+2"); Assert.AreEqual(doSomething.firstNumber, 3); Assert.AreEqual(doSomething.secondNumber, 2); Assert.AreEqual(doSomething.myDelimeter, '+'); }
public void Start() { ai = GetComponent <AI>(); basicTasks = GetComponent <BasicTasks>(); animationTasks = GetComponent <AnimationTasks>(); physics = GetComponent <Physics>(); movement = GetComponent <BasicMovement>(); gun = GetComponentInChildren <Gun>(); particles = GetComponent <ParticleSystem>(); pathFinding = GetComponent <PathFindingTasks>(); pathFinding.SetMovementParameters(dasherStats.Speed, dasherStats.TurningVelocity); var playerBody = GameManager.Instance.Player.GetComponent <Body>(); targetBody = playerBody.CenterBody; }
public Evaluate(BasicTasks _task) { calculate = _task; }
public Evaluate() { calculate = new BasicTasks(); }
static void Main(string[] args) { int counter = 0; var propeller = true; BasicTasks myOperation = new BasicTasks(); while (propeller) { string prompt = "[" + counter + "]" + "> "; // Saving user's input expression into a variable Console.Write(prompt); string theExpression = Console.ReadLine(); switch (theExpression) { // Keyword for exiting application case "quit": Console.WriteLine("Bye!"); Environment.Exit(1); return; // Keyword for exiting the application case "exit": Console.WriteLine("Bye!"); Environment.Exit(1); return; // User entered "last" command case "last": Console.WriteLine(Stack.LastAnswer); break; // User entered "lastq" command case "lastq": Console.WriteLine(Stack.LastCommand); break; // User entered an expression to be evaluated default: // Stashing this away so it's ready if user enters "lastq" command if (theExpression != "lastq" || theExpression != "last") { Stack.LastCommand = theExpression; } // Finding delimeter myOperation.IdentifyOperator(theExpression); Evaluate evaluating = new Evaluate(myOperation); // Determine if we need to send this on for calculation or constant setting switch (myOperation.myDelimeter) { // Will get set as a constant case '=': myOperation.calcStack.SetTheConstant(myOperation.ifItIsChar, myOperation.secondNumber); break; default: evaluating.EvaluateThis(theExpression); // Increment counter with each round counter = counter + 1; Console.WriteLine("= " + Calculation.Answer); break; } break; } } }
public void TestEnsureItWillThrowErrorForIncorrectExpression() { BasicTasks doSomething = new BasicTasks(); doSomething.IdentifyOperator("3+"); }