Login   Register  
PHP Classes
elePHPant
Icontem

File: test/BoardTest.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Amin Saeidi  >  Tic-Tac-Toe  >  test/BoardTest.php  >  Download  
File: test/BoardTest.php
Role: Unit test script
Content type: text/plain
Description: test
Class: Tic-Tac-Toe
Tic-Tac-Toe game using alpha beta search algorithm
Author: By
Last change:
Date: 2010-11-15 12:42
Size: 789 bytes
 

Contents

Class file image Download
<?php
require_once 'PHPUnit/Framework.php';
require_once 
'Board.php';

class 
BoardTest extends PHPUnit_Framework_TestCase
{
    
/**
     * @var Board
     */
    
protected $object;

    protected function 
setUp()
    {
        
$this->object = new Board(array(0, -101100, -10));
    }

    public function 
testCount()
    {
        
$this->assertEquals(9count($this->object));
    }

    public function 
testReset()
    {
        
$empty = array(000000000);
        
$this->assertEquals($this->object->reset()->get(), $empty);
    }

    public function 
testGet()
    {
        
$this->assertEquals($this->object->get(1), -1);
    }

    public function 
testSet()
    {
       
$this->object->set(21);
       
$this->assertEquals($this->object->get(2), 1);
    }
}