Index: src/unittests/LineUnittest.cpp
===================================================================
--- src/unittests/LineUnittest.cpp	(revision 45ef76d8bee7dfcd142bef7a7cea8b1bc62fbafd)
+++ src/unittests/LineUnittest.cpp	(revision 45ef76d8bee7dfcd142bef7a7cea8b1bc62fbafd)
@@ -0,0 +1,222 @@
+/*
+ * LineUnittest.cpp
+ *
+ *  Created on: May 27, 2010
+ *      Author: crueger
+ */
+
+#include "LineUnittest.hpp"
+
+#include "vector.hpp"
+#include "Exceptions/LinearDependenceException.hpp"
+#include "Exceptions/SkewException.hpp"
+
+#include <cppunit/CompilerOutputter.h>
+#include <cppunit/extensions/TestFactoryRegistry.h>
+#include <cppunit/ui/text/TestRunner.h>
+
+#include <iostream>
+
+using namespace std;
+
+#ifdef HAVE_TESTRUNNER
+#include "UnitTestMain.hpp"
+#endif /*HAVE_TESTRUNNER*/
+
+CPPUNIT_TEST_SUITE_REGISTRATION( LineUnittest );
+
+void LineUnittest::setUp(){
+  // three lines along the axes
+  la1 = new Line(zeroVec,e1);
+  la2 = new Line(zeroVec,e2);
+  la3 = new Line(zeroVec,e3);
+
+  // the lines along the planes defined by two coordinate axes
+  lp1 = new Line(e1,e1-e2);
+  lp2 = new Line(e2,e2-e3);
+  lp3 = new Line(e3,e3-e1);
+}
+void LineUnittest::tearDown(){
+  delete la1;
+  delete la2;
+  delete la3;
+
+  delete lp1;
+  delete lp2;
+  delete lp3;
+}
+
+void LineUnittest::constructionErrorTest(){
+  // test some constructions
+
+  // direction+origin should never fail
+  CPPUNIT_ASSERT_NO_THROW(Line(zeroVec,e1));
+  CPPUNIT_ASSERT_NO_THROW(Line(zeroVec,e2));
+  CPPUNIT_ASSERT_NO_THROW(Line(zeroVec,e3));
+
+  // two points fails if both points are the same
+  CPPUNIT_ASSERT_NO_THROW(makeLineThrough(e1,e2));
+  CPPUNIT_ASSERT_NO_THROW(makeLineThrough(e2,e3));
+  CPPUNIT_ASSERT_NO_THROW(makeLineThrough(e3,e1));
+  // for zerovectors
+  CPPUNIT_ASSERT_NO_THROW(makeLineThrough(e1,zeroVec));
+  CPPUNIT_ASSERT_NO_THROW(makeLineThrough(e2,zeroVec));
+  CPPUNIT_ASSERT_NO_THROW(makeLineThrough(e3,zeroVec));
+  // now we pass two times the same point
+  CPPUNIT_ASSERT_THROW(makeLineThrough(zeroVec,zeroVec),LinearDependenceException);
+  CPPUNIT_ASSERT_THROW(makeLineThrough(e1,e1),LinearDependenceException);
+  CPPUNIT_ASSERT_THROW(makeLineThrough(e2,e2),LinearDependenceException);
+  CPPUNIT_ASSERT_THROW(makeLineThrough(e3,e3),LinearDependenceException);
+
+}
+
+bool testDirection(const Vector &dir1,const Vector &dir2){
+  return (dir1==dir2) || (dir1==-1*dir2);
+}
+
+void LineUnittest::constructionResultTest(){
+  // test all directions
+  CPPUNIT_ASSERT(testDirection(la1->getDirection(),e1));
+  CPPUNIT_ASSERT(testDirection(la2->getDirection(),e2));
+  CPPUNIT_ASSERT(testDirection(la3->getDirection(),e3));
+
+  // test origins
+  CPPUNIT_ASSERT_EQUAL(la1->getOrigin(),zeroVec);
+  CPPUNIT_ASSERT_EQUAL(la2->getOrigin(),zeroVec);
+  CPPUNIT_ASSERT_EQUAL(la2->getOrigin(),zeroVec);
+
+  // test if desired points are on the lines
+  CPPUNIT_ASSERT(la1->isContained(zeroVec));
+  CPPUNIT_ASSERT(la2->isContained(zeroVec));
+  CPPUNIT_ASSERT(la3->isContained(zeroVec));
+
+  CPPUNIT_ASSERT(la1->isContained(e1));
+  CPPUNIT_ASSERT(la2->isContained(e2));
+  CPPUNIT_ASSERT(la3->isContained(e3));
+
+  CPPUNIT_ASSERT(lp1->isContained(e1));
+  CPPUNIT_ASSERT(lp2->isContained(e2));
+  CPPUNIT_ASSERT(lp3->isContained(e3));
+
+  CPPUNIT_ASSERT(lp1->isContained(e2));
+  CPPUNIT_ASSERT(lp2->isContained(e3));
+  CPPUNIT_ASSERT(lp3->isContained(e1));
+}
+
+void LineUnittest::isContainedTest(){
+  // Zerovector on the axes lines
+  CPPUNIT_ASSERT(la1->isContained(zeroVec));
+  CPPUNIT_ASSERT(la2->isContained(zeroVec));
+  CPPUNIT_ASSERT(la3->isContained(zeroVec));
+
+  // multiples of the second support vector
+  CPPUNIT_ASSERT(la1->isContained(e1));
+  CPPUNIT_ASSERT(la2->isContained(e2));
+  CPPUNIT_ASSERT(la3->isContained(e3));
+
+  CPPUNIT_ASSERT(la1->isContained(2*e1));
+  CPPUNIT_ASSERT(la2->isContained(2*e2));
+  CPPUNIT_ASSERT(la3->isContained(2*e3));
+
+  CPPUNIT_ASSERT(la1->isContained(3*e1));
+  CPPUNIT_ASSERT(la2->isContained(3*e2));
+  CPPUNIT_ASSERT(la3->isContained(3*e3));
+
+  // negative multiples
+  CPPUNIT_ASSERT(la1->isContained(-1*e1));
+  CPPUNIT_ASSERT(la2->isContained(-1*e2));
+  CPPUNIT_ASSERT(la3->isContained(-1*e3));
+
+  CPPUNIT_ASSERT(la1->isContained(-2*e1));
+  CPPUNIT_ASSERT(la2->isContained(-2*e2));
+  CPPUNIT_ASSERT(la3->isContained(-2*e3));
+
+  // points that should not be on the lines
+  CPPUNIT_ASSERT(!la1->isContained(e2));
+  CPPUNIT_ASSERT(!la2->isContained(e3));
+  CPPUNIT_ASSERT(!la3->isContained(e1));
+
+  CPPUNIT_ASSERT(!la1->isContained(2*e2));
+  CPPUNIT_ASSERT(!la2->isContained(2*e3));
+  CPPUNIT_ASSERT(!la3->isContained(2*e1));
+
+  CPPUNIT_ASSERT(!la1->isContained(-1*e2));
+  CPPUNIT_ASSERT(!la2->isContained(-1*e3));
+  CPPUNIT_ASSERT(!la3->isContained(-1*e1));
+
+  // For the plane lines
+  CPPUNIT_ASSERT(lp1->isContained(e1));
+  CPPUNIT_ASSERT(lp2->isContained(e2));
+  CPPUNIT_ASSERT(lp3->isContained(e3));
+
+  CPPUNIT_ASSERT(lp1->isContained(e2));
+  CPPUNIT_ASSERT(lp2->isContained(e3));
+  CPPUNIT_ASSERT(lp3->isContained(e1));
+
+  CPPUNIT_ASSERT(lp1->isContained(e1+2*(e1-e2)));
+  CPPUNIT_ASSERT(lp2->isContained(e2+2*(e2-e3)));
+  CPPUNIT_ASSERT(lp3->isContained(e3+2*(e3-e1)));
+
+  CPPUNIT_ASSERT(lp1->isContained(e1-2*(e1-e2)));
+  CPPUNIT_ASSERT(lp2->isContained(e2-2*(e2-e3)));
+  CPPUNIT_ASSERT(lp3->isContained(e3-2*(e3-e1)));
+}
+
+void LineUnittest::intersectionTest(){
+  Vector fixture;
+
+  // intersection of the axis lines
+  fixture = la1->getIntersection(*la2);
+  CPPUNIT_ASSERT_EQUAL(fixture,zeroVec);
+  fixture = la2->getIntersection(*la3);
+  CPPUNIT_ASSERT_EQUAL(fixture,zeroVec);
+  fixture = la3->getIntersection(*la1);
+  CPPUNIT_ASSERT_EQUAL(fixture,zeroVec);
+
+  // axes and plane lines
+  fixture = la1->getIntersection(*lp1);
+  CPPUNIT_ASSERT_EQUAL(fixture,e1);
+  fixture = la2->getIntersection(*lp2);
+  CPPUNIT_ASSERT_EQUAL(fixture,e2);
+  fixture = la3->getIntersection(*lp3);
+  CPPUNIT_ASSERT_EQUAL(fixture,e3);
+
+  fixture = la1->getIntersection(*lp3);
+  CPPUNIT_ASSERT_EQUAL(fixture,e1);
+  fixture = la2->getIntersection(*lp1);
+  CPPUNIT_ASSERT_EQUAL(fixture,e2);
+  fixture = la3->getIntersection(*lp2);
+  CPPUNIT_ASSERT_EQUAL(fixture,e3);
+
+  // two plane lines
+  fixture = lp1->getIntersection(*lp2);
+  CPPUNIT_ASSERT_EQUAL(fixture,e2);
+  fixture = lp2->getIntersection(*lp3);
+  CPPUNIT_ASSERT_EQUAL(fixture,e3);
+  fixture = lp3->getIntersection(*lp1);
+  CPPUNIT_ASSERT_EQUAL(fixture,e1);
+
+  // When we have two times the same line, we check if the point is on the line
+  fixture = la1->getIntersection(*la1);
+  CPPUNIT_ASSERT(la1->isContained(fixture));
+  fixture = la2->getIntersection(*la2);
+  CPPUNIT_ASSERT(la2->isContained(fixture));
+  fixture = la3->getIntersection(*la3);
+  CPPUNIT_ASSERT(la3->isContained(fixture));
+
+  fixture = lp1->getIntersection(*lp1);
+  CPPUNIT_ASSERT(lp1->isContained(fixture));
+  fixture = lp2->getIntersection(*lp2);
+  CPPUNIT_ASSERT(lp2->isContained(fixture));
+  fixture = lp3->getIntersection(*lp3);
+  CPPUNIT_ASSERT(lp3->isContained(fixture));
+
+  // lines that are askew should produce an Error
+  CPPUNIT_ASSERT_THROW(lp1->getIntersection(*la3),SkewException);
+  CPPUNIT_ASSERT_THROW(lp2->getIntersection(*la1),SkewException);
+  CPPUNIT_ASSERT_THROW(lp3->getIntersection(*la2),SkewException);
+
+  CPPUNIT_ASSERT_THROW(la1->getIntersection(*lp2),SkewException);
+  CPPUNIT_ASSERT_THROW(la2->getIntersection(*lp3),SkewException);
+  CPPUNIT_ASSERT_THROW(la3->getIntersection(*lp1),SkewException);
+}
Index: src/unittests/LineUnittest.hpp
===================================================================
--- src/unittests/LineUnittest.hpp	(revision 45ef76d8bee7dfcd142bef7a7cea8b1bc62fbafd)
+++ src/unittests/LineUnittest.hpp	(revision 45ef76d8bee7dfcd142bef7a7cea8b1bc62fbafd)
@@ -0,0 +1,44 @@
+/*
+ * LineUnittest.hpp
+ *
+ *  Created on: May 27, 2010
+ *      Author: crueger
+ */
+
+#ifndef LINEUNITTEST_HPP_
+#define LINEUNITTEST_HPP_
+
+#include <cppunit/extensions/HelperMacros.h>
+
+#include "Line.hpp"
+
+class LineUnittest : public CppUnit::TestFixture
+{
+
+  CPPUNIT_TEST_SUITE( LineUnittest) ;
+  CPPUNIT_TEST ( constructionErrorTest );
+  CPPUNIT_TEST ( constructionResultTest );
+  CPPUNIT_TEST ( isContainedTest );
+  CPPUNIT_TEST ( intersectionTest );
+  CPPUNIT_TEST_SUITE_END();
+
+public:
+  void setUp();
+  void tearDown();
+
+  void constructionErrorTest();
+  void constructionResultTest();
+  void isContainedTest();
+  void intersectionTest();
+
+private:
+  Line *la1;
+  Line *la2;
+  Line *la3;
+  Line *lp1;
+  Line *lp2;
+  Line *lp3;
+
+};
+
+#endif /* LINEUNITTEST_HPP_ */
Index: src/unittests/Makefile.am
===================================================================
--- src/unittests/Makefile.am	(revision f2f4ae653593ee7da86b543fbbb0de89955e6797)
+++ src/unittests/Makefile.am	(revision 45ef76d8bee7dfcd142bef7a7cea8b1bc62fbafd)
@@ -23,4 +23,5 @@
   InfoUnitTest \
   LinearSystemOfEquationsUnitTest \
+  LineUnittest \
   LinkedCellUnitTest \
   ListOfBondsUnitTest \
@@ -64,4 +65,5 @@
   infounittest.cpp \
   linearsystemofequationsunittest.cpp \
+  LineUnittest.cpp \
   LinkedCellUnitTest.cpp \
   listofbondsunittest.cpp \
@@ -97,4 +99,5 @@
   infounittest.hpp \
   linearsystemofequationsunittest.hpp \
+  LineUnittest.hpp \
   LinkedCellUnitTest.hpp \
   listofbondsunittest.hpp \
@@ -153,4 +156,7 @@
 LinearSystemOfEquationsUnitTest_LDADD = ${ALLLIBS}
 
+LineUnittest_SOURCES = UnitTestMain.cpp LineUnittest.cpp LineUnittest.hpp
+LineUnittest_LDADD = ${ALLLIBS}
+
 LinkedCellUnitTest_SOURCES = UnitTestMain.cpp LinkedCellUnitTest.cpp LinkedCellUnitTest.hpp 
 LinkedCellUnitTest_LDADD = ${ALLLIBS}
Index: src/unittests/vectorunittest.cpp
===================================================================
--- src/unittests/vectorunittest.cpp	(revision f2f4ae653593ee7da86b543fbbb0de89955e6797)
+++ src/unittests/vectorunittest.cpp	(revision 45ef76d8bee7dfcd142bef7a7cea8b1bc62fbafd)
@@ -228,27 +228,4 @@
   CPPUNIT_ASSERT_EQUAL( Vector(0., 1., 1.), fixture );
 
-  // four vectors equal to zero
-  CPPUNIT_ASSERT_THROW(fixture = GetIntersectionOfTwoLinesOnPlane(zero, zero, zero, zero), LinearDependenceException);
-  //CPPUNIT_ASSERT_EQUAL( zero, fixture );
-
-  // four vectors equal to unit
-  CPPUNIT_ASSERT_THROW(fixture = GetIntersectionOfTwoLinesOnPlane(unit, unit, unit, unit), LinearDependenceException);
-  //CPPUNIT_ASSERT_EQUAL( zero, fixture );
-
-  // two equal lines
-  CPPUNIT_ASSERT_NO_THROW(fixture = GetIntersectionOfTwoLinesOnPlane(unit, two, unit, two));
-  CPPUNIT_ASSERT_EQUAL( unit, fixture );
-
-  // line from (1,0,0) to (2,1,0) cuts line from (1,0,0) to (0,1,0) at ???
-  CPPUNIT_ASSERT_NO_THROW( fixture = GetIntersectionOfTwoLinesOnPlane(unit, two, unit, otherunit) );
-  CPPUNIT_ASSERT_EQUAL( unit, fixture );
-
-  // line from (1,0,0) to (0,0,0) cuts line from (0,0,0) to (2,1,0) at ???
-  CPPUNIT_ASSERT_NO_THROW( fixture = GetIntersectionOfTwoLinesOnPlane(unit, zero, zero, two) );
-  CPPUNIT_ASSERT_EQUAL( zero, fixture );
-
-  // line from (1,0,0) to (2,1,0) cuts line from (0,0,0) to (0,1,0) at ???
-  CPPUNIT_ASSERT_NO_THROW(fixture = GetIntersectionOfTwoLinesOnPlane(unit, two, zero, otherunit) );
-  CPPUNIT_ASSERT_EQUAL( Vector(0., -1., 0.), fixture );
 };
 
