seek_quarry
[ class tree: seek_quarry ] [ index: seek_quarry ] [ all elements ]

Class: HashTableTest

Source Location: /tests/hash_table_test.php

Class Overview

UnitTest
   |
   --HashTableTest

Used to test that the HashTable class properly stores key value pairs, handles insert, deletes, collisions okay. It should also detect when table is full


Author(s):

  • Chris Pollett

Methods


Inherited Constants

Inherited Variables

Inherited Methods

Class: UnitTest

UnitTest::__construct()
Contructor should be overriden to do any set up that occurs before
UnitTest::assertEqual()
Checks that $x and $y are the same, the result of the test is added to $this->test_case_results
UnitTest::assertFalse()
Checks that $x can coerced to false, the result of the test is added to $this->test_case_results
UnitTest::assertNotEqual()
Checks that $x and $y are not the same, the result of the test is added to $this->test_case_results
UnitTest::assertTrue()
Checks that $x can coerced to true, the result of the test is added to $this->test_case_results
UnitTest::run()
Execute each of the test cases of this unit test and return the results
UnitTest::setUp()
This method is called before each test case is run to set up the
UnitTest::tearDown()
This method is called after each test case is run to clean up

Class Details

[line 54]
Used to test that the HashTable class properly stores key value pairs, handles insert, deletes, collisions okay. It should also detect when table is full



Tags:

author:  Chris Pollett


[ Top ]


Class Methods


method completeFillTestCase [line 121]

void completeFillTestCase( )

Completety fill table. Next insert should fail. Then delete all the

items. Then check that we can't find any of them




[ Top ]

method insertDeleteLookupTestCase [line 100]

void insertDeleteLookupTestCase( )

Checks insert an item, delete that item, then look it up. Make sure we don't find it after deletion.



[ Top ]

method insertLookupTestCase [line 82]

void insertLookupTestCase( )

Check if for the big hash table we insert something then later look it

up, that we in fact find it. Moreover, the value we associated with the insert key is as expected




[ Top ]

method reinsertCollisionAndIndexTestCase [line 168]

void reinsertCollisionAndIndexTestCase( )

First check that inserting an item twice does not change its index in

the table. Then inserts an item which should hash to the same value. So there is a collision which is resolved by linear offset. Check lookup of new item succeeds.Then delete first insert, check lookup of second insert still works. Check delete of second item, reinsert of first item and lookup. Index should change




[ Top ]

method setUp [line 61]

void setUp( )

We'll use two different tables one more representative of how the table

is going to be used by the web_queue_bundle, the other small enough that we can manually figure out what the result should be




Overrides UnitTest::setUp() (This method is called before each test case is run to set up the)

[ Top ]

method tearDown [line 71]

void tearDown( )

Since a HashTable is a PersistentStructure it periodically saves

itself to a file. To clean up we delete the files that might be created




Overrides UnitTest::tearDown() (This method is called after each test case is run to clean up)

[ Top ]


Documentation generated by phpDocumentor 1.4.3