Source for file ArithmeticFixture.php

Documentation is available at ArithmeticFixture.php

  1. <?php
  2.  
  3. # Copyright (c) 2002-2005 Cunningham & Cunningham, Inc.
  4. # Released under the terms of the GNU General Public License version 2 or later.
  5. #
  6. # PHP5 translation by Luis A. Floreani <luis.floreani@gmail.com>
  7.  
  8. require_once Fixture::INCLUDE_DIR . DIRECTORY_SEPARATOR . 'PrimitiveFixture.php';
  9.  
  10. class ArithmeticFixture extends PrimitiveFixture {
  11. public $x = 0;
  12. public $y = 0;
  13. public function doRows($rows) {
  14. parent::doRows($rows->more);
  15. }
  16.  
  17. public function doCell($cell, $column) {
  18. switch($column) {
  19. case 0:
  20. $this->x = intval($cell->text());
  21. break;
  22. case 1: $this->y = intval($cell->text());
  23. break;
  24. case 2:
  25. $this->check($cell, intval($this->x+$this->y)); break;
  26. case 3:
  27. $this->check($cell, intval($this->x-$this->y)); break;
  28. case 4:
  29. $this->check($cell, intval($this->x*$this->y)); break;
  30. case 5:
  31. if ($this->y == 0)
  32. throw new Exception("ArithmeticException: / by zero");
  33. $this->check($cell, intval($this->x/$this->y));
  34. break;
  35. default: break;
  36. }
  37. }
  38.  
  39. }
  40.  
  41. ?>

Documentation generated on Sun, 02 Apr 2006 16:01:02 +0200 by phpDocumentor 1.3.0RC5