summaryrefslogtreecommitdiffstats
path: root/tests/dataset_average_test.php
diff options
context:
space:
mode:
authorKore Nordmann <github@kore-nordmann.de>2006-08-17 11:49:04 +0000
committerKore Nordmann <github@kore-nordmann.de>2006-08-17 11:49:04 +0000
commit24758cba490f1670961042c6470ad7579af1f8c1 (patch)
treef36c9879c84cf7d35fc34d914a35508d7066e021 /tests/dataset_average_test.php
parent441e0054ad7b4f38d4596cf3ceda08ec00cc2127 (diff)
downloadzetacomponents-graph-24758cba490f1670961042c6470ad7579af1f8c1.zip
zetacomponents-graph-24758cba490f1670961042c6470ad7579af1f8c1.tar.gz
- Fixed matrices to use parameter order <row>, <column>
- Added dataset which builds polygon of defined order for set of points # Using least squares algorithm - Added method to solve a subset of nonlinear equatations to matrix class # Using Gauss-Newton algorithm
Diffstat (limited to 'tests/dataset_average_test.php')
-rw-r--r--tests/dataset_average_test.php103
1 files changed, 103 insertions, 0 deletions
diff --git a/tests/dataset_average_test.php b/tests/dataset_average_test.php
new file mode 100644
index 0000000..9a00763
--- /dev/null
+++ b/tests/dataset_average_test.php
@@ -0,0 +1,103 @@
+<?php
+/**
+ * ezcGraphDataSetAverageTest
+ *
+ * @package Graph
+ * @version //autogen//
+ * @subpackage Tests
+ * @copyright Copyright (C) 2005, 2006 eZ systems as. All rights reserved.
+ * @license http://ez.no/licenses/new_bsd New BSD License
+ */
+
+/**
+ * Tests for ezcGraph class.
+ *
+ * @package ImageAnalysis
+ * @subpackage Tests
+ */
+class ezcGraphDataSetAverageTest extends ezcTestCase
+{
+
+ public static function suite()
+ {
+ return new ezcTestSuite( "ezcGraphDataSetAverageTest" );
+ }
+
+ /**
+ * setUp
+ *
+ * @access public
+ */
+ public function setUp()
+ {
+ }
+
+ /**
+ * tearDown
+ *
+ * @access public
+ */
+ public function tearDown()
+ {
+ }
+
+ public function testCreateDatasetFromDataset()
+ {
+ $arrayDataSet = new ezcGraphArrayDataSet( array( -1 => 1, 0 => 0, 1 => 1 ) );
+
+ $averageDataSet = new ezcGraphDataSetAveragePolynom( $arrayDataSet );
+ $averageDataSet->polynomOrder = 2;
+
+ $polynom = $averageDataSet->getPolynom();
+
+ $this->assertEquals(
+ 'x^2',
+ $polynom->__toString()
+ );
+ }
+
+ public function testCreateDatasetFromDataset2()
+ {
+ $arrayDataSet = new ezcGraphArrayDataSet( array( -1 => 2, 1 => 2, 3 => 10 ) );
+
+ $averageDataSet = new ezcGraphDataSetAveragePolynom( $arrayDataSet );
+ $averageDataSet->polynomOrder = 2;
+
+ $polynom = $averageDataSet->getPolynom();
+
+ $this->assertEquals(
+ 'x^2 + 1.00',
+ $polynom->__toString()
+ );
+ }
+
+ public function testCreateDatasetFromDatasetLowOrder()
+ {
+ $arrayDataSet = new ezcGraphArrayDataSet( array( -1 => 2, 1 => 2, 3 => 10 ) );
+
+ $averageDataSet = new ezcGraphDataSetAveragePolynom( $arrayDataSet );
+ $averageDataSet->polynomOrder = 1;
+
+ $polynom = $averageDataSet->getPolynom();
+
+ $this->assertEquals(
+ '2.00 * x + 2.67',
+ $polynom->__toString()
+ );
+ }
+ public function testCreateDatasetFromDatasetHighOrder()
+ {
+ $arrayDataSet = new ezcGraphArrayDataSet( array( -1 => 2, 1 => 2, 3 => 10 ) );
+
+ $averageDataSet = new ezcGraphDataSetAveragePolynom( $arrayDataSet );
+ $averageDataSet->polynomOrder = 3;
+
+ $polynom = $averageDataSet->getPolynom();
+
+ $this->assertEquals(
+ 'x^2 + 1.00',
+ $polynom->__toString()
+ );
+ }
+}
+?>
OpenPOWER on IntegriCloud