\seekquarry\yioop\testsIndexShardTest

Used to test that the IndexShard class can properly add new documents and retrieve those documents by word. Checks that doc offsets can be updated, shards can be saved and reloaded

Summary

Methods
Properties
Constants
__construct()
run()
assertTrue()
assertFalse()
assertEqual()
assertNotEqual()
setUp()
tearDown()
addDocumentsGetPostingsSliceByIdTestCase()
addDocumentsGetPostingsSliceReverseTestCase()
addLinkGetPostingsSliceByIdTestCase()
appendIndexShardTestCase()
changeDocumentOffsetTestCase()
documentKeyTestCase()
saveLoadTestCase()
$test_case_results
$test_objects
case_name
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Constants

case_name

case_name

The suffix that all TestCase methods need to have to be called by run()

Properties

$test_case_results

$test_case_results : 

Used to store the results for each test sub case

Type

$test_objects

$test_objects : array

Used to hold objects to be used in tests

Type

array

Methods

__construct()

__construct() 

Contructor should be overriden to do any set up that occurs before and test cases

run()

run() : array

Execute each of the test cases of this unit test and return the results

Returns

array —

test case results

assertTrue()

assertTrue(mixed  $x, string  $description = "") 

Checks that $x can coerced to true, the result of the test is added to $this->test_case_results

Parameters

mixed $x

item to check

string $description

information about this test subcase

assertFalse()

assertFalse(mixed  $x, string  $description = "") 

Checks that $x can coerced to false, the result of the test is added to $this->test_case_results

Parameters

mixed $x

item to check

string $description

information about this test subcase

assertEqual()

assertEqual(mixed  $x, mixed  $y, string  $description = "") 

Checks that $x and $y are the same, the result of the test is added to $this->test_case_results

Parameters

mixed $x

a first item to compare

mixed $y

a second item to compare

string $description

information about this test subcase

assertNotEqual()

assertNotEqual(mixed  $x, mixed  $y, string  $description = "") 

Checks that $x and $y are not the same, the result of the test is added to $this->test_case_results

Parameters

mixed $x

a first item to compare

mixed $y

a second item to compare

string $description

information about this test subcase

setUp()

setUp() 

Construct some index shard we can add documents to

tearDown()

tearDown() 

Deletes any index shard files we may have created

addDocumentsGetPostingsSliceByIdTestCase()

addDocumentsGetPostingsSliceByIdTestCase() 

Check if can store documents into an index shard and retrieve them

addDocumentsGetPostingsSliceReverseTestCase()

addDocumentsGetPostingsSliceReverseTestCase() 

Check if can iterate over posting slices in the reverse direction To do this we construct two identical shards. We go over 'shard' ascendingly, while we go over 'shard4' descendingly and compare

addLinkGetPostingsSliceByIdTestCase()

addLinkGetPostingsSliceByIdTestCase() 

Check if can store link documents into an index shard and retrieve them

appendIndexShardTestCase()

appendIndexShardTestCase() 

Check that appending two index shards works correctly

changeDocumentOffsetTestCase()

changeDocumentOffsetTestCase() 

Check that changing document offsets works

documentKeyTestCase()

documentKeyTestCase() 

Used to test the functions related to add auxiliary document keys the document key of a document in an IndexShard.

saveLoadTestCase()

saveLoadTestCase() 

Check that save and load work