Sha256: 80573b26dddbca73fb64e235e257d6aee396c8e7a14bef8ecf0e4f8eff594758
Contents?: true
Size: 1.02 KB
Versions: 11
Compression:
Stored size: 1.02 KB
Contents
package bae; import bae.Document; import org.junit.Test; import java.util.Map; import static org.junit.Assert.*; public class DocumentTest { @Test public void testCanCreateAccurateFrequencyTable() { Document document = new Document("aaa bbb aaa bbb ccc"); Map<String, Long> frequencyMap = document.getFrequencyMap(); assertEquals(2, (long)frequencyMap.get("aaa")); assertEquals(2, (long)frequencyMap.get("bbb")); assertEquals(1, (long)frequencyMap.get("ccc")); } @Test public void testCanParseADirtyString() { Document document = new Document(" a aaa\ta \t\t\t aa a bbb a aaa bbb ccc "); Map<String, Long> frequencyMap = document.getFrequencyMap(); assertEquals(2, (long)frequencyMap.get("aaa")); assertEquals(2, (long)frequencyMap.get("bbb")); assertEquals(1, (long)frequencyMap.get("ccc")); assertEquals(1, (long)frequencyMap.get("aa")); assertEquals(4, (long)frequencyMap.get("a")); } }
Version data entries
11 entries across 11 versions & 1 rubygems