Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix and add another unit test for issue #1
- Loading branch information
Showing
2 changed files
with
94 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
--TEST-- | ||
Check for Judy count() method when two instances INT_TO_INT are declared | ||
--SKIPIF-- | ||
<?php if (!extension_loaded("judy")) print "skip"; ?> | ||
--FILE-- | ||
<?php | ||
/* | ||
Ref. https://github.com/orieg/php-judy/issues/1 | ||
*/ | ||
|
||
echo "Instantiate first object: \$judy1\n"; | ||
$judy1 = new Judy(Judy::INT_TO_INT); | ||
echo "Instantiate second object: \$judy2\n"; | ||
$judy2 = new Judy(Judy::INT_TO_INT); | ||
|
||
echo "Test Size Zero\n"; | ||
echo "\$judy1->count(): ". $judy1->count()."\n"; | ||
echo "\$judy2->count(): ". $judy2->count()."\n"; | ||
|
||
echo "Test Size Consistent\n"; | ||
$judy1[0] = 1; | ||
$judy1[1] = 2; | ||
|
||
echo "\$judy1->count(): ". $judy1->count()."\n"; | ||
echo "\$judy2->count(): ". $judy2->count()."\n"; | ||
|
||
echo "Test Size Sum\n"; | ||
$judy2[0] = 3; | ||
echo "\$judy1->count(): ". $judy1->count()."\n"; | ||
echo "\$judy2->count(): ". $judy2->count()."\n"; | ||
|
||
unset($judy1); | ||
unset($judy2); | ||
|
||
?> | ||
--EXPECT-- | ||
Instantiate first object: $judy1 | ||
Instantiate second object: $judy2 | ||
Test Size Zero | ||
$judy1->count(): 0 | ||
$judy2->count(): 0 | ||
Test Size Consistent | ||
$judy1->count(): 2 | ||
$judy2->count(): 0 | ||
Test Size Sum | ||
$judy1->count(): 2 | ||
$judy2->count(): 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
--TEST-- | ||
Check for Judy count() and count() method when two instances STRING_TO_MIXED are declared | ||
--SKIPIF-- | ||
<?php if (!extension_loaded("judy")) print "skip"; ?> | ||
--FILE-- | ||
<?php | ||
/* | ||
Ref. https://github.com/orieg/php-judy/issues/1 | ||
*/ | ||
|
||
echo "Instantiate first object: \$judy1\n"; | ||
$judy1 = new Judy(Judy::STRING_TO_MIXED); | ||
echo "Instantiate second object: \$judy2\n"; | ||
$judy2 = new Judy(Judy::STRING_TO_MIXED); | ||
|
||
echo "Test Size Zero\n"; | ||
echo "\$judy1->count(): ". $judy1->count()."\n"; | ||
echo "\$judy2->count(): ". $judy2->count()."\n"; | ||
|
||
echo "Test Size Consistent\n"; | ||
$judy1->offsetSet("foo", "bar"); | ||
$judy1->offsetSet("another", "value"); | ||
|
||
echo "\$judy1->count(): ". $judy1->count()."\n"; | ||
echo "\$judy2->count(): ". $judy2->count()."\n"; | ||
|
||
echo "Test Size Sum\n"; | ||
$judy2->offsetSet("third", ".."); | ||
echo "\$judy1->count(): ". $judy1->count()."\n"; | ||
echo "\$judy2->count(): ". $judy2->count()."\n"; | ||
|
||
unset($judy1); | ||
unset($judy2); | ||
|
||
?> | ||
--EXPECT-- | ||
Instantiate first object: $judy1 | ||
Instantiate second object: $judy2 | ||
Test Size Zero | ||
$judy1->count(): 0 | ||
$judy2->count(): 0 | ||
Test Size Consistent | ||
$judy1->count(): 2 | ||
$judy2->count(): 0 | ||
Test Size Sum | ||
$judy1->count(): 2 | ||
$judy2->count(): 1 |