Exemplo n.º 1
0
        public void Evaluate_MatchingOutputGiven_ShouldBeSuccessful(string args, string evaluation)
        {
            userProgram.SetSource(@"TestFiles\test_graph.cpp");
            userProgram.Compile();
            userProgram.Execute(args);
            var result = userProgram.Evaluate(evaluation);

            Assert.Equal(successful, result.Status);
        }
Exemplo n.º 2
0
        public void Evaluate_MatchingOutputGiven_ShouldBeSuccessful()
        {
            string expected = "Hello World!";

            userProgram.SetSource(@"TestFiles\test_helloworld.cpp");
            userProgram.Compile();
            userProgram.Execute();
            var result = userProgram.Evaluate(expected);

            Assert.Equal(successful, result.Status);
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            if (args.Length < 1)
            {
                Console.WriteLine("Please enter a file path");
                return;
            }

            UserProgram userProgram = new UserProgram();

            UserProgram.Result sourceResult = userProgram.SetSource(args[0]);

            Console.WriteLine(sourceResult.Message);
            if (sourceResult.Status == UserProgram.Result.StatusType.Failed)
            {
                return;
            }

            UserProgram.Result compilationResult = userProgram.Compile();

            Console.WriteLine(compilationResult.Message);
            if (compilationResult.Status == UserProgram.Result.StatusType.Failed)
            {
                return;
            }

            UserProgram.Result programResult = userProgram.Execute(args.Length < 2 ? "" : args[1]);

            Console.WriteLine(programResult.Message);
            if (programResult.Status == UserProgram.Result.StatusType.Failed)
            {
                return;
            }

            string expectedOutput = args.Length < 3 ? "Hello World!" : args[2];

            UserProgram.Result outputResult = userProgram.Evaluate(expectedOutput);
            Console.WriteLine(outputResult.Message);
        }