diff --git a/test/maps_test.cc b/test/maps_test.cc --- a/test/maps_test.cc +++ b/test/maps_test.cc @@ -78,7 +78,7 @@ ConstMap map3 = map1; map1 = constMap(B()); map1.setAll(B()); - + checkConcept, ConstMap >(); check(constMap(10)[A()] == 10, "Something is wrong with ConstMap"); @@ -95,7 +95,7 @@ IdentityMap map1; IdentityMap map2 = map1; map1 = identityMap(); - + checkConcept, IdentityMap >(); check(identityMap()[1.0] == 1.0 && identityMap()[3.14] == 3.14, "Something is wrong with IdentityMap"); @@ -151,7 +151,7 @@ checkConcept, CompMap>(); CompMap map1(DoubleMap(),ReadMap()); CompMap map2 = composeMap(DoubleMap(), ReadMap()); - + SparseMap m1(false); m1[3.14] = true; RangeMap m2(2); m2[0] = 3.0; m2[1] = 3.14; check(!composeMap(m1,m2)[0] && composeMap(m1,m2)[1], "Something is wrong with ComposeMap") @@ -197,7 +197,7 @@ // ForkMap { checkConcept >(); - + typedef RangeMap RM; typedef SparseMap SM; RM m1(10, -1); @@ -210,7 +210,7 @@ check(m1[1] == -1 && m1[5] == 10 && m2[1] == -1 && m2[5] == 10 && map2[1] == -1 && map2[5] == 10, "Something is wrong with ForkMap"); } - + // Arithmetic maps: // - AddMap, SubMap, MulMap, DivMap // - ShiftMap, ShiftWriteMap, ScaleMap, ScaleWriteMap @@ -220,7 +220,7 @@ checkConcept >(); checkConcept >(); checkConcept >(); - + ConstMap c1(1.0), c2(3.14); IdentityMap im; ConvertMap, double> id(im); @@ -228,7 +228,7 @@ check(subMap(id,c1)[0] == -1.0 && subMap(id,c1)[10] == 9.0, "Something is wrong with SubMap"); check(mulMap(id,c2)[0] == 0 && mulMap(id,c2)[2] == 6.28, "Something is wrong with MulMap"); check(divMap(c2,id)[1] == 3.14 && divMap(c2,id)[2] == 1.57, "Something is wrong with DivMap"); - + checkConcept >(); checkConcept >(); checkConcept >(); @@ -252,16 +252,40 @@ check(absMap(id)[1] == 1.0 && absMap(id)[-10] == 10.0, "Something is wrong with AbsMap"); } - - // Logical maps + + // Logical maps: + // - TrueMap, FalseMap + // - AndMap, OrMap + // - NotMap, NotWriteMap + // - EqualMap, LessMap { + checkConcept >(); + checkConcept >(); + checkConcept >(); + checkConcept >(); checkConcept >(); checkConcept >(); - + checkConcept >(); + checkConcept >(); + + TrueMap tm; + FalseMap fm; RangeMap rm(2); rm[0] = true; rm[1] = false; - check(!(notMap(rm)[0]) && notMap(rm)[1], "Something is wrong with NotMap"); - check(!(notWriteMap(rm)[0]) && notWriteMap(rm)[1], "Something is wrong with NotWriteMap"); + check(andMap(tm,rm)[0] && !andMap(tm,rm)[1] && !andMap(fm,rm)[0] && !andMap(fm,rm)[1], + "Something is wrong with AndMap"); + check(orMap(tm,rm)[0] && orMap(tm,rm)[1] && orMap(fm,rm)[0] && !orMap(fm,rm)[1], + "Something is wrong with OrMap"); + check(!notMap(rm)[0] && notMap(rm)[1], "Something is wrong with NotMap"); + check(!notWriteMap(rm)[0] && notWriteMap(rm)[1], "Something is wrong with NotWriteMap"); + + ConstMap cm(2.0); + IdentityMap im; + ConvertMap, double> id(im); + check(lessMap(id,cm)[1] && !lessMap(id,cm)[2] && !lessMap(id,cm)[3], + "Something is wrong with LessMap"); + check(!equalMap(id,cm)[1] && equalMap(id,cm)[2] && !equalMap(id,cm)[3], + "Something is wrong with EqualMap"); } return 0;