COIN-OR::LEMON - Graph Library

Changeset 513:60afd11e6cb3 in lemon-0.x for src/work/athos


Ignore:
Timestamp:
05/03/04 16:42:40 (20 years ago)
Author:
athos
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@673
Message:

xy_test added: it was not entirely useless, I found a mistake in xy.h

Location:
src/work/athos
Files:
2 edited
2 copied

Legend:

Unmodified
Added
Removed
  • src/work/athos/minlengthpaths.h

    r511 r513  
    2323  ///
    2424  /// The class \ref hugo::MinLengthPaths "MinLengthPaths" implements
    25   /// an algorithm which finds k edge-disjoint paths
     25  /// an algorithm for finding k edge-disjoint paths
    2626  /// from a given source node to a given target node in an
    2727  /// edge-weighted directed graph having minimal total weigth (length).
  • src/work/athos/xy/xy.cc

    r240 r513  
    11#include <xy.h>
    22#include <iostream>
     3#include <vector>
    34using namespace std;
    45using namespace hugo;
     6
     7
    58int main()
    69{
  • src/work/athos/xy/xy_test.cc

    r240 r513  
    33using namespace std;
    44using namespace hugo;
     5
     6bool passed = true;
     7
     8void check(bool rc) {
     9  passed = passed && rc;
     10  if(!rc) {
     11    cout << "Test failed!" << endl;
     12  }
     13}
     14
     15
     16
    517int main()
    618{
    719
    8         cout << "Kérek szépen egy egész számot!" << endl;
    9         int s;
    10         cin >> s;
    1120
    12         cout << "Kerek sok sikvektort." << endl;
    1321
    14         xy<int> osszeg;
    15         xy<int> kul;
    16         xy<int> z;
     22        typedef xy<int> XY;
     23       
     24        XY seged;
     25        XY a(1,2);
     26        XY b(3,4);
    1727
    18         vector< xy<int> > v;
    19  
    20         while(cin >> z) {
    21                 v.push_back(z);
    22                 osszeg += z;
    23                 kul -= z;
    24                 cout << "Az összeg aktualisan: " << osszeg << endl;
    25                 cout << "A különbség aktualisan: " << kul << endl;
    26         }
     28        seged = a+b;
     29        check(seged.x==4 && seged.y==6);
    2730
    28         cout << "A kovetkezo szamokat szoroztam ossze:" << endl;
    29         for(unsigned int i=0; i<v.size(); ++i) {
    30           cout << v[i] << ", A normanégyzete: " << v[i].normSquare() <<endl;
    31           cout << v[i] << " " << s << " szorosa " << v[i]*s <<endl;
    32           cout << v[i] << " " << s << " edrésze " << v[i]/s <<endl;
    33         }
    34         if (v.size()>1){
    35           cout << "Az elsö kettö szorzata: " << v[0]*v[1] << endl;
    36         }
    37        
    38         cout << "Eleg nehez volt." << endl;
     31        seged = a-b;
     32        check(seged.x==-1 && seged.y==-1);
     33
     34        check(a.normSquare()==5);
     35        check(a*b==11);
     36
     37        int l=2;
     38        seged = a*l;
     39        check(seged.x==2 && seged.y==4);
     40
     41        seged = b/l;
     42        check(seged.x==1 && seged.y==2);
     43
     44        typedef BoundingBox<int> BB;
     45        BB doboz1;
     46        doboz1 += a;
     47        doboz1 += b;
     48
     49        cout << (passed ? "All tests passed." : "Some of the tests failed!!!")
     50             << endl;
     51
     52        return passed ? 0 : 1;
     53
    3954}
Note: See TracChangeset for help on using the changeset viewer.