Permalink
Browse files

Added build.xml, fixed unit tests

  • Loading branch information...
CloCkWeRX committed Nov 27, 2011
1 parent 6e910cf commit c1632b361f8226020af520cf0929fc91a4187eaf
Showing with 71 additions and 5 deletions.
  1. +46 −0 build.xml
  2. +20 −0 phpunit.xml
  3. +5 −5 tests/Math_MatrixTest.php
View
@@ -0,0 +1,46 @@
+<?xml version="1.0"?>
+<project name="Console_GetArgs" default="build" basedir=".">
+ <condition property="phpunit.bin" value="phpunit.bat" else="phpunit">
+ <os family="windows"/>
+ </condition>
+
+ <condition property="pear.bin" value="pear.bat" else="pear">
+ <os family="windows"/>
+ </condition>
+
+ <target name="clean" description="Clean up and create artifact directories">
+ <delete dir="${basedir}/lib" />
+ <delete dir="${basedir}/build/api"/>
+ <delete dir="${basedir}/build/code-browser"/>
+ <delete dir="${basedir}/build/coverage"/>
+ <delete dir="${basedir}/build/logs"/>
+ <delete dir="${basedir}/build/pdepend"/>
+ <delete dir="${basedir}/build"/>
+
+ <mkdir dir="${basedir}/lib/" />
+ <mkdir dir="${basedir}/build"/>
+ <mkdir dir="${basedir}/build/api"/>
+ <mkdir dir="${basedir}/build/code-browser"/>
+ <mkdir dir="${basedir}/build/coverage"/>
+ <mkdir dir="${basedir}/build/logs"/>
+ <mkdir dir="${basedir}/build/pdepend"/>
+
+ <exec dir="${basedir}" executable="git" failonerror="true">
+ <arg line="clone git://github.com/pear/Math_Vector.git lib/" />
+ </exec>
+ </target>
+
+ <target name="phpunit">
+ <exec dir="${basedir}" executable="${phpunit.bin}" failonerror="true">
+ <arg line="."/>
+ </exec>
+ </target>
+
+ <target name="package">
+ <exec dir="${basedir}/build" executable="${pear.bin}" failonerror="true">
+ <arg line="package ../package.xml"/>
+ </exec>
+ </target>
+
+ <target name="build" depends="clean,phpunit,package"/>
+</project>
View
@@ -0,0 +1,20 @@
+<?xml version="1.0"?>
+<phpunit verbose="true">
+ <logging>
+ <log type="coverage-html" target="build/coverage" title="Math_Vector" charset="UTF-8" yui="true" highlight="true" lowUpperBound="35" highLowerBound="70"/>
+ <log type="coverage-clover" target="build/logs/clover.xml"/>
+ <log type="junit" target="build/logs/junit.xml" logIncompleteSkipped="false" title="Math_Vector"/>
+ </logging>
+ <filter>
+ <blacklist>
+ <directory suffix=".php">/usr/share/php</directory>
+ <directory suffix=".php">tests/unit/</directory>
+ </blacklist>
+ </filter>
+ <testsuites>
+ <testsuite>
+ <directory>tests</directory>
+ <file>*Test.php</file>
+ </testsuite>
+ </testsuites>
+</phpunit>
View
@@ -15,13 +15,13 @@
// +----------------------------------------------------------------------+
// | Authors: Jesus M. Castagnetto <jmcastagnetto@php.net> |
// +----------------------------------------------------------------------+
-//
+//
// Matrix definition and manipulation package
-//
+//
// $Id$
//
-require_once 'PHPUnit/Framework.php';
+require_once 'PHPUnit/Framework/TestCase.php';
require_once 'Math/Matrix.php';
class Math_MatrixTest extends PHPUnit_Framework_TestCase {/*{{{*/
@@ -190,7 +190,7 @@ function testGetSubMatrix() {
array(4.0,5.0),
);
$q = $this->m->getSubMatrix(1,1,2,2);
- $this->assertEquals($data, $q->getData());
+ $this->assertEquals($data, $q->getData());
}
function testAdd() {
@@ -364,7 +364,7 @@ function testMakeHankel() {
);
$c = array(1,2,3);
$r = array(1,3,5,7);
-
+
$res = new Math_Matrix($data);
$hankel = Math_Matrix::makeHankel($c, $r);
$this->assertEquals($res->toString(), $hankel->toString());

0 comments on commit c1632b3

Please sign in to comment.