Ejemplo n.º 1
0
    def test_given_a_configuration_file(self):
        command_line = ["execute", "-c", "config.yml"]

        command = Command.extract_from(command_line)

        self.assertIsInstance(command, Execute)
        self.assertEqual("config.yml", command.configuration_file)
Ejemplo n.º 2
0
    def test_given_all_configurations(self):
        command_line = "realize --output output"

        command = Command.extract_from(command_line.split())

        self.assertIsInstance(command, Realize)
        self.assertEqual(command.output_directory, "output")
Ejemplo n.º 3
0
    def test_given_atomic_mode(self):
        command_line = "generate --mode atomic"

        command = Command.extract_from(command_line.split())

        self.assertIsInstance(command, Generate)
        self.assertEquals(command.mode, Generate.ATOMIC)
Ejemplo n.º 4
0
    def test_given_working_directory(self):
        command_line = "realize -d my/test/directory"

        command = Command.extract_from(command_line.split())

        self.assertIsInstance(command, Realize)
        self.assertEqual(command.working_directory, "my/test/directory")
Ejemplo n.º 5
0
    def test_with_the_simulation_option(self):
        command_line = ["execute", "-s"]

        command = Command.extract_from(command_line)

        self.assertIsInstance(command, Execute)
        self.assertEqual(True, command.is_simulated)
Ejemplo n.º 6
0
    def test_given_all_configurations_mode(self):
        command_line = "generate --mode all"

        command = Command.extract_from(command_line.split())

        self.assertIsInstance(command, Generate)
        self.assertEquals(command.mode, Generate.ALL)
Ejemplo n.º 7
0
    def test_given_an_output_directory(self):
        command_line = "realize -o output"

        command = Command.extract_from(command_line.split())

        self.assertIsInstance(command, Realize)
        self.assertEqual(command.output_directory, "output")
Ejemplo n.º 8
0
 def realize(self):
     camp = Camp(YAML(), Z3Problem, Builder())
     command = Command.extract_from([
         "realize", "-d", self._input_directory, "-o",
         self._output_directory
     ])
     command.send_to(camp)
Ejemplo n.º 9
0
    def test_given_no_working_directory(self):
        command_line = "generate -d my/directory"

        command = Command.extract_from(command_line.split())

        self.assertIsInstance(command, Generate)
        self.assertEqual(command.mode, Generate.DEFAULT_MODE)
Ejemplo n.º 10
0
    def test_given_working_directory(self):
        command_line = "generate --directory my/test/directory"

        command = Command.extract_from(command_line.split())

        self.assertIsInstance(command, Generate)
        self.assertEqual(command.working_directory, "my/test/directory")
Ejemplo n.º 11
0
    def test_given_covering_mode(self):
        command_line = "generate --mode covering"

        command = Command.extract_from(command_line.split())

        self.assertIsInstance(command, Generate)
        self.assertTrue(command.mode, Generate.COVERING)
Ejemplo n.º 12
0
    def test_with_the_include_option(self):
        command_line = ["execute", "-i", "1", "2", "3", "4"]

        command = Command.extract_from(command_line)

        self.assertIsInstance(command, Execute)
        self.assertEqual([1, 2, 3, 4], command.included_configurations)
Ejemplo n.º 13
0
    def test_given_all_configurations(self):
        command_line = "generate --all"

        command = Command.extract_from(command_line.split())

        self.assertIsInstance(command, Generate)
        self.assertFalse(command.only_coverage)
Ejemplo n.º 14
0
    def test_given_only_coverage(self):
        command_line = "generate --coverage"

        command = Command.extract_from(command_line.split())

        self.assertIsInstance(command, Generate)
        self.assertTrue(command.only_coverage)
Ejemplo n.º 15
0
    def test_given_no_working_directory(self):
        command_line = "realize -o output"

        command = Command.extract_from(command_line.split())

        self.assertIsInstance(command, Realize)
        self.assertEqual(command.working_directory,
                         Realize.DEFAULT_WORKING_DIRECTORY)
Ejemplo n.º 16
0
    def test_with_the_include_option(self):
        command_line = ["execute"]

        command = Command.extract_from(command_line)

        self.assertIsInstance(command, Execute)
        self.assertEqual(Execute.DEFAULT_INCLUDED,
                         command.included_configurations)
Ejemplo n.º 17
0
    def test_given_no_output_directory(self):
        command_line = "realize -d workspace"

        command = Command.extract_from(command_line.split())

        self.assertIsInstance(command, Realize)
        self.assertEqual(command.output_directory,
                         Realize.DEFAULT_OUTPUT_DIRECTORY)
Ejemplo n.º 18
0
    def test_when_no_argument_is_given(self):
        command_line = ["execute"]

        command = Command.extract_from(command_line)

        self.assertIsInstance(command, Execute)
        self.assertEqual(Execute.DEFAULT_CONFIGURATION_FILE,
                         command.configuration_file)
Ejemplo n.º 19
0
    def test_given_no_parameters(self):
        command_line = "generate --mode  all"

        command = Command.extract_from(command_line.split())

        self.assertIsInstance(command, Generate)
        self.assertEqual(command.working_directory,
                         Generate.DEFAULT_WORKING_DIRECTORY)
Ejemplo n.º 20
0
    def test_given_working_directory(self):
        command = Command.extract_from(self._command_line)

        self.assertIsInstance(command, Execute)
        self.assertEqual(command.working_directory,
                         Execute.DEFAULT_WORKING_DIRECTORY)
Ejemplo n.º 21
0
    def test_with_the_simulation_option(self):
        command = Command.extract_from(self._command_line)

        self.assertIsInstance(command, Execute)
        self.assertEqual(Execute.DEFAULT_IS_SIMULATED, command.is_simulated)
Ejemplo n.º 22
0
    def test_when_no_argument_is_given(self):
        command = Command.extract_from(self._command_line)

        self.assertIsInstance(command, Execute)
        self.assertEqual(Execute.DEFAULT_IS_SIMULATED, command.is_simulated)
Ejemplo n.º 23
0
 def realize(self):
     camp = Camp(YAML(), Z3Problem, Builder())
     command = Command.extract_from([
         "realize", "-d", self.INPUT_DIRECTORY, "-o", self.OUTPUT_DIRECTORY
     ])
     command.send_to(camp)
Ejemplo n.º 24
0
 def invoke_camp_generate(self, mode=Generate.ALL):
     camp = Camp(YAML(), Z3Problem, Builder())
     command = Command.extract_from(
         ["generate", "--mode", mode, "-d", self._working_directory])
     command.send_to(camp)
Ejemplo n.º 25
0
    def test_given_working_directory(self):
        command_line = "--version"

        command = Command.extract_from(command_line.split())

        self.assertIsInstance(command, ShowVersions)
Ejemplo n.º 26
0
    def test_given_the_shortcut(self):
        command_line = "-v"

        command = Command.extract_from(command_line.split())

        self.assertIsInstance(command, ShowVersions)
Ejemplo n.º 27
0
def main():
    camp = Camp(YAML(), Z3Problem, Builder())
    command = Command.extract_from(argv[1:])
    command.send_to(camp)
Ejemplo n.º 28
0
 def camp(*arguments):
     camp = Camp(YAML(), Z3Problem, Builder())
     command = Command.extract_from(arguments)
     command.send_to(camp)
Ejemplo n.º 29
0
def _parse(text):
    return Command.extract_from(text.split())