<commit_before>using NUnit.Framework;

namespace GlobalPhone.Tests
{
    [TestFixture(typeof(DefaultDeserializer), ForData.UseHash)]
    [TestFixture(typeof(DefaultDeserializer), ForData.UseArray)]
    [TestFixture(typeof(NewtonsoftDeserializer), ForData.UseArray)]
    public class NumberTest<Deserializer> : TestFixtureBase where Deserializer : IDeserializer, new()
    {
        public NumberTest(ForData forData)
            : base(forData)
        {
        }

        [TestFixtureSetUp]
        public void TestFixtureSetup()
        {
            _deserializer = new Deserializer();
        }
        [Test]
        public void valid_number()
        {
            var number = Context.Parse("(312) 555-1212");
            Assert.That(number.IsValid);
        }
        [Test]
        public void invalid_number()
        {
            var number = Context.Parse("555-1212");
            Assert.That(!number.IsValid);
        }
        [Test]
        public void country_code()
        {
            var number = Context.Parse("(312) 555-1212");
            Assert.That(number.CountryCode, Is.EqualTo("1"));

            number = Context.Parse("+44 (0) 20-7031-3000");
            Assert.That(number.CountryCode, Is.EqualTo("44"));
        }
        [Test]
        public void region()
        {
            var number = Context.Parse("(312) 555-1212");
            Assert.That(number.Region, Is.EqualTo(Db.TryGetRegion(1)));

            number = Context.Parse("+44 (0) 20-7031-3000");
            Assert.That(number.Region, Is.EqualTo(Db.TryGetRegion(44)));
        }
        [Test]
        public void territory()
        {
            var number = Context.Parse("(312) 555-1212");
            Assert.That(number.Territory, Is.EqualTo(Db.TryGetTerritory("us")));

            number = Context.Parse("+44 (0) 20-7031-3000");
            Assert.That(number.Territory, Is.EqualTo(Db.TryGetTerritory("gb")));
        }

        [Test]
        public void national_string()
        {
            var number = Context.Parse("(312) 555-1212");
            Assert.That(number.NationalString, Is.EqualTo("3125551212"));
        }
        [Test]
        public void national_format()
        {
            var number = Context.Parse("312-555-1212");
            Assert.That(number.NationalFormat, Is.EqualTo("(312) 555-1212"));
        }

        [Test]
        public void national_format_gb()
        {
            var number = Context.Parse("07411 111111", "gb");
            Assert.That(number.NationalFormat, Is.EqualTo("074 1111 1111"));
        }

        [Test]
        public void international_string()
        {
            var number = Context.Parse("(312) 555-1212");
            Assert.That(number.InternationalString, Is.EqualTo("+13125551212"));
            Assert.That(number.ToString(), Is.EqualTo(number.InternationalString));
        }
        [Test]
        public void international_format()
        {
            var number = Context.Parse("(312) 555-1212");
            Assert.That(number.InternationalFormat, Is.EqualTo("+1 312-555-1212"));
        }
        [Test]
        public void area_code()
        {
            var number = Context.Parse("+61 3 9876 0010");
            Assert.AreEqual("03", number.AreaCode);
            number = Context.Parse("+44 (0) 20-7031-3000");
            Assert.AreEqual("020", number.AreaCode);
            // Hong Kong has no area code
            number = Context.Parse("+852 2699 2838");
            Assert.IsNull(number.AreaCode);
        }
        [Test]
        public void local_number()
        {
            var number = Context.Parse("+61 3 9876 0010");
            Assert.AreEqual("9876 0010", number.LocalNumber);

            number = Context.Parse("+44 (0) 20-7031-3000");
            Assert.AreEqual("7031 3000", number.LocalNumber);

            number = Context.Parse("+852 2699 2838");
            Assert.AreEqual("2699 2838", number.LocalNumber);
        }
    }
}<commit_msg>Adding tests for US numbers<commit_after>using NUnit.Framework;

namespace GlobalPhone.Tests
{
    [TestFixture(typeof(DefaultDeserializer), ForData.UseHash)]
    [TestFixture(typeof(DefaultDeserializer), ForData.UseArray)]
    [TestFixture(typeof(NewtonsoftDeserializer), ForData.UseArray)]
    public class NumberTest<Deserializer> : TestFixtureBase where Deserializer : IDeserializer, new()
    {
        public NumberTest(ForData forData)
            : base(forData)
        {
        }

        [TestFixtureSetUp]
        public void TestFixtureSetup()
        {
            _deserializer = new Deserializer();
        }
        [Test]
        public void valid_number()
        {
            var number = Context.Parse("(312) 555-1212");
            Assert.That(number.IsValid);
        }
        [Test]
        public void invalid_number()
        {
            var number = Context.Parse("555-1212");
            Assert.That(!number.IsValid);
        }
        [Test]
        public void country_code()
        {
            var number = Context.Parse("(312) 555-1212");
            Assert.That(number.CountryCode, Is.EqualTo("1"));

            number = Context.Parse("+44 (0) 20-7031-3000");
            Assert.That(number.CountryCode, Is.EqualTo("44"));
        }
        [Test]
        public void region()
        {
            var number = Context.Parse("(312) 555-1212");
            Assert.That(number.Region, Is.EqualTo(Db.TryGetRegion(1)));

            number = Context.Parse("+44 (0) 20-7031-3000");
            Assert.That(number.Region, Is.EqualTo(Db.TryGetRegion(44)));
        }
        [Test]
        public void territory()
        {
            var number = Context.Parse("(312) 555-1212");
            Assert.That(number.Territory, Is.EqualTo(Db.TryGetTerritory("us")));

            number = Context.Parse("+44 (0) 20-7031-3000");
            Assert.That(number.Territory, Is.EqualTo(Db.TryGetTerritory("gb")));
        }

        [Test]
        public void national_string()
        {
            var number = Context.Parse("(312) 555-1212");
            Assert.That(number.NationalString, Is.EqualTo("3125551212"));
        }
        [Test]
        public void national_format()
        {
            var number = Context.Parse("312-555-1212");
            Assert.That(number.NationalFormat, Is.EqualTo("(312) 555-1212"));
        }

        [Test]
        public void national_format_gb()
        {
            var number = Context.Parse("07411 111111", "gb");
            Assert.That(number.NationalFormat, Is.EqualTo("074 1111 1111"));
        }

        [Test]
        public void international_string()
        {
            var number = Context.Parse("(312) 555-1212");
            Assert.That(number.InternationalString, Is.EqualTo("+13125551212"));
            Assert.That(number.ToString(), Is.EqualTo(number.InternationalString));
        }
        [Test]
        public void international_format()
        {
            var number = Context.Parse("(312) 555-1212");
            Assert.That(number.InternationalFormat, Is.EqualTo("+1 312-555-1212"));
        }
        [Test]
        public void area_code()
        {
            var number = Context.Parse("+61 3 9876 0010");
            Assert.AreEqual("03", number.AreaCode);
            number = Context.Parse("+44 (0) 20-7031-3000");
            Assert.AreEqual("020", number.AreaCode);
            // Hong Kong has no area code
            number = Context.Parse("+852 2699 2838");
            Assert.IsNull(number.AreaCode);
        }
        [Test]
        public void local_number()
        {
            var number = Context.Parse("+61 3 9876 0010");
            Assert.AreEqual("9876 0010", number.LocalNumber);

            number = Context.Parse("+44 (0) 20-7031-3000");
            Assert.AreEqual("7031 3000", number.LocalNumber);

            number = Context.Parse("+852 2699 2838");
            Assert.AreEqual("2699 2838", number.LocalNumber);
        }

        [Test]
        public void testFormatUSNumber()
        {
            var US_NUMBER = Context.Parse("+16502530000");
            var US_TOLLFREE = Context.Parse("+18002530000");
            var US_PREMIUM = Context.Parse("+19002530000");
            Assert.AreEqual("(650) 253-0000",
                         US_NUMBER.NationalFormat);
            Assert.AreEqual("+1 650-253-0000",
                         US_NUMBER.InternationalFormat);

            Assert.AreEqual("(800) 253-0000",
                         US_TOLLFREE.NationalFormat);
            Assert.AreEqual("+1 800-253-0000",
                         US_TOLLFREE.InternationalFormat);

            Assert.AreEqual("(900) 253-0000",
                         US_PREMIUM.NationalFormat);
            Assert.AreEqual("+1 900-253-0000",
                         US_PREMIUM.InternationalFormat);
        }

    }
}
{'fraction_non_alphanumeric': 0.13022727272727272, 'fraction_numerical': 0.07795454545454546, 'mean_word_length': 1.8865201705477206, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '5155140', 'n_tokens_mistral': 2961, 'n_tokens_neox': 2479, 'n_words': 447}