test/maps_test.cc
changeset 210 81cfc04531e8
parent 209 765619b7cbb2
child 463 88ed40ad0d4f
child 500 2b6a20528f35
     1.1 --- a/test/maps_test.cc	Sun Jul 13 19:51:02 2008 +0100
     1.2 +++ b/test/maps_test.cc	Sun Jul 13 20:09:47 2008 +0100
     1.3 @@ -103,7 +103,8 @@
     1.4      ConstMap<A,Const<int,10> > map7 = map6;
     1.5      map6 = constMap<A,int,10>();
     1.6      map7 = constMap<A,Const<int,10> >();
     1.7 -    check(map6[A()] == 10 && map7[A()] == 10, "Something is wrong with ConstMap");
     1.8 +    check(map6[A()] == 10 && map7[A()] == 10,
     1.9 +          "Something is wrong with ConstMap");
    1.10    }
    1.11  
    1.12    // IdentityMap
    1.13 @@ -114,7 +115,8 @@
    1.14      map1 = identityMap<A>();
    1.15  
    1.16      checkConcept<ReadMap<double,double>, IdentityMap<double> >();
    1.17 -    check(identityMap<double>()[1.0] == 1.0 && identityMap<double>()[3.14] == 3.14,
    1.18 +    check(identityMap<double>()[1.0] == 1.0 &&
    1.19 +          identityMap<double>()[3.14] == 3.14,
    1.20            "Something is wrong with IdentityMap");
    1.21    }
    1.22  
    1.23 @@ -155,10 +157,12 @@
    1.24      SparseMap<double, int> map7 = sparseMap(m);
    1.25      SparseMap<double, int> map8 = sparseMap(m,10);
    1.26  
    1.27 -    check(map5[1.0] == 0 && map5[3.14] == 0 && map6[1.0] == 10 && map6[3.14] == 10,
    1.28 +    check(map5[1.0] == 0 && map5[3.14] == 0 &&
    1.29 +          map6[1.0] == 10 && map6[3.14] == 10,
    1.30            "Something is wrong with SparseMap");
    1.31      map5[1.0] = map6[3.14] = 100;
    1.32 -    check(map5[1.0] == 100 && map5[3.14] == 0 && map6[1.0] == 10 && map6[3.14] == 100,
    1.33 +    check(map5[1.0] == 100 && map5[3.14] == 0 &&
    1.34 +          map6[1.0] == 10 && map6[3.14] == 100,
    1.35            "Something is wrong with SparseMap");
    1.36    }
    1.37  
    1.38 @@ -171,7 +175,8 @@
    1.39  
    1.40      SparseMap<double, bool> m1(false); m1[3.14] = true;
    1.41      RangeMap<double> m2(2); m2[0] = 3.0; m2[1] = 3.14;
    1.42 -    check(!composeMap(m1,m2)[0] && composeMap(m1,m2)[1], "Something is wrong with ComposeMap")
    1.43 +    check(!composeMap(m1,m2)[0] && composeMap(m1,m2)[1],
    1.44 +          "Something is wrong with ComposeMap")
    1.45    }
    1.46  
    1.47    // CombineMap
    1.48 @@ -196,9 +201,12 @@
    1.49      checkConcept<ReadMap<A,B>, MapToFunctor<ReadMap<A,B> > >();
    1.50      MapToFunctor<ReadMap<A,B> > map(ReadMap<A,B>());
    1.51  
    1.52 -    check(functorToMap(&func)[A()] == 3, "Something is wrong with FunctorToMap");
    1.53 -    check(mapToFunctor(constMap<A,int>(2))(A()) == 2, "Something is wrong with MapToFunctor");
    1.54 -    check(mapToFunctor(functorToMap(&func))(A()) == 3 && mapToFunctor(functorToMap(&func))[A()] == 3,
    1.55 +    check(functorToMap(&func)[A()] == 3,
    1.56 +          "Something is wrong with FunctorToMap");
    1.57 +    check(mapToFunctor(constMap<A,int>(2))(A()) == 2,
    1.58 +          "Something is wrong with MapToFunctor");
    1.59 +    check(mapToFunctor(functorToMap(&func))(A()) == 3 &&
    1.60 +          mapToFunctor(functorToMap(&func))[A()] == 3,
    1.61            "Something is wrong with FunctorToMap or MapToFunctor");
    1.62      check(functorToMap(mapToFunctor(constMap<A,int>(2)))[A()] == 2,
    1.63            "Something is wrong with FunctorToMap or MapToFunctor");
    1.64 @@ -206,7 +214,8 @@
    1.65  
    1.66    // ConvertMap
    1.67    {
    1.68 -    checkConcept<ReadMap<double,double>, ConvertMap<ReadMap<double, int>, double> >();
    1.69 +    checkConcept<ReadMap<double,double>,
    1.70 +      ConvertMap<ReadMap<double, int>, double> >();
    1.71      ConvertMap<RangeMap<bool>, int> map1(rangeMap(1, true));
    1.72      ConvertMap<RangeMap<bool>, int> map2 = convertMap<int>(rangeMap(2, false));
    1.73    }
    1.74 @@ -224,7 +233,8 @@
    1.75      ForkMap<RM, SM> map1(m1,m2);
    1.76      ForkMap<SM, RM> map2 = forkMap(m2,m1);
    1.77      map2.set(5, 10);
    1.78 -    check(m1[1] == -1 && m1[5] == 10 && m2[1] == -1 && m2[5] == 10 && map2[1] == -1 && map2[5] == 10,
    1.79 +    check(m1[1] == -1 && m1[5] == 10 && m2[1] == -1 &&
    1.80 +          m2[5] == 10 && map2[1] == -1 && map2[5] == 10,
    1.81            "Something is wrong with ForkMap");
    1.82    }
    1.83  
    1.84 @@ -241,10 +251,14 @@
    1.85      ConstMap<int, double> c1(1.0), c2(3.14);
    1.86      IdentityMap<int> im;
    1.87      ConvertMap<IdentityMap<int>, double> id(im);
    1.88 -    check(addMap(c1,id)[0] == 1.0  && addMap(c1,id)[10] == 11.0, "Something is wrong with AddMap");
    1.89 -    check(subMap(id,c1)[0] == -1.0 && subMap(id,c1)[10] == 9.0,  "Something is wrong with SubMap");
    1.90 -    check(mulMap(id,c2)[0] == 0    && mulMap(id,c2)[2]  == 6.28, "Something is wrong with MulMap");
    1.91 -    check(divMap(c2,id)[1] == 3.14 && divMap(c2,id)[2]  == 1.57, "Something is wrong with DivMap");
    1.92 +    check(addMap(c1,id)[0] == 1.0  && addMap(c1,id)[10] == 11.0,
    1.93 +          "Something is wrong with AddMap");
    1.94 +    check(subMap(id,c1)[0] == -1.0 && subMap(id,c1)[10] == 9.0,
    1.95 +          "Something is wrong with SubMap");
    1.96 +    check(mulMap(id,c2)[0] == 0    && mulMap(id,c2)[2]  == 6.28,
    1.97 +          "Something is wrong with MulMap");
    1.98 +    check(divMap(c2,id)[1] == 3.14 && divMap(c2,id)[2]  == 1.57,
    1.99 +          "Something is wrong with DivMap");
   1.100  
   1.101      checkConcept<DoubleMap, ShiftMap<DoubleMap> >();
   1.102      checkConcept<DoubleWriteMap, ShiftWriteMap<DoubleWriteMap> >();
   1.103 @@ -256,11 +270,13 @@
   1.104  
   1.105      check(shiftMap(id, 2.0)[1] == 3.0 && shiftMap(id, 2.0)[10] == 12.0,
   1.106            "Something is wrong with ShiftMap");
   1.107 -    check(shiftWriteMap(id, 2.0)[1] == 3.0 && shiftWriteMap(id, 2.0)[10] == 12.0,
   1.108 +    check(shiftWriteMap(id, 2.0)[1] == 3.0 &&
   1.109 +          shiftWriteMap(id, 2.0)[10] == 12.0,
   1.110            "Something is wrong with ShiftWriteMap");
   1.111      check(scaleMap(id, 2.0)[1] == 2.0 && scaleMap(id, 2.0)[10] == 20.0,
   1.112            "Something is wrong with ScaleMap");
   1.113 -    check(scaleWriteMap(id, 2.0)[1] == 2.0 && scaleWriteMap(id, 2.0)[10] == 20.0,
   1.114 +    check(scaleWriteMap(id, 2.0)[1] == 2.0 &&
   1.115 +          scaleWriteMap(id, 2.0)[10] == 20.0,
   1.116            "Something is wrong with ScaleWriteMap");
   1.117      check(negMap(id)[1] == -1.0 && negMap(id)[-10] == 10.0,
   1.118            "Something is wrong with NegMap");
   1.119 @@ -289,12 +305,16 @@
   1.120      FalseMap<int> fm;
   1.121      RangeMap<bool> rm(2);
   1.122      rm[0] = true; rm[1] = false;
   1.123 -    check(andMap(tm,rm)[0] && !andMap(tm,rm)[1] && !andMap(fm,rm)[0] && !andMap(fm,rm)[1],
   1.124 +    check(andMap(tm,rm)[0] && !andMap(tm,rm)[1] &&
   1.125 +          !andMap(fm,rm)[0] && !andMap(fm,rm)[1],
   1.126            "Something is wrong with AndMap");
   1.127 -    check(orMap(tm,rm)[0] && orMap(tm,rm)[1] && orMap(fm,rm)[0] && !orMap(fm,rm)[1],
   1.128 +    check(orMap(tm,rm)[0] && orMap(tm,rm)[1] &&
   1.129 +          orMap(fm,rm)[0] && !orMap(fm,rm)[1],
   1.130            "Something is wrong with OrMap");
   1.131 -    check(!notMap(rm)[0] && notMap(rm)[1], "Something is wrong with NotMap");
   1.132 -    check(!notWriteMap(rm)[0] && notWriteMap(rm)[1], "Something is wrong with NotWriteMap");
   1.133 +    check(!notMap(rm)[0] && notMap(rm)[1],
   1.134 +          "Something is wrong with NotMap");
   1.135 +    check(!notWriteMap(rm)[0] && notWriteMap(rm)[1],
   1.136 +          "Something is wrong with NotWriteMap");
   1.137  
   1.138      ConstMap<int, double> cm(2.0);
   1.139      IdentityMap<int> im;
   1.140 @@ -310,7 +330,8 @@
   1.141      typedef std::vector<int> vec;
   1.142      vec v1;
   1.143      vec v2(10);
   1.144 -    LoggerBoolMap<std::back_insert_iterator<vec> > map1(std::back_inserter(v1));
   1.145 +    LoggerBoolMap<std::back_insert_iterator<vec> >
   1.146 +      map1(std::back_inserter(v1));
   1.147      LoggerBoolMap<vec::iterator> map2(v2.begin());
   1.148      map1.set(10, false);
   1.149      map1.set(20, true);   map2.set(20, true);
   1.150 @@ -318,7 +339,8 @@
   1.151      map1.set(50, true);   map2.set(50, true);
   1.152      map1.set(60, true);   map2.set(60, true);
   1.153      check(v1.size() == 3 && v2.size() == 10 &&
   1.154 -          v1[0]==20 && v1[1]==50 && v1[2]==60 && v2[0]==20 && v2[1]==50 && v2[2]==60,
   1.155 +          v1[0]==20 && v1[1]==50 && v1[2]==60 &&
   1.156 +          v2[0]==20 && v2[1]==50 && v2[2]==60,
   1.157            "Something is wrong with LoggerBoolMap");
   1.158  
   1.159      int i = 0;