<commit_before>require 'thor'
require_relative '../ioc'
require_relative '../core/test_case_generator'
require_relative '../tasks/testing'
require_relative '../../commons/utils/colorize'

module Citac
  module Main
    module CLI
      class Test < Thor
        def initialize(*args)
          super

          @repo = ServiceLocator.specification_repository
          @spec_service = ServiceLocator.specification_service
          @exec_mgr = ServiceLocator.execution_manager
        end

        desc 'list <spec> <os>', 'Prints possible test cases for the given configuration specification.'
        def list(spec_id, os)
          spec, os, test_suite = load_test_suite spec_id, os

          case_count = 0
          step_count = 0
          test_suite.each do |test_case|
            case_count += 1
            step_count += test_case.steps.size

            puts "#{case_count}\t#{test_case}"
          end

          puts
          puts "#{test_suite.size} test cases (#{step_count} steps)."
        end

        desc 'get <spec> <os> <case>', 'Gets the specified test case for the given configuration specification.'
        def get(spec_id, os, case_id)
          spec, os, test_suite = load_test_suite spec_id, os

          test_case = test_suite[case_id.to_i - 1]
          puts test_case.to_yaml
        end<commit_msg>Implemented that by default test steps are not printed when listing test cases.<commit_after>require 'thor'
require_relative '../ioc'
require_relative '../core/test_case_generator'
require_relative '../tasks/testing'
require_relative '../../commons/utils/colorize'

module Citac
  module Main
    module CLI
      class Test < Thor
        def initialize(*args)
          super

          @repo = ServiceLocator.specification_repository
          @spec_service = ServiceLocator.specification_service
          @exec_mgr = ServiceLocator.execution_manager
        end

        option :steps, :type => :boolean, :aliases => :s, :desc => 'include detailed test steps'
        desc 'list <spec> <os>', 'Prints possible test cases for the given configuration specification.'
        def list(spec_id, os)
          spec, os, test_suite = load_test_suite spec_id, os

          case_count = 0
          step_count = 0
          test_suite.each do |test_case|
            case_count += 1
            step_count += test_case.steps.size

            if options[:steps]
              puts "#{case_count}\t#{test_case}"
            else
              puts "#{case_count}\t#{test_case.name}"
            end
          end

          puts
          puts "#{test_suite.size} test cases (#{step_count} steps)."
        end

        desc 'get <spec> <os> <case>', 'Gets the specified test case for the given configuration specification.'
        def get(spec_id, os, case_id)
          spec, os, test_suite = load_test_suite spec_id, os

          test_case = test_suite[case_id.to_i - 1]
          puts test_case.to_yaml
        end
{'fraction_non_alphanumeric': 0.09183327685530329, 'fraction_numerical': 0.0027109454422229754, 'mean_word_length': 2.236842105263158, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5418477', 'n_tokens_mistral': 842, 'n_tokens_neox': 829, 'n_words': 236}