<commit_before>$:.unshift(File.dirname(__FILE__) + '/../lib')

require 'rubygems'

require 'test/unit'
require 'phonie'

def parse_test(raw, country_code, area_code, number, country_name = nil, is_mobile = nil)
  pn = Phonie::Phone.parse!(raw)
  assert_equal pn.country_code, country_code
  assert_equal pn.area_code, area_code
  assert_equal pn.number, number
  if country_name
    assert_equal pn.country.name, country_name
  end

  unless is_mobile.nil?
    assert_equal is_mobile, pn.is_mobile?
  end
end

def parse_failure(raw)
  pn = Phonie::Phone.parse!(raw)
  assert_equal pn, nil
end


class Phonie::TestCase < Test::Unit::TestCase

  def setup
    Phonie.configure do |config|
      config.default_country_code = nil
      config.default_area_code = nil
    end
  end<commit_msg>make is_mobile test response more friendly<commit_after>$:.unshift(File.dirname(__FILE__) + '/../lib')

require 'rubygems'

require 'test/unit'
require 'phonie'

def parse_test(raw, country_code, area_code, number, country_name = nil, is_mobile = nil)
  pn = Phonie::Phone.parse!(raw)
  assert_equal pn.country_code, country_code
  assert_equal pn.area_code, area_code
  assert_equal pn.number, number
  if country_name
    assert_equal pn.country.name, country_name
  end

  unless is_mobile.nil?
    text = pn.is_mobile? ? :mobile : :local
    assert_equal is_mobile ? :mobile : :local, text
  end
end

def parse_failure(raw)
  pn = Phonie::Phone.parse!(raw)
  assert_equal pn, nil
end

class Phonie::TestCase < Test::Unit::TestCase

  def setup
    Phonie.configure do |config|
      config.default_country_code = nil
      config.default_area_code = nil
    end
  end
{'fraction_non_alphanumeric': 0.10060240963855421, 'fraction_numerical': 0.0, 'mean_word_length': 4.223270440251572, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '6395714', 'n_tokens_mistral': 580, 'n_tokens_neox': 578, 'n_words': 136}