<commit_before>#!/usr/bin/ruby -w
# -*- ruby -*-

require 'tc'
require 'svnx/log/entries'
require 'svnx/revision/argument'
require 'resources'

module SVNx::Revision
  class ArgumentFactoryTestCase < SVNx::TestCase
    def setup
      xmllines = Resources::PT_LOG_R22_13_SECONDFILE_TXT.readlines
      @entries = SVNx::Log::Entries.new :xmllines => xmllines
    end

    def test_create
      arg = ArgumentFactory.new.create 14, entries: @entries
      assert_not_nil arg
    end

    def test_index_argument
      arg = ArgumentFactory.new.create 14, entries: @entries
      assert_kind_of IndexArgument, arg
    end

    def test_string_svn_words
      %w{ HEAD BASE COMMITTED PREV }.each do |word|
        arg = ArgumentFactory.new.create word, entries: @entries
        assert_kind_of StringArgument, arg
      end
    end

    def test_date
      arg = ArgumentFactory.new.create '{2012-12-10}', entries: @entries
      assert_kind_of StringArgument, arg
    end

    def test_relative_argument
      arg = ArgumentFactory.new.create(-4, entries: @entries)
      assert_kind_of IndexArgument, arg
      assert_equal 15, arg.value
    end
  end
end
<commit_msg>Added test for argument factory.<commit_after>#!/usr/bin/ruby -w
# -*- ruby -*-

require 'tc'
require 'svnx/log/entries'
require 'svnx/revision/argument'
require 'resources'

module SVNx::Revision
  class ArgumentFactoryTestCase < SVNx::TestCase
    def setup
      xmllines = Resources::PT_LOG_R22_13_SECONDFILE_TXT.readlines
      @entries = SVNx::Log::Entries.new :xmllines => xmllines
    end

    def test_create
      arg = ArgumentFactory.new.create 14, entries: @entries
      assert_not_nil arg
    end

    def test_index_argument
      arg = ArgumentFactory.new.create 14, entries: @entries
      assert_kind_of IndexArgument, arg
    end

    def test_string_svn_words
      %w{ HEAD BASE COMMITTED PREV }.each do |word|
        arg = ArgumentFactory.new.create word, entries: @entries
        assert_kind_of StringArgument, arg
      end
    end

    def test_date
      arg = ArgumentFactory.new.create '{2012-12-10}', entries: @entries
      assert_kind_of StringArgument, arg
    end

    def test_relative_argument_fixnum
      arg = ArgumentFactory.new.create(-4, entries: @entries)
      assert_kind_of IndexArgument, arg
      assert_equal 15, arg.value
    end

    def test_relative_argument_string
      arg = ArgumentFactory.new.create('-4', entries: @entries)
      assert_kind_of IndexArgument, arg
      assert_equal 15, arg.value
    end
  end
end

{'fraction_non_alphanumeric': 0.08300550747442959, 'fraction_numerical': 0.016129032258064516, 'mean_word_length': 3.081861958266453, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, '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': '5439895', 'n_tokens_mistral': 842, 'n_tokens_neox': 792, 'n_words': 201}