diff options
author | Kore Nordmann <github@kore-nordmann.de> | 2006-11-02 16:05:45 +0000 |
---|---|---|
committer | Kore Nordmann <github@kore-nordmann.de> | 2006-11-02 16:05:45 +0000 |
commit | 5bdf51ead2a5e1dfb683c56df48e3d887e743472 (patch) | |
tree | 7e39889aca43eff30617df44f5bb567be94035f9 /tests/dataset_average_test.php | |
parent | 39d55ef60b9074920a1a3fc3d0c0f8d51f303760 (diff) | |
download | zetacomponents-graph-5bdf51ead2a5e1dfb683c56df48e3d887e743472.zip zetacomponents-graph-5bdf51ead2a5e1dfb683c56df48e3d887e743472.tar.gz |
- Throw ezcBaseValueExceptions instead of typecasting
- Do range checks instead of converting numbers using min and max
- Extended testcases to test for ezcBaseValueExceptions
Diffstat (limited to 'tests/dataset_average_test.php')
-rw-r--r-- | tests/dataset_average_test.php | 62 |
1 files changed, 61 insertions, 1 deletions
diff --git a/tests/dataset_average_test.php b/tests/dataset_average_test.php index a2c9ae0..6ab21c6 100644 --- a/tests/dataset_average_test.php +++ b/tests/dataset_average_test.php @@ -294,7 +294,7 @@ class ezcGraphDataSetAverageTest extends ezcTestCase $this->fail( 'Expected ezcGraphDatasetAverageInvalidKeysException.' ); } - public function testPAverageDataSetIsset() + public function testAverageDataSetIsset() { $arrayDataSet = new ezcGraphArrayDataSet( array( -1 => 2, 1 => 2, 3 => 10 ) ); @@ -308,5 +308,65 @@ class ezcGraphDataSetAverageTest extends ezcTestCase 'Polygon not properly initialized.' ); } + + public function testDataSetAveragePolynomPropertyPolynomOrder() + { + $arrayDataSet = new ezcGraphArrayDataSet( array( -1 => 2, 1 => 2, 3 => 10 ) ); + $dataset = new ezcGraphDataSetAveragePolynom( $arrayDataSet ); + + $this->assertSame( + 3, + $dataset->polynomOrder, + 'Wrong default value for property polynomOrder in class ezcGraphDataSetAveragePolynom' + ); + + $dataset->polynomOrder = 5; + $this->assertSame( + 5, + $dataset->polynomOrder, + 'Setting property value did not work for property polynomOrder in class ezcGraphDataSetAveragePolynom' + ); + + try + { + $dataset->polynomOrder = false; + } + catch( ezcBaseValueException $e ) + { + return true; + } + + $this->fail( 'Expected ezcBaseValueException.' ); + } + + public function testDataSetAveragePolynomPropertyResolution() + { + $arrayDataSet = new ezcGraphArrayDataSet( array( -1 => 2, 1 => 2, 3 => 10 ) ); + $dataset = new ezcGraphDataSetAveragePolynom( $arrayDataSet ); + + $this->assertSame( + 100, + $dataset->resolution, + 'Wrong default value for property resolution in class ezcGraphDataSetAveragePolynom' + ); + + $dataset->resolution = 5; + $this->assertSame( + 5, + $dataset->resolution, + 'Setting property value did not work for property resolution in class ezcGraphDataSetAveragePolynom' + ); + + try + { + $dataset->resolution = false; + } + catch( ezcBaseValueException $e ) + { + return true; + } + + $this->fail( 'Expected ezcBaseValueException.' ); + } } ?> |