Ignore:
Timestamp:
Aug 7, 2011, 5:22:38 PM (14 years ago)
Author:
cla
Message:

rdfint

  • added execution of positive parser tests
  • added exception list
File:
1 edited

Legend:

Unmodified
Added
Removed
  • php/trunk/unittest/rdftestcases/rdftestcases.php

    r64 r65  
    2525
    2626  private $rdfDataManifest;
     27  private $exceptions;
    2728
    2829  // --------------------------------------------------------
     
    3132
    3233    $remoteManifest = 'http://www.w3.org/2000/10/rdf-tests/rdfcore/Manifest.rdf';
    33     $localManifest  = 'Manifest.rdf';
     34    $localManifest  = getenv('tmp').'/RDFTestcases_Manifest.rdf';
    3435
    3536    $aNamespace = array( 'rdf'      => 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
     
    4950    }
    5051    $result = $this->rdfDataManifest->parse( $localManifest);
     52
     53    // load exception list
     54    $this->exceptions = explode( "\r\n", file_get_contents( 'exception.lst'));
    5155
    5256  } // public function __construct
     
    7781
    7882    // create name attribute from URI
     83    // unshring URI values
    7984    foreach ($testcases as $testcase) {
    8085      $testcase->name = $this->_caseNameFromSubject( $testcase->getSubject());
     86      $testcase->input      = $this->rdfDataManifest->_resolve( $testcase->input);
     87      $testcase->output     = $this->rdfDataManifest->_resolve( $testcase->output);
     88      $testcase->conclusion = $this->rdfDataManifest->_resolve( $testcase->conclusion);
    8189    }
    8290
     
    98106    $testcases = array();
    99107    foreach ( $uriTestcases as $uriTestcase) {
     108
     109      // don't execute if in exception list
     110      if (array_search( $this->_caseNameFromSubject( $uriTestcase), $this->exceptions) !== false)
     111        continue;
     112
     113
    100114      if ($this->rdfDataManifest->_getFirstValue( $uriTestcase, 'test:status') == 'APPROVED')
    101115        $testcases[] = $uriTestcase;
     
    104118    return $testcases;
    105119
    106   } // private function _searchApprovedTestcases
     120  } // private function _getApprovedTestcaseSubjects
    107121
    108122
    109123  private function _countApprovedTestcases( $category) {
    110124
    111     $uriTestcases = $this->rdfDataManifest->getSubjects( 'rdf:type', "test:$category");
    112     $count = 0;
    113     foreach ( $uriTestcases as $uriTestcase) {
    114       if ($this->rdfDataManifest->_getFirstValue( $uriTestcase, 'test:status') == 'APPROVED')
    115         $count += 1;
    116     }
    117 
    118     return $count;
     125    return count( $this->_getApprovedTestcaseSubjects( $category));
    119126
    120127  } // private function _countApprovedTestcases
     
    166173        }
    167174      echo "$count cases for: $category\n\n";
    168 
    169175      } else {
    170176        $count = $this->_countApprovedTestcases( $category);
    171177        echo "   $category     $count cases\n";
    172178      }
    173 
    174 
    175179    }
    176180
Note: See TracChangeset for help on using the changeset viewer.