public void Do() { var tp = new TestProgram() { Name = "CPP_Hello", Lang = Languages.CPP, Program = @"#include <iostream> int main() { std::cout << ""Hello, world!""; }", Args = "-Wall -std=c++14 -O2 -o a.out source_file.cpp" }; var res = Logic.TestProgram (tp); if (!string.IsNullOrEmpty (res.Warnings) || !string.IsNullOrEmpty (res.Errors)) { throw new Exception ("warnings or errors not null"); } if (string.IsNullOrEmpty (res.Output) || res.Output != "Hello, world!") { throw new Exception ("output is wrong"); } }
public void Do() { var tp = new TestProgram() { Name = "Erlang_Hello", Lang = Languages.Erlang, Program = @" -module(source). -export([entry_point/0]). entry_point() -> io:fwrite(""Hello, world!"")." }; var res = Logic.TestProgram (tp); if (!string.IsNullOrEmpty (res.Warnings) || !string.IsNullOrEmpty (res.Errors)) { throw new Exception ("warnings or errors not null"); } if (string.IsNullOrEmpty (res.Output) || res.Output != "Hello, world!") { throw new Exception ("output is wrong"); } }
public void Do() { var tp = new TestProgram() { Name = "Erlang_Hello", Lang = Languages.Erlang, Program = @" -module(source). -export([entry_point/0]). entry_point() -> io:fwrite(""Hello, world!"")." }; var res = Logic.TestProgram(tp); if (!string.IsNullOrEmpty(res.Warnings) || !string.IsNullOrEmpty(res.Errors)) { throw new Exception("warnings or errors not null"); } if (string.IsNullOrEmpty(res.Output) || res.Output != "Hello, world!") { throw new Exception("output is wrong"); } }
public void Do() { var tp = new TestProgram() { Name = "D_Hello", Lang = Languages.D, Program = @"import std.stdio; void main() { writeln(""Hello, World!""); }", Args = "source_file.d -ofa.out" }; var res = Logic.TestProgram (tp); if (!string.IsNullOrEmpty (res.Warnings) || !string.IsNullOrEmpty (res.Errors)) { throw new Exception ("warnings or errors not null"); } if (string.IsNullOrEmpty (res.Output) || res.Output != "Hello, World!\n") { throw new Exception ("output is wrong"); } }
public void Do() { var tp = new TestProgram() { Name = "CPPClang_Hello", Lang = Languages.CppClang, Program = @"#include <iostream> int main() { std::cout << ""Hello, world!""; }", Args = "-Wall -std=c++14 -stdlib=libc++ -O2 -o a.out source_file.cpp" }; var res = Logic.TestProgram(tp); if (!string.IsNullOrEmpty(res.Warnings) || !string.IsNullOrEmpty(res.Errors)) { throw new Exception("warnings or errors not null"); } if (string.IsNullOrEmpty(res.Output) || res.Output != "Hello, world!") { throw new Exception("output is wrong"); } }
public void Do() { var tp = new TestProgram() { Name = "Php_Hello", Lang = Languages.Php, Program = @"<?php //php 5.5.9 echo ""Hello, world!"" ?>" }; var res = Logic.TestProgram (tp); if (!string.IsNullOrEmpty (res.Warnings) || !string.IsNullOrEmpty (res.Errors)) { throw new Exception ("warnings or errors not null"); } if (string.IsNullOrEmpty (res.Output) || res.Output != "Hello, world!") { throw new Exception ("output is wrong"); } }
public void Do() { var tp = new TestProgram() { Name = "Pascal_Hello", Lang = Languages.Pascal, Program = @"//fpc 2.6.2 program HelloWorld; begin writeln('Hello, world!'); end. " }; var res = Logic.TestProgram (tp); if (!string.IsNullOrEmpty (res.Warnings) || !string.IsNullOrEmpty (res.Errors)) { throw new Exception ("warnings or errors not null"); } if (string.IsNullOrEmpty (res.Output) || res.Output != "Hello, world!\n") { throw new Exception ("output is wrong"); } }
public void Do() { var tp = new TestProgram() { Name = "Ada_Hello", Lang = Languages.Ada, Program = @"with Ada.Text_IO; use Ada.Text_IO; procedure Hello is begin Put_Line (""Hello, world!""); end Hello;" }; var res = Logic.TestProgram (tp); if (!string.IsNullOrEmpty (res.Warnings) || !string.IsNullOrEmpty (res.Errors)) { throw new Exception ("warnings or errors not null"); } if (string.IsNullOrEmpty (res.Output) || res.Output != "Hello, world!\n") { throw new Exception ("output is wrong"); } }
public void Do() { var tp = new TestProgram() { Name = "Pascal_Hello", Lang = Languages.Pascal, Program = @"//fpc 2.6.2 program HelloWorld; begin writeln('Hello, world!'); end. " }; var res = Logic.TestProgram(tp); if (!string.IsNullOrEmpty(res.Warnings) || !string.IsNullOrEmpty(res.Errors)) { throw new Exception("warnings or errors not null"); } if (string.IsNullOrEmpty(res.Output) || res.Output != "Hello, world!\n") { throw new Exception("output is wrong"); } }
public void Do() { var tp = new TestProgram() { Name = "D_Hello", Lang = Languages.D, Program = @"import std.stdio; void main() { writeln(""Hello, World!""); }", Args = "source_file.d -ofa.out" }; var res = Logic.TestProgram(tp); if (!string.IsNullOrEmpty(res.Warnings) || !string.IsNullOrEmpty(res.Errors)) { throw new Exception("warnings or errors not null"); } if (string.IsNullOrEmpty(res.Output) || res.Output != "Hello, World!\n") { throw new Exception("output is wrong"); } }
public void Do() { var tp = new TestProgram() { Name = "Objectivec_Hello", Lang = Languages.ObjectiveC, Program = @"//gcc 4.8.4 #import <stdio.h> int main(void) { printf(""Hello, world!""); return 0; } ", Args = "-MMD -MP -DGNUSTEP -DGNUSTEP_BASE_LIBRARY=1 -DGNU_GUI_LIBRARY=1 -DGNU_RUNTIME=1 -DGNUSTEP_BASE_LIBRARY=1 -fno-strict-aliasing -fexceptions -fobjc-exceptions -D_NATIVE_OBJC_EXCEPTIONS -pthread -fPIC -Wall -DGSWARN -DGSDIAGNOSE -Wno-import -g -O2 -fgnu-runtime -fconstant-string-class=NSConstantString -I. -I /usr/include/GNUstep -I/usr/include/GNUstep -o a.out source_file.m -lobjc -lgnustep-base" }; var res = Logic.TestProgram(tp); if (!string.IsNullOrEmpty(res.Warnings) || !string.IsNullOrEmpty(res.Errors)) { throw new Exception("warnings or errors not null"); } if (string.IsNullOrEmpty(res.Output) || res.Output != "Hello, world!") { throw new Exception("output is wrong"); } }
public void Do() { var tp = new TestProgram() { Name = "Java_Hello", Lang = Languages.Java, Program = @"//Title of this code //'main' method must be in a class 'Rextester'. import java.util.*; import java.lang.*; import java.nio.charset.*; class Rextester { public static void main(String args[]) { System.out.println(""ėšęįųšįęė""); } }" }; var res = Logic.TestProgram(tp); if (!string.IsNullOrEmpty(res.Warnings) || !string.IsNullOrEmpty(res.Errors)) { throw new Exception("warnings or errors not null"); } if (string.IsNullOrEmpty(res.Output) || res.Output != "ėšęįųšįęė\n") { throw new Exception("output is wrong"); } }
public void Do() { var tp = new TestProgram() { Name = "Go_Hello", Lang = Languages.Go, Program = @"package main import ""fmt"" func main() { fmt.Printf(""Hello, world!"") }", Args = "-o a.out source_file.go" }; var res = Logic.TestProgram(tp); if (!string.IsNullOrEmpty(res.Warnings) || !string.IsNullOrEmpty(res.Errors)) { throw new Exception("warnings or errors not null"); } if (string.IsNullOrEmpty(res.Output) || res.Output != "Hello, world!") { throw new Exception("output is wrong"); } }
public void Do() { var tp = new TestProgram() { Name = "C_Hello", Lang = Languages.C, Program = @"#include <stdio.h> int main(void) { printf(""Hello, world!""); return 0; }", Args = "-Wall -std=gnu99 -O2 -o a.out source_file.c" }; var res = Logic.TestProgram (tp); if (!string.IsNullOrEmpty (res.Warnings) || !string.IsNullOrEmpty (res.Errors)) { throw new Exception ("warnings or errors not null"); } if (string.IsNullOrEmpty (res.Output) || res.Output != "Hello, world!") { throw new Exception ("output is wrong"); } }
public void Do() { var tp = new TestProgram() { Name = "Objectivec_Hello", Lang = Languages.ObjectiveC, Program = @"//gcc 4.8.4 #import <stdio.h> int main(void) { printf(""Hello, world!""); return 0; } ", Args = "-MMD -MP -DGNUSTEP -DGNUSTEP_BASE_LIBRARY=1 -DGNU_GUI_LIBRARY=1 -DGNU_RUNTIME=1 -DGNUSTEP_BASE_LIBRARY=1 -fno-strict-aliasing -fexceptions -fobjc-exceptions -D_NATIVE_OBJC_EXCEPTIONS -pthread -fPIC -Wall -DGSWARN -DGSDIAGNOSE -Wno-import -g -O2 -fgnu-runtime -fconstant-string-class=NSConstantString -I. -I /usr/include/GNUstep -I/usr/include/GNUstep -o a.out source_file.m -lobjc -lgnustep-base" }; var res = Logic.TestProgram (tp); if (!string.IsNullOrEmpty (res.Warnings) || !string.IsNullOrEmpty (res.Errors)) { throw new Exception ("warnings or errors not null"); } if (string.IsNullOrEmpty (res.Output) || res.Output != "Hello, world!") { throw new Exception ("output is wrong"); } }
public void Do() { var tp = new TestProgram() { Name = "Go_Hello", Lang = Languages.Go, Program = @"package main import ""fmt"" func main() { fmt.Printf(""Hello, world!"") }", Args = "-o a.out source_file.go" }; var res = Logic.TestProgram (tp); if (!string.IsNullOrEmpty (res.Warnings) || !string.IsNullOrEmpty (res.Errors)) { throw new Exception ("warnings or errors not null"); } if (string.IsNullOrEmpty (res.Output) || res.Output != "Hello, world!") { throw new Exception ("output is wrong"); } }
public void Do() { var tp = new TestProgram() { Name = "C_Hello", Lang = Languages.C, Program = @"#include <stdio.h> int main(void) { printf(""Hello, world!""); return 0; }", Args = "-Wall -std=gnu99 -O2 -o a.out source_file.c" }; var res = Logic.TestProgram(tp); if (!string.IsNullOrEmpty(res.Warnings) || !string.IsNullOrEmpty(res.Errors)) { throw new Exception("warnings or errors not null"); } if (string.IsNullOrEmpty(res.Output) || res.Output != "Hello, world!") { throw new Exception("output is wrong"); } }
public void Do() { var tp = new TestProgram() { Name = "Ada_Hello", Lang = Languages.Ada, Program = @"with Ada.Text_IO; use Ada.Text_IO; procedure Hello is begin Put_Line (""Hello, world!""); end Hello;" }; var res = Logic.TestProgram(tp); if (!string.IsNullOrEmpty(res.Warnings) || !string.IsNullOrEmpty(res.Errors)) { throw new Exception("warnings or errors not null"); } if (string.IsNullOrEmpty(res.Output) || res.Output != "Hello, world!\n") { throw new Exception("output is wrong"); } }
public void Do() { var tp = new TestProgram() { Name = "Java_Hello", Lang = Languages.Java, Program = @"//Title of this code //'main' method must be in a class 'Rextester'. import java.util.*; import java.lang.*; import java.nio.charset.*; class Rextester { public static void main(String args[]) { System.out.println(""ėšęįųšįęė""); } }" }; var res = Logic.TestProgram (tp); if (!string.IsNullOrEmpty (res.Warnings) || !string.IsNullOrEmpty (res.Errors)) { throw new Exception ("warnings or errors not null"); } if (string.IsNullOrEmpty (res.Output) || res.Output != "ėšęįųšįęė\n") { throw new Exception ("output is wrong"); } }
public static OutputData TestProgram(TestProgram tp) { bool directly = false; if (directly) { return TestEngineDirectly (tp.Program, tp.Input, tp.Lang, tp.Args); } else { return TestEngineThroughService (tp.Program, tp.Input, tp.Lang, tp.Args); } }
public static OutputData TestProgram(TestProgram tp) { bool directly = false; if (directly) { return(TestEngineDirectly(tp.Program, tp.Input, tp.Lang, tp.Args)); } else { return(TestEngineThroughService(tp.Program, tp.Input, tp.Lang, tp.Args)); } }
public void Do() { var tp = new TestProgram() { Name = "Perl_Hello", Lang = Languages.Perl, Program = @"print ""Hello World"";" }; var res = Logic.TestProgram (tp); if (!string.IsNullOrEmpty (res.Warnings) || !string.IsNullOrEmpty (res.Errors)) { throw new Exception ("warnings or errors not null"); } if (string.IsNullOrEmpty (res.Output) || res.Output != "Hello World") { throw new Exception ("output is wrong"); } }
public void Do() { var tp = new TestProgram() { Name = "Scheme_Hello", Lang = Languages.Scheme, Program = @"(display ""Hello, World!"")" }; var res = Logic.TestProgram(tp); if (!string.IsNullOrEmpty(res.Warnings) || !string.IsNullOrEmpty(res.Errors)) { throw new Exception("warnings or errors not null"); } if (string.IsNullOrEmpty(res.Output) || res.Output != "Hello, World!") { throw new Exception("output is wrong"); } }
public void Do() { var tp = new TestProgram() { Name = "Scheme_Hello", Lang = Languages.Scheme, Program = @"(display ""Hello, World!"")" }; var res = Logic.TestProgram (tp); if (!string.IsNullOrEmpty (res.Warnings) || !string.IsNullOrEmpty (res.Errors)) { throw new Exception ("warnings or errors not null"); } if (string.IsNullOrEmpty (res.Output) || res.Output != "Hello, World!") { throw new Exception ("output is wrong"); } }
public void Do() { var tp = new TestProgram() { Name = "Ocaml_Hello", Lang = Languages.Ocaml, Program = @"print_string ""Hello world!\n"";;" }; var res = Logic.TestProgram(tp); if (!string.IsNullOrEmpty(res.Warnings) || !string.IsNullOrEmpty(res.Errors)) { throw new Exception("warnings or errors not null"); } if (string.IsNullOrEmpty(res.Output) || res.Output != "Hello world!\n") { throw new Exception("output is wrong"); } }
public void Do() { var tp = new TestProgram() { Name = "Javascript_Hello", Lang = Languages.Javascript, Program = @"print(""Hello, world!"")" }; var res = Logic.TestProgram (tp); if (!string.IsNullOrEmpty (res.Warnings) || !string.IsNullOrEmpty (res.Errors)) { throw new Exception ("warnings or errors not null"); } if (string.IsNullOrEmpty (res.Output) || res.Output != "Hello, world!\n") { throw new Exception ("output is wrong"); } }
public void Do() { var tp = new TestProgram() { Name = "Lisp_Hello", Lang = Languages.Lisp, Program = @"(print ""Hello, world!"")" }; var res = Logic.TestProgram(tp); if (!string.IsNullOrEmpty(res.Warnings) || !string.IsNullOrEmpty(res.Errors)) { throw new Exception("warnings or errors not null"); } if (string.IsNullOrEmpty(res.Output) || res.Output != "\n\"Hello, world!\" \n") { throw new Exception("output is wrong"); } }
public void Do() { var tp = new TestProgram() { Name = "Node_Hello", Lang = Languages.Nodejs, Program = @"console.log(""Hello, world!"");" }; var res = Logic.TestProgram(tp); if (!string.IsNullOrEmpty(res.Warnings) || !string.IsNullOrEmpty(res.Errors)) { throw new Exception("warnings or errors not null"); } if (string.IsNullOrEmpty(res.Output) || res.Output != "Hello, world!\n") { throw new Exception("output is wrong"); } }
public void Do() { var tp = new TestProgram() { Name = "Nasm_Hello", Lang = Languages.Nasm, Program = @"section .data hello: db 'Hello world!',10 ; 'Hello world!' plus a linefeed character helloLen: equ $-hello ; Length of the 'Hello world!' string ; (I'll explain soon) section .text global _start _start: mov eax,4 ; The system call for write (sys_write) mov ebx,1 ; File descriptor 1 - standard output mov ecx,hello ; Put the offset of hello in ecx mov edx,helloLen ; helloLen is a constant, so we don't need to say ; mov edx,[helloLen] to get it's actual value int 80h ; Call the kernel mov eax,1 ; The system call for exit (sys_exit) mov ebx,0 ; Exit with return code of 0 (no error) int 80h" }; var res = Logic.TestProgram (tp); if (!string.IsNullOrEmpty (res.Warnings) || !string.IsNullOrEmpty (res.Errors)) { throw new Exception ("warnings or errors not null"); } if (string.IsNullOrEmpty (res.Output) || res.Output != "Hello world!\n") { throw new Exception ("output is wrong"); } }
public void Do() { var tp = new TestProgram() { Name = "Haskell_Hello", Lang = Languages.Haskell, Program = @"main = print $ ""Hello, world!""", Args = "-o a.out source_file.hs" }; var res = Logic.TestProgram (tp); if (!string.IsNullOrEmpty (res.Warnings) || !string.IsNullOrEmpty (res.Errors)) { throw new Exception ("warnings or errors not null"); } if (string.IsNullOrEmpty (res.Output) || res.Output != "\"Hello, world!\"\n") { throw new Exception ("output is wrong"); } }
public void Do() { var tp = new TestProgram() { Name = "Elixir_Hello", Lang = Languages.Elixir, Program = @"IO.puts ""Hello, world!""", Input = "a" }; var res = Logic.TestProgram(tp); if (!string.IsNullOrEmpty(res.Warnings) || !string.IsNullOrEmpty(res.Errors)) { throw new Exception("warnings or errors not null"); } if (string.IsNullOrEmpty(res.Output) || res.Output != "Hello, world!\n") { throw new Exception("output is wrong"); } }
public void Do() { var tp = new TestProgram() { Name = "Elixir_Hello", Lang = Languages.Elixir, Program = @"IO.puts ""Hello, world!""", Input = "a" }; var res = Logic.TestProgram (tp); if (!string.IsNullOrEmpty (res.Warnings) || !string.IsNullOrEmpty (res.Errors)) { throw new Exception ("warnings or errors not null"); } if (string.IsNullOrEmpty (res.Output) || res.Output != "Hello, world!\n") { throw new Exception ("output is wrong"); } }
public void Do() { var tp = new TestProgram() { Name = "Nasm_Hello", Lang = Languages.Nasm, Program = @"section .data hello: db 'Hello world!',10 ; 'Hello world!' plus a linefeed character helloLen: equ $-hello ; Length of the 'Hello world!' string ; (I'll explain soon) section .text global _start _start: mov eax,4 ; The system call for write (sys_write) mov ebx,1 ; File descriptor 1 - standard output mov ecx,hello ; Put the offset of hello in ecx mov edx,helloLen ; helloLen is a constant, so we don't need to say ; mov edx,[helloLen] to get it's actual value int 80h ; Call the kernel mov eax,1 ; The system call for exit (sys_exit) mov ebx,0 ; Exit with return code of 0 (no error) int 80h" }; var res = Logic.TestProgram(tp); if (!string.IsNullOrEmpty(res.Warnings) || !string.IsNullOrEmpty(res.Errors)) { throw new Exception("warnings or errors not null"); } if (string.IsNullOrEmpty(res.Output) || res.Output != "Hello world!\n") { throw new Exception("output is wrong"); } }
public void Do() { var tp = new TestProgram() { Name = "F_Hello", Lang = Languages.FSharp, Program = @"open System printfn ""Hello, world!""" }; var res = Logic.TestProgram(tp); if (!string.IsNullOrEmpty(res.Warnings) || !string.IsNullOrEmpty(res.Errors)) { throw new Exception("warnings or errors not null"); } if (string.IsNullOrEmpty(res.Output) || res.Output != "Hello, world!\n") { throw new Exception("output is wrong"); } }
public void Do() { var tp = new TestProgram() { Name = "Haskell_Hello", Lang = Languages.Haskell, Program = @"main = print $ ""Hello, world!""", Args = "-o a.out source_file.hs" }; var res = Logic.TestProgram(tp); if (!string.IsNullOrEmpty(res.Warnings) || !string.IsNullOrEmpty(res.Errors)) { throw new Exception("warnings or errors not null"); } if (string.IsNullOrEmpty(res.Output) || res.Output != "\"Hello, world!\"\n") { throw new Exception("output is wrong"); } }
public void Do() { var tp = new TestProgram() { Name = "Rust_Hello", Lang = Languages.Rust, Program = @"fn main() { println!(""Hello, world!""); }" }; var res = Logic.TestProgram(tp); if (!string.IsNullOrEmpty(res.Warnings) || !string.IsNullOrEmpty(res.Errors)) { throw new Exception("warnings or errors not null"); } if (string.IsNullOrEmpty(res.Output) || res.Output != "Hello, world!\n") { throw new Exception("output is wrong"); } }
public void Do() { var tp = new TestProgram() { Name = "Scala_Hello", Lang = Languages.Scala, Program = @"object Rextester extends App { println(""Hello, World!"") }" }; var res = Logic.TestProgram (tp); if (!string.IsNullOrEmpty (res.Warnings) || !string.IsNullOrEmpty (res.Errors)) { throw new Exception ("warnings or errors not null"); } if (string.IsNullOrEmpty (res.Output) || res.Output != "Hello, World!\n") { throw new Exception ("output is wrong"); } }
public void Do() { var tp = new TestProgram() { Name = "Prolog_Hello", Lang = Languages.Prolog, Program = @"program :- write('Hello, world!'). :- program.", Input = "halt()." }; var res = Logic.TestProgram(tp); if (!string.IsNullOrEmpty(res.Warnings) || !string.IsNullOrEmpty(res.Errors)) { throw new Exception("warnings or errors not null"); } if (string.IsNullOrEmpty(res.Output) || res.Output != "Hello, world!") { throw new Exception("output is wrong"); } }
public void Do() { var tp = new TestProgram() { Name = "Scala_Hello", Lang = Languages.Scala, Program = @"object Rextester extends App { println(""Hello, World!"") }" }; var res = Logic.TestProgram(tp); if (!string.IsNullOrEmpty(res.Warnings) || !string.IsNullOrEmpty(res.Errors)) { throw new Exception("warnings or errors not null"); } if (string.IsNullOrEmpty(res.Output) || res.Output != "Hello, World!\n") { throw new Exception("output is wrong"); } }
public void Do() { var tp = new TestProgram() { Name = "Prolog_Hello", Lang = Languages.Prolog, Program = @"program :- write('Hello, world!'). :- program.", Input="halt()." }; var res = Logic.TestProgram (tp); if (!string.IsNullOrEmpty (res.Warnings) || !string.IsNullOrEmpty (res.Errors)) { throw new Exception ("warnings or errors not null"); } if (string.IsNullOrEmpty (res.Output) || res.Output != "Hello, world!") { throw new Exception ("output is wrong"); } }
public void Do() { var tp = new TestProgram() { Name = "Java_2classes", Lang = Languages.Java, Program = @" class Rextester { public static void main(String args[]) { System.out.println(new Foo()); (new java.util.Date()).getDate(); } } class Foo { public String toString() { String.format(""Foo!""); } }" }; var res = Logic.TestProgram(tp); if (!string.IsNullOrEmpty(res.Warnings)) { throw new Exception("warnings null"); } if (string.IsNullOrEmpty(res.Errors) || !res.Errors.Contains("missing return statement")) { throw new Exception("error is wrong"); } }
public void Do() { var tp = new TestProgram() { Name = "Java_2classes", Lang = Languages.Java, Program = @" class Rextester { public static void main(String args[]) { System.out.println(new Foo()); (new java.util.Date()).getDate(); } } class Foo { public String toString() { String.format(""Foo!""); } }" }; var res = Logic.TestProgram (tp); if (!string.IsNullOrEmpty (res.Warnings)) { throw new Exception ("warnings null"); } if (string.IsNullOrEmpty (res.Errors) || !res.Errors.Contains("missing return statement")) { throw new Exception ("error is wrong"); } }