public void Numbers_dont_count() { var input = new[] { "Testing, 1, 2, 3" }; var actual = ParallelLetterFrequency.Calculate(input); Assert.False(actual.ContainsKey('1')); }
public void Punctuation_doesnt_count() { var input = new[] { OdeAnDieFreude }; var actual = ParallelLetterFrequency.Calculate(input); Assert.False(actual.ContainsKey(',')); }
public void ShortTexts() { var input = Enumerable.Repeat("abc", 10_000_000); var actual = ParallelLetterFrequency.Calculate(input); var expected = new Dictionary <char, int> { { 'a', 10_000_000 },
public void Many_empty_texts_still_mean_no_letters() { var input = Enumerable.Repeat(" ", 10000); var actual = ParallelLetterFrequency.Calculate(input); var expected = new Dictionary <char, int>(); Assert.Equal(expected, actual); }
public void No_texts_mean_no_letters() { var input = Enumerable.Empty <string>(); var actual = ParallelLetterFrequency.Calculate(input); var expected = new Dictionary <char, int>(); Assert.Equal(expected, actual); }
public void All_three_anthems_together() { var input = new[] { OdeAnDieFreude, Wilhelmus, StarSpangledBanner }; var actual = ParallelLetterFrequency.Calculate(input); Assert.Equal(49, actual['a']); Assert.Equal(56, actual['t']); Assert.Equal(2, actual['ü']); }
public void CalculateSlowerTest() { var input = Enumerable.Repeat(new[] { OdeAnDieFreude, Wilhelmus, StarSpangledBanner }, 10_000).SelectMany(t => t); var actual = ParallelLetterFrequency.CalculateSlower(input); Assert.Equal(490000, actual['a']); Assert.Equal(560000, actual['t']); Assert.Equal(20000, actual['ü']); }
public void Case_insensitivity() { var input = new[] { "aA" }; var actual = ParallelLetterFrequency.Calculate(input); var expected = new Dictionary <char, int> { { 'a', 2 } }; Assert.Equal(expected, actual); }
public void One_letter() { var input = new[] { "a" }; var actual = ParallelLetterFrequency.Calculate(input); var expected = new Dictionary <char, int> { { 'a', 1 } }; Assert.Equal(expected, actual); }
public void One_letter() { var input = new[] { "a" }; var actual = ParallelLetterFrequency.Calculate(input); var expected = new Dictionary <char, int> { { 'a', 1 } }; Assert.That(actual, Is.EquivalentTo(expected)); }
public void Many_times_the_same_text_gives_a_predictable_result() { var input = Enumerable.Repeat("abc", 1000); var actual = ParallelLetterFrequency.Calculate(input); var expected = new Dictionary <char, int> { { 'a', 1000 }, { 'b', 1000 }, { 'c', 1000 } }; Assert.Equal(expected, actual); }