[Lemon-commits] [lemon_svn] alpar: r986 - in hugo/branches/hugo++: . src/benchmark src/hugo src/test src/work src/work/jacint src/work/marci
Lemon SVN
svn at lemon.cs.elte.hu
Mon Nov 6 20:42:34 CET 2006
Author: alpar
Date: Thu Jul 22 17:07:51 2004
New Revision: 986
Added:
hugo/branches/hugo++/src/hugo/max_flow.h
- copied unchanged from r985, /hugo/trunk/src/hugo/max_flow.h
hugo/branches/hugo++/src/test/test_tools_fail.cc
- copied unchanged from r985, /hugo/trunk/src/test/test_tools_fail.cc
hugo/branches/hugo++/src/test/test_tools_pass.cc
- copied unchanged from r985, /hugo/trunk/src/test/test_tools_pass.cc
hugo/branches/hugo++/src/work/marci/for_each_macros.h
- copied unchanged from r985, /hugo/trunk/src/work/marci/for_each_macros.h
Removed:
hugo/branches/hugo++/src/hugo/for_each_macros.h
hugo/branches/hugo++/src/work/jacint/max_flow_no_stack.h
Modified:
hugo/branches/hugo++/ (props changed)
hugo/branches/hugo++/src/benchmark/benchmark
hugo/branches/hugo++/src/benchmark/hcube.cc
hugo/branches/hugo++/src/hugo/full_graph.h
hugo/branches/hugo++/src/hugo/list_graph.h
hugo/branches/hugo++/src/hugo/maps.h
hugo/branches/hugo++/src/hugo/smart_graph.h
hugo/branches/hugo++/src/test/Makefile.am
hugo/branches/hugo++/src/test/error_test.cc
hugo/branches/hugo++/src/test/test_tools.h
hugo/branches/hugo++/src/test/xy_test.cc
hugo/branches/hugo++/src/work/Doxyfile
Log:
branches/hugo++: ported -r971:985 from trunk.
Modified: hugo/branches/hugo++/src/benchmark/benchmark
==============================================================================
--- hugo/branches/hugo++/src/benchmark/benchmark (original)
+++ hugo/branches/hugo++/src/benchmark/benchmark Thu Jul 22 17:07:51 2004
@@ -3,7 +3,11 @@
function runtest () # prefix, prog, args
{
echo $1 1>&2
- $2 $3 $4 $5 $6 $7 $8 $9|awk '{print "'$1'",$0}'
+ for ((i=1;i<5;i++))
+ do
+ $2 $3 $4 $5 $6 $7 $8 $9;
+ done |
+ awk '{print "'$1'",$0}'
}
function runalltest() #postfix, CXX, CXXFLAGS
Modified: hugo/branches/hugo++/src/benchmark/hcube.cc
==============================================================================
--- hugo/branches/hugo++/src/benchmark/hcube.cc (original)
+++ hugo/branches/hugo++/src/benchmark/hcube.cc Thu Jul 22 17:07:51 2004
@@ -4,7 +4,8 @@
#include<hugo/list_graph.h>
#include<hugo/smart_graph.h>
#include<hugo/dijkstra.h>
-#include<../work/jacint/max_flow_no_stack.h>
+#include<hugo/max_flow.h>
+
#include"bench_tools.h"
using namespace std;
@@ -94,7 +95,7 @@
T.reset();
Graph::EdgeMap<int> map(G);
- {
+ for(int i=0;i<5;i++) {
Primes P;
for(int i=0;i<dim*(1<<dim);i++) P();
@@ -115,7 +116,8 @@
T.reset();
{
Dijkstra<Graph> Dij(G,map);
- Dij.run(nodes[0]);
+ for(int i=0;i<10;i++)
+ Dij.run(nodes[0]);
}
PrintTime("DIJKSTRA",T);
@@ -123,8 +125,9 @@
{
Graph::EdgeMap<int> flow(G);
- MaxFlowNoStack<Graph,int> MF(G,nodes[0],nodes[1<<dim-1],map,flow);
- MF.run(MF.NO_FLOW);
+ MaxFlow<Graph,int> MF(G,nodes[0],nodes[1<<dim-1],map,flow);
+ for(int i=0;i<10;i++)
+ MF.run(MF.NO_FLOW);
}
PrintTime("PREFLOW",T);
Modified: hugo/branches/hugo++/src/hugo/full_graph.h
==============================================================================
--- hugo/branches/hugo++/src/hugo/full_graph.h (original)
+++ hugo/branches/hugo++/src/hugo/full_graph.h Thu Jul 22 17:07:51 2004
@@ -107,7 +107,7 @@
protected:
int n;
- friend int FullGraph::id(Node v) const;
+ friend int FullGraph::id(Node v);
Node(int nn) {n=nn;}
public:
Node() {}
@@ -135,7 +135,7 @@
friend class NodeIt;
protected:
int n; //NodeNum*head+tail;
- friend int FullGraph::id(Edge e) const;
+ friend int FullGraph::id(Edge e);
Edge(int nn) {n=nn;}
public:
Modified: hugo/branches/hugo++/src/hugo/list_graph.h
==============================================================================
--- hugo/branches/hugo++/src/hugo/list_graph.h (original)
+++ hugo/branches/hugo++/src/hugo/list_graph.h Thu Jul 22 17:07:51 2004
@@ -309,7 +309,7 @@
protected:
int n;
- friend int ListGraph::id(Node v) const;
+ friend int ListGraph::id(Node v);
Node(int nn) {n=nn;}
public:
Node() {}
@@ -349,7 +349,7 @@
friend class NodeIt;
protected:
int n;
- friend int ListGraph::id(Edge e) const;
+ friend int ListGraph::id(Edge e);
public:
/// An Edge with id \c n.
Modified: hugo/branches/hugo++/src/hugo/maps.h
==============================================================================
--- hugo/branches/hugo++/src/hugo/maps.h (original)
+++ hugo/branches/hugo++/src/hugo/maps.h Thu Jul 22 17:07:51 2004
@@ -12,17 +12,27 @@
namespace hugo {
+ /// Base class of maps.
+
+ template<typename K, typename T>
+ class MapBase
+ {
+ public:
+ ///
+ typedef K KeyType;
+ ///
+ typedef T ValueType;
+ };
+
/// Null map. (aka DoNothingMap)
/// If you have to provide a map only for its type definitions,
/// or if you have to provide a writable map, but will not use the
/// data written to it...
template<typename K, typename T>
- class NullMap
+ class NullMap : public MapBase<K,T>
{
public:
- typedef K KeyType;
- typedef T ValueType;
T operator[](const K&) const { return T(); }
void set(const K&, const T&) {}
@@ -37,12 +47,10 @@
/// This is a readable map which assignes a specified value to each key.
/// In other aspects it is equivalent to the \ref NullMap
template<typename K, typename T>
- class ConstMap
+ class ConstMap : public MapBase<K,T>
{
T v;
public:
- typedef K KeyType;
- typedef T ValueType;
ConstMap() {}
ConstMap(const T &_v) : v(_v) {}
Modified: hugo/branches/hugo++/src/hugo/smart_graph.h
==============================================================================
--- hugo/branches/hugo++/src/hugo/smart_graph.h (original)
+++ hugo/branches/hugo++/src/hugo/smart_graph.h Thu Jul 22 17:07:51 2004
@@ -200,7 +200,7 @@
protected:
int n;
- friend int SmartGraph::id(Node v) const;
+ friend int SmartGraph::id(Node v);
Node(int nn) {n=nn;}
public:
Node() {}
@@ -240,7 +240,7 @@
friend class NodeIt;
protected:
int n;
- friend int SmartGraph::id(Edge e) const;
+ friend int SmartGraph::id(Edge e);
public:
/// An Edge with id \c n.
Modified: hugo/branches/hugo++/src/test/Makefile.am
==============================================================================
--- hugo/branches/hugo++/src/test/Makefile.am (original)
+++ hugo/branches/hugo++/src/test/Makefile.am Thu Jul 22 17:07:51 2004
@@ -1,10 +1,18 @@
AM_CPPFLAGS = -I$(top_srcdir)/src
-check_PROGRAMS = graph_test dijkstra_test time_measure_test
+noinst_HEADERS = test_tools.h
+
+check_PROGRAMS = graph_test dijkstra_test time_measure_test error_test xy_test \
+ test_tools_pass test_tools_fail
TESTS = $(check_PROGRAMS)
-XFAIL_TESTS =
+XFAIL_TESTS = test_tools_fail
+
+graph_test_SOURCES = graph_test.cc
+dijkstra_test_SOURCES = dijkstra_test.cc
+time_measure_test_SOURCES = time_measure_test.cc
+error_test_SOURCES = error_test.cc
+xy_test_SOURCES = xy_test.cc
+test_tools_pass_SOURCES = test_tools_pass.cc
+test_tools_fail_SOURCES = test_tools_fail.cc
-graph_test_SOURCES = graph_test.cc test_tools.h
-dijkstra_test_SOURCES = dijkstra_test.cc test_tools.h
-time_measure_test_SOURCES = time_measure_test.cc
\ No newline at end of file
Modified: hugo/branches/hugo++/src/test/error_test.cc
==============================================================================
--- hugo/branches/hugo++/src/test/error_test.cc (original)
+++ hugo/branches/hugo++/src/test/error_test.cc Thu Jul 22 17:07:51 2004
@@ -1,7 +1,7 @@
#include <iostream>
#include <hugo/error.h>
-
+#include "test_tools.h"
using namespace hugo;
using std::cout;
using std::endl;
@@ -21,37 +21,29 @@
int main() {
- bool no_errors = false;
-
try {
- cout << "Trying a faulty function\n";
faulty_fn();
- no_errors = true;
- cout << "FAILED!\n";
+ check(false, "A faulty function did not fail.");
}
catch(const Exception &e) {
- cout << "E: " << e.what() << endl;
+ cout << "Exeption = \"" << e.what() << "\" (Right behaviour)" << endl;
}
try {
- cout << "Trying a function throwing Exception\n";
exception_fn();
- no_errors = true;
- cout << "FAILED!\n";
+ check(false, "The function did not throw Exception.");
}
catch(const Exception &e) {
- cout << "E: " << e.what() << endl;
+ cout << "Exeption = \"" << e.what() << "\" (Right behaviour)" << endl;
}
try {
- cout << "Trying a function using FIXME\n";
unfinished_fn();
- no_errors = true;
- cout << "FAILED!\n";
+ check(false, "FIXME macro does not work.");
}
catch(const Exception &e) {
- cout << "E: " << e.what() << endl;
+ cout << "Exeption = \"" << e.what() << "\" (Right behaviour)" << endl;
}
- return no_errors ? 1 : 0;
+ return 0;
}
Modified: hugo/branches/hugo++/src/test/test_tools.h
==============================================================================
--- hugo/branches/hugo++/src/test/test_tools.h (original)
+++ hugo/branches/hugo++/src/test/test_tools.h Thu Jul 22 17:07:51 2004
@@ -38,11 +38,15 @@
std::vector<typename Graph::Edge> outcir, incir, chords;
};
+
+
///Adds a Petersen graph to \c G.
///Adds a Petersen graph to \c G.
///The nodes end edges will be listed in the return structure.
-template<class Graph> PetStruct<Graph> addPetersen(Graph &G,int num=5)
+
+template<typename Graph>
+PetStruct<Graph> addPetersen(Graph &G,int num=5)
{
PetStruct<Graph> n;
Modified: hugo/branches/hugo++/src/test/xy_test.cc
==============================================================================
--- hugo/branches/hugo++/src/test/xy_test.cc (original)
+++ hugo/branches/hugo++/src/test/xy_test.cc Thu Jul 22 17:07:51 2004
@@ -1,21 +1,9 @@
#include <hugo/xy.h>
#include <iostream>
+#include "test_tools.h"
+
using namespace std;
using namespace hugo;
-
-bool passed = true;
-
-void check(bool rc, char *msg="") {
- passed = passed && rc;
- if(!rc) {
- std::cerr << "Test failed! ("<< msg << ")" << std::endl; \
-
-
- }
-}
-
-
-
int main()
{
@@ -28,12 +16,12 @@
XY b(3,4);
seged = a+b;
- check(seged.x==4 && seged.y==6);
+ check(seged.x==4 && seged.y==6, "Wrong vector addition");
seged = a-b;
check(seged.x==-2 && seged.y==-2, "a-b");
- check(a.normSquare()==5);
+ check(a.normSquare()==5,"Wrong norm calculation");
check(a*b==11, "a*b");
int l=2;
@@ -58,23 +46,19 @@
"added points to box");
seged.x=2;seged.y=3;
- check(doboz1.inside(seged),"Inside? Should be.");
+ check(doboz1.inside(seged),"Inside? It should be.");
seged.x=1;seged.y=3;
- check(doboz1.inside(seged),"Inside? Should be.");
+ check(doboz1.inside(seged),"Inside? It should be.");
seged.x=0;seged.y=3;
- check(!doboz1.inside(seged),"Inside? Should not be.");
+ check(!doboz1.inside(seged),"Inside? It should not be.");
BB doboz2(seged);
- check(!doboz2.empty(), "empty? Should not be. Constructed from 1 point.");
+ check(!doboz2.empty(),
+ "empty? Should not be. Constructed from 1 point.");
doboz2 += doboz1;
- check(doboz2.inside(seged),"Inside? Should be. Incremented a box with an other.");
-
- cout << (passed ? "All tests passed." : "Some of the tests failed!!!")
- << endl;
-
- return passed ? 0 : 1;
-
+ check(doboz2.inside(seged),
+ "Not inside? It should be. Incremented a box with an other.");
}
Modified: hugo/branches/hugo++/src/work/Doxyfile
==============================================================================
--- hugo/branches/hugo++/src/work/Doxyfile (original)
+++ hugo/branches/hugo++/src/work/Doxyfile Thu Jul 22 17:07:51 2004
@@ -398,7 +398,7 @@
../hugo \
../hugo/skeletons \
../test/test_tools.h \
- alpar/path.h \
+ klao/path.h \
klao/debug.h \
jacint/max_flow.h \
jacint/max_matching.h \
@@ -407,9 +407,7 @@
jacint/graph_gen.h \
marci/max_bipartite_matching.h \
marci/bipartite_graph_wrapper.h \
- deba/map_registry.h \
- deba/map_defines.h \
- deba/array_map_factory.h \
+ deba \
johanna/kruskal.h \
More information about the Lemon-commits
mailing list