work modifications
authordeba
Fri, 11 Mar 2005 16:29:03 +0000
changeset 1210f02396423239
parent 1209 dc9fdf77007f
child 1211 73912ba03d83
work modifications
src/work/deba/dijkstra_test_generator.cpp
src/work/deba/graph_io_test.cc
src/work/deba/test.cpp
src/work/deba/test.lgf
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/work/deba/dijkstra_test_generator.cpp	Fri Mar 11 16:29:03 2005 +0000
     1.3 @@ -0,0 +1,41 @@
     1.4 +#include <iostream>
     1.5 +#include <vector>
     1.6 +
     1.7 +#include <cmath>
     1.8 +#include <cstdlib>
     1.9 +
    1.10 +#include <lemon/smart_graph.h>
    1.11 +#include <lemon/graph_writer.h>
    1.12 +
    1.13 +using namespace lemon;
    1.14 +using namespace std;
    1.15 +
    1.16 +int main(int argc, const char *argv[]) {
    1.17 +  typedef SmartGraph Graph;
    1.18 +  typedef Graph::Node Node;
    1.19 +  typedef Graph::Edge Edge;
    1.20 +
    1.21 +  typedef Graph::EdgeMap<int> CapacityMap;
    1.22 +
    1.23 +  const int n = argc > 1 ? atoi(argv[1]) : 1000;
    1.24 +  const int e = argc > 2 ? atoi(argv[2]) : (int)(n * log(n));
    1.25 +  const int m = argc > 3 ? atoi(argv[3]) : 100;
    1.26 +
    1.27 +  Graph graph;
    1.28 +  CapacityMap capacity(graph);
    1.29 +  vector<Node> nodes;
    1.30 +
    1.31 +  for (int i = 0; i < n; ++i) {
    1.32 +    nodes.push_back(graph.addNode());
    1.33 +  }
    1.34 +  for (int i = 0; i < e; ++i) {
    1.35 +    int s = (int)(n * (double)rand() / (RAND_MAX + 1.0));
    1.36 +    int t = (int)(n * (double)rand() / (RAND_MAX + 1.0));
    1.37 +    int c = (int)(m * (double)rand() / (RAND_MAX + 1.0));
    1.38 +    Edge edge = graph.addEdge(nodes[s], nodes[t]);
    1.39 +    capacity[edge] = c;
    1.40 +  }
    1.41 +  int start = (int)(n * (double)rand() / (RAND_MAX + 1.0));
    1.42 +  writeGraph(cout, graph, capacity, nodes[start]);
    1.43 +  return 0;
    1.44 +}
     2.1 --- a/src/work/deba/graph_io_test.cc	Wed Mar 09 14:23:36 2005 +0000
     2.2 +++ b/src/work/deba/graph_io_test.cc	Fri Mar 11 16:29:03 2005 +0000
     2.3 @@ -1,10 +1,9 @@
     2.4  #include <lemon/smart_graph.h>
     2.5  
     2.6 -#include "map_utils.h"
     2.7 +#include <lemon/map_utils.h>
     2.8  
     2.9 -
    2.10 -#include "graph_reader.h"
    2.11 -#include "graph_writer.h"
    2.12 +#include <lemon/graph_reader.h>
    2.13 +#include <lemon/graph_writer.h>
    2.14  
    2.15  #include <iostream>
    2.16  #include <fstream>
    2.17 @@ -41,8 +40,8 @@
    2.18    reader.addEdge("newedge", newedge);
    2.19  
    2.20    try {
    2.21 -    reader.read();
    2.22 -  } catch (IOException& e) {
    2.23 +    reader.run();
    2.24 +  } catch (IOError& e) {
    2.25      cerr << e.what() << endl;
    2.26    } catch (Exception e) {
    2.27      cerr << e.what() << endl;
    2.28 @@ -78,7 +77,7 @@
    2.29    
    2.30    writer.addNode("source", node_ids.inverse()[3]);
    2.31    //  writer.addEdge("elek", edge_ids.inverse()[6]);
    2.32 -  writer.write();
    2.33 +  writer.run();
    2.34    
    2.35    return 0;
    2.36  }
     3.1 --- a/src/work/deba/test.cpp	Wed Mar 09 14:23:36 2005 +0000
     3.2 +++ b/src/work/deba/test.cpp	Fri Mar 11 16:29:03 2005 +0000
     3.3 @@ -2,7 +2,10 @@
     3.4  
     3.5  using namespace std;
     3.6  
     3.7 +#include <lemon/utility.h>
     3.8  
     3.9 +using namespace std;
    3.10 +/*
    3.11  struct _EmptyList {
    3.12    void write() const {}
    3.13  };
    3.14 @@ -49,3 +52,36 @@
    3.15  int main() {
    3.16    Writer().add(3).add("alpha").add(4.53).write();
    3.17  }
    3.18 +*/
    3.19 +
    3.20 +class A {
    3.21 +public:
    3.22 +  typedef int X;
    3.23 +};
    3.24 +
    3.25 +class C {
    3.26 +};
    3.27 +
    3.28 +template <typename A> 
    3.29 +class TRUE {
    3.30 +public:
    3.31 +  static const bool state = true;
    3.32 +};
    3.33 +
    3.34 +template <typename _A> 
    3.35 +class B {
    3.36 +public:
    3.37 +  typedef enable_if<A::X, int> state;
    3.38 +};
    3.39 +
    3.40 +template <typename _A>
    3.41 +class B<_A, void> {
    3.42 +public:
    3.43 +  static const bool state = true;
    3.44 +};
    3.45 +
    3.46 +int main() {
    3.47 +  printf("%s\n", B<A>::state(), true ? "true" : "false");
    3.48 +  printf("%s\n", B<C>::state(), true ? "true" : "false");
    3.49 +  return 0;
    3.50 +}
     4.1 --- a/src/work/deba/test.lgf	Wed Mar 09 14:23:36 2005 +0000
     4.2 +++ b/src/work/deba/test.lgf	Fri Mar 11 16:29:03 2005 +0000
     4.3 @@ -4,7 +4,7 @@
     4.4  2 2 blue "A -> B \t: 10" b
     4.5  # hatalom dicsoseg "A -> B \t: 10" c
     4.6  3 1 red "A -> B \t: 10" d #adjkhj
     4.7 -4 2 red "A -> B \t: 10" e
     4.8 +a4 2 red "A -> B \t: 10" e
     4.9  5 1 green "A -> B \t: 10" f
    4.10  10 1 green "A -> B \t: 10" g
    4.11      # hello - bello csucsok "A -> B \t: 10"