test/maps_test.cc
changeset 123 8899d1891a3c
parent 94 a4688e4138ec
child 136 b82dc494bafc
equal deleted inserted replaced
4:4319df6b7123 5:8eb163a43315
    81   }
    81   }
    82 
    82 
    83   // ConstMap
    83   // ConstMap
    84   {
    84   {
    85     checkConcept<ReadWriteMap<A,B>, ConstMap<A,B> >();
    85     checkConcept<ReadWriteMap<A,B>, ConstMap<A,B> >();
       
    86     checkConcept<ReadWriteMap<A,C>, ConstMap<A,C> >();
    86     ConstMap<A,B> map1;
    87     ConstMap<A,B> map1;
    87     ConstMap<A,B> map2(B());
    88     ConstMap<A,B> map2(B());
    88     ConstMap<A,B> map3 = map1;
    89     ConstMap<A,B> map3 = map1;
    89     map1 = constMap<A>(B());
    90     map1 = constMap<A>(B());
       
    91     map1 = constMap<A,B>();
    90     map1.setAll(B());
    92     map1.setAll(B());
       
    93     ConstMap<A,C> map4(C(1));
       
    94     ConstMap<A,C> map5 = map4;
       
    95     map4 = constMap<A>(C(2));
       
    96     map4.setAll(C(3));
    91 
    97 
    92     checkConcept<ReadWriteMap<A,int>, ConstMap<A,int> >();
    98     checkConcept<ReadWriteMap<A,int>, ConstMap<A,int> >();
    93     check(constMap<A>(10)[A()] == 10, "Something is wrong with ConstMap");
    99     check(constMap<A>(10)[A()] == 10, "Something is wrong with ConstMap");
    94 
   100 
    95     checkConcept<ReadWriteMap<A,int>, ConstMap<A,Const<int,10> > >();
   101     checkConcept<ReadWriteMap<A,int>, ConstMap<A,Const<int,10> > >();
    96     ConstMap<A,Const<int,10> > map4;
   102     ConstMap<A,Const<int,10> > map6;
    97     ConstMap<A,Const<int,10> > map5 = map4;
   103     ConstMap<A,Const<int,10> > map7 = map6;
    98     map4 = map5;
   104     map6 = constMap<A,int,10>();
    99     check(map4[A()] == 10 && map5[A()] == 10, "Something is wrong with ConstMap");
   105     map7 = constMap<A,Const<int,10> >();
       
   106     check(map6[A()] == 10 && map7[A()] == 10, "Something is wrong with ConstMap");
   100   }
   107   }
   101 
   108 
   102   // IdentityMap
   109   // IdentityMap
   103   {
   110   {
   104     checkConcept<ReadMap<A,A>, IdentityMap<A> >();
   111     checkConcept<ReadMap<A,A>, IdentityMap<A> >();