def test_single_process(self): tt = Communication([1, "stub", "fifo_io"]) cc = tt.get_compilation_commands(["foo.%l"]) self.assertEqual(cc, { "L1": fake_compilation_commands( COMPILATION_COMMAND_1, ["stub.l1", "foo.l1"], "foo"), "L2": fake_compilation_commands( COMPILATION_COMMAND_2, ["stub.l2", "foo.l2"], "foo"), })
def test_std_io(self): # Compilation commands are the same regardless of whether we use # stdin/stdout or pipes. tt = Communication([1, "stub", "std_io"]) cc = tt.get_compilation_commands(["foo.%l"]) self.assertEqual(cc, { "L1": fake_compilation_commands( COMPILATION_COMMAND_1, ["stub.l1", "foo.l1"], "foo"), "L2": fake_compilation_commands( COMPILATION_COMMAND_2, ["stub.l2", "foo.l2"], "foo"), })
def test_no_stub(self): # Submissions can be compiled as stand-alone programs, with no # stubs. tt = Communication([1, "alone", "fifo_io"]) cc = tt.get_compilation_commands(["foo.%l"]) self.assertEqual(cc, { "L1": fake_compilation_commands( COMPILATION_COMMAND_1, ["foo.l1"], "foo"), "L2": fake_compilation_commands( COMPILATION_COMMAND_2, ["foo.l2"], "foo"), })
def test_two_processes(self): # Compilation commands are the same regardless of the number of # processes. tt = Communication([2, "stub", "fifo_io"]) cc = tt.get_compilation_commands(["foo.%l"]) self.assertEqual(cc, { "L1": fake_compilation_commands( COMPILATION_COMMAND_1, ["stub.l1", "foo.l1"], "foo"), "L2": fake_compilation_commands( COMPILATION_COMMAND_2, ["stub.l2", "foo.l2"], "foo"), })
def test_many_files(self): # Communication supports multiple files in the submission format, that # are just compiled together. tt = Communication([1, "stub", "fifo_io"]) cc = tt.get_compilation_commands(["foo.%l", "bar.%l"]) self.assertEqual(cc, { "L1": fake_compilation_commands( COMPILATION_COMMAND_1, ["stub.l1", "foo.l1", "bar.l1"], "bar_foo"), "L2": fake_compilation_commands( COMPILATION_COMMAND_2, ["stub.l2", "foo.l2", "bar.l2"], "bar_foo"), })