示例#1
0
 public function test_letter_frequency()
 {
     $words = new MapOfStrings(explode(' ', 'the cat in the hat'));
     $freqs = $words->letter_frequency();
     $this->assertInstanceOf('\\Haldayne\\Boost\\MapOfInts', $freqs);
     $this->assertEquals(['a' => 2, 'c' => 1, 'e' => 2, 'h' => 3, 'i' => 1, 'n' => 1, 't' => 4], $freqs->toArray());
 }