[Lemon-commits] [lemon_svn] athos: r673 - in hugo/trunk/src/work/athos: . xy
Lemon SVN
svn at lemon.cs.elte.hu
Mon Nov 6 20:40:53 CET 2006
Author: athos
Date: Mon May 3 16:42:40 2004
New Revision: 673
Added:
hugo/trunk/src/work/athos/minlengthpaths_test.cc
- copied unchanged from r672, /hugo/trunk/src/work/athos/suurballe.cc
hugo/trunk/src/work/athos/xy/xy_test.cc
- copied, changed from r672, /hugo/trunk/src/work/athos/xy/xy.cc
Modified:
hugo/trunk/src/work/athos/minlengthpaths.h
hugo/trunk/src/work/athos/xy/xy.cc
Log:
xy_test added: it was not entirely useless, I found a mistake in xy.h
Modified: hugo/trunk/src/work/athos/minlengthpaths.h
==============================================================================
--- hugo/trunk/src/work/athos/minlengthpaths.h (original)
+++ hugo/trunk/src/work/athos/minlengthpaths.h Mon May 3 16:42:40 2004
@@ -22,7 +22,7 @@
/// of minimal total length
///
/// The class \ref hugo::MinLengthPaths "MinLengthPaths" implements
- /// an algorithm which finds k edge-disjoint paths
+ /// an algorithm for finding k edge-disjoint paths
/// from a given source node to a given target node in an
/// edge-weighted directed graph having minimal total weigth (length).
///
Modified: hugo/trunk/src/work/athos/xy/xy.cc
==============================================================================
--- hugo/trunk/src/work/athos/xy/xy.cc (original)
+++ hugo/trunk/src/work/athos/xy/xy.cc Mon May 3 16:42:40 2004
@@ -1,7 +1,10 @@
#include <xy.h>
#include <iostream>
+#include <vector>
using namespace std;
using namespace hugo;
+
+
int main()
{
Copied: hugo/trunk/src/work/athos/xy/xy_test.cc (from r672, /hugo/trunk/src/work/athos/xy/xy.cc)
==============================================================================
--- /hugo/trunk/src/work/athos/xy/xy.cc (original)
+++ hugo/trunk/src/work/athos/xy/xy_test.cc Mon May 3 16:42:40 2004
@@ -2,38 +2,53 @@
#include <iostream>
using namespace std;
using namespace hugo;
+
+bool passed = true;
+
+void check(bool rc) {
+ passed = passed && rc;
+ if(!rc) {
+ cout << "Test failed!" << endl;
+ }
+}
+
+
+
int main()
{
- cout << "Kérek szépen egy egész számot!" << endl;
- int s;
- cin >> s;
-
- cout << "Kerek sok sikvektort." << endl;
-
- xy<int> osszeg;
- xy<int> kul;
- xy<int> z;
-
- vector< xy<int> > v;
-
- while(cin >> z) {
- v.push_back(z);
- osszeg += z;
- kul -= z;
- cout << "Az összeg aktualisan: " << osszeg << endl;
- cout << "A különbség aktualisan: " << kul << endl;
- }
-
- cout << "A kovetkezo szamokat szoroztam ossze:" << endl;
- for(unsigned int i=0; i<v.size(); ++i) {
- cout << v[i] << ", A normanégyzete: " << v[i].normSquare() <<endl;
- cout << v[i] << " " << s << " szorosa " << v[i]*s <<endl;
- cout << v[i] << " " << s << " edrésze " << v[i]/s <<endl;
- }
- if (v.size()>1){
- cout << "Az elsö kettö szorzata: " << v[0]*v[1] << endl;
- }
+
+
+ typedef xy<int> XY;
- cout << "Eleg nehez volt." << endl;
+ XY seged;
+ XY a(1,2);
+ XY b(3,4);
+
+ seged = a+b;
+ check(seged.x==4 && seged.y==6);
+
+ seged = a-b;
+ check(seged.x==-1 && seged.y==-1);
+
+ check(a.normSquare()==5);
+ check(a*b==11);
+
+ int l=2;
+ seged = a*l;
+ check(seged.x==2 && seged.y==4);
+
+ seged = b/l;
+ check(seged.x==1 && seged.y==2);
+
+ typedef BoundingBox<int> BB;
+ BB doboz1;
+ doboz1 += a;
+ doboz1 += b;
+
+ cout << (passed ? "All tests passed." : "Some of the tests failed!!!")
+ << endl;
+
+ return passed ? 0 : 1;
+
}
More information about the Lemon-commits
mailing list