You are here

function PorterStemmerInternalsUnitTest::testAdministered in Porter-Stemmer 6.2

Same name and namespace in other branches
  1. 7 porterstemmer.test \PorterStemmerInternalsUnitTest::testAdministered()

Test internal steps on the word "administered".

File

./porterstemmer.test, line 633
Tests for the Porter Stemmer module. By Jennifer Hodgdon of Poplar ProductivityWare, www.poplarware.com Unit tests are based on sample words from http://snowball.tartarus.org/algorithms/english/stemmer.html which are stored in a separate file…

Class

PorterStemmerInternalsUnitTest
Unit tests for Porter Stemmer - Stemming internals.

Code

function testAdministered() {
  variable_set('minimum_word_size', 2);
  porterstemmer_too_short('', TRUE);
  $r1 = 0;
  $r2 = 0;
  $word = 'administered';
  porterstemmer_prestemming($word, $r1, $r2);

  // Test calculation of R1 and R2
  $this
    ->assertEqual($r1, 2, "R1 for administered should be 2, was {$r1}", 'Stemmer steps');
  $this
    ->assertEqual($r2, 5, "R2 for administered should be 5, was {$r2}", 'Stemmer steps');

  // Test step 1b of the algorithm
  porterstemmer_step1b($word, $r1);
  $this
    ->assertEqual($word, 'administer', "Step1b should be administer, was {$word}", 'Stemmer steps');

  // Test step 4 of the algorithm
  porterstemmer_step4($word, $r2);
  $this
    ->assertEqual($word, 'administ', "Step4 should be administ, was {$word}", 'Stemmer steps');
}