<commit_before>require 'testing_env'
require 'pkg_version'

class PkgVersionTests < Homebrew::TestCase
  def v(version)
    PkgVersion.parse(version)
  end

  def test_parse
    assert_equal PkgVersion.new(Version.new("1.0"), 1), PkgVersion.parse("1.0_1")
    assert_equal PkgVersion.new(Version.new("1.0"), 1), PkgVersion.parse("1.0_1")
    assert_equal PkgVersion.new(Version.new("1.0"), 0), PkgVersion.parse("1.0")
    assert_equal PkgVersion.new(Version.new("1.0"), 0), PkgVersion.parse("1.0_0")
    assert_equal PkgVersion.new(Version.new("2.1.4"), 0), PkgVersion.parse("2.1.4_0")
    assert_equal PkgVersion.new(Version.new("2.1.4_1"), 0), PkgVersion.parse("2.1.4_1_0")
    assert_equal PkgVersion.new(Version.new("1.0.1e"), 1), PkgVersion.parse("1.0.1e_1")
  end

  def test_comparison
    assert_operator v("1.0_0"), :==, v("1.0")
    assert_operator v("1.0_1"), :==, v("1.0_1")
    assert_operator v("1.1"), :>, v("1.0_1")
    assert_operator v("1.0_0"), :==, v("1.0")
    assert_operator v("1.0_1"), :<, v("2.0_1")
    assert_operator v("HEAD"), :>, v("1.0")
    assert_operator v("1.0"), :<, v("HEAD")

    v = PkgVersion.new(Version.new("1.0"), 0)<commit_msg>test_pkg_version: remove illegal testcase<commit_after>require 'testing_env'
require 'pkg_version'

class PkgVersionTests < Homebrew::TestCase
  def v(version)
    PkgVersion.parse(version)
  end

  def test_parse
    assert_equal PkgVersion.new(Version.new("1.0"), 1), PkgVersion.parse("1.0_1")
    assert_equal PkgVersion.new(Version.new("1.0"), 1), PkgVersion.parse("1.0_1")
    assert_equal PkgVersion.new(Version.new("1.0"), 0), PkgVersion.parse("1.0")
    assert_equal PkgVersion.new(Version.new("1.0"), 0), PkgVersion.parse("1.0_0")
    assert_equal PkgVersion.new(Version.new("2.1.4"), 0), PkgVersion.parse("2.1.4_0")
    assert_equal PkgVersion.new(Version.new("1.0.1e"), 1), PkgVersion.parse("1.0.1e_1")
  end

  def test_comparison
    assert_operator v("1.0_0"), :==, v("1.0")
    assert_operator v("1.0_1"), :==, v("1.0_1")
    assert_operator v("1.1"), :>, v("1.0_1")
    assert_operator v("1.0_0"), :==, v("1.0")
    assert_operator v("1.0_1"), :<, v("2.0_1")
    assert_operator v("HEAD"), :>, v("1.0")
    assert_operator v("1.0"), :<, v("HEAD")

    v = PkgVersion.new(Version.new("1.0"), 0)
{'fraction_non_alphanumeric': 0.21140350877192982, 'fraction_numerical': 0.06842105263157895, 'mean_word_length': 4.549878345498784, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, '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': '5312444', 'n_tokens_mistral': 958, 'n_tokens_neox': 933, 'n_words': 134}