diff -r 33db14058543 -r dacc4ce9474d test/matrix_maps_test.cc --- a/test/matrix_maps_test.cc Tue Apr 04 17:45:35 2006 +0000 +++ b/test/matrix_maps_test.cc Thu Apr 06 09:33:29 2006 +0000 @@ -40,6 +40,7 @@ int main() { typedef SmartGraph Graph; typedef Graph::Node Node; + typedef Graph::Edge Edge; { // checking MatrixMap for int typedef DynamicMatrixMap IntMatrixMap; @@ -124,6 +125,95 @@ } } + { // checking MatrixMap for int + typedef DynamicAsymMatrixMap IntMatrixMap; + checkConcept, + IntMatrixMap>(); + + } + + { // checking MatrixMap for bool + typedef DynamicAsymMatrixMap BoolMatrixMap; + checkConcept, + BoolMatrixMap>(); + + } + + { + Graph graph1, graph2; + typedef DynamicAsymMatrixMap IntMatrixMap; + IntMatrixMap matrix(graph1, graph2); + for (int i = 0; i < 10; ++i) { + graph1.addNode(); + } + graph2.addNode(); + for (int i = 0; i < 20; ++i) { + graph2.addEdge(Graph::NodeIt(graph2), Graph::NodeIt(graph2)); + } + for (Graph::NodeIt it(graph1); it != INVALID; ++it) { + for (Graph::EdgeIt jt(graph2); jt != INVALID; ++jt) { + int val = urandom(100); + matrix.set(it, jt, val); + check(matrix(it, jt) == val, "Wrong assign"); + check(matrix(it, jt) == matrixRowMap(matrix, it)[jt], "Wrong rowMap"); + check(matrix(it, jt) == matrixColMap(matrix, jt)[it], "Wrong colMap"); + } + } + const IntMatrixMap& cm = matrix; + for (Graph::NodeIt it(graph1); it != INVALID; ++it) { + for (Graph::EdgeIt jt(graph2); jt != INVALID; ++jt) { + check(cm(it, jt) == matrixRowMap(cm, it)[jt], "Wrong rowMap"); + check(cm(it, jt) == matrixColMap(cm, jt)[it], "Wrong colMap"); + } + } + } + + { // checking MatrixMap for int + typedef DynamicAsymMatrixMap IntMatrixMap; + checkConcept, + IntMatrixMap>(); + + } + + { // checking MatrixMap for bool + typedef DynamicAsymMatrixMap BoolMatrixMap; + checkConcept, + BoolMatrixMap>(); + + } + + { + Graph graph; + typedef DynamicAsymMatrixMap IntMatrixMap; + IntMatrixMap matrix(graph, graph); + for (int i = 0; i < 10; ++i) { + graph.addNode(); + } + for (int i = 0; i < 20; ++i) { + graph.addEdge(Graph::NodeIt(graph), Graph::NodeIt(graph)); + } + for (Graph::NodeIt it(graph); it != INVALID; ++it) { + for (Graph::NodeIt jt(graph); jt != INVALID; ++jt) { + int val = urandom(100); + matrix.set(it, jt, val); + check(matrix(it, jt) == val, "Wrong assign"); + check(matrix(it, jt) == matrixRowMap(matrix, it)[jt], "Wrong rowMap"); + check(matrix(it, jt) == matrixColMap(matrix, jt)[it], "Wrong colMap"); + } + } + const IntMatrixMap& cm = matrix; + for (Graph::NodeIt it(graph); it != INVALID; ++it) { + for (Graph::NodeIt jt(graph); jt != INVALID; ++jt) { + check(cm(it, jt) == matrixRowMap(cm, it)[jt], "Wrong rowMap"); + check(cm(it, jt) == matrixColMap(cm, jt)[it], "Wrong colMap"); + } + } + } + std::cout << __FILE__ ": All tests passed.\n"; return 0;