diff --git a/test/hasfacettest.cpp b/test/hasfacettest.cpp index 05676f0..448eba9 100644 --- a/test/hasfacettest.cpp +++ b/test/hasfacettest.cpp @@ -6,7 +6,9 @@ #include #include +#include "../include/crap/locale.d/moneypunct.h" #include "../include/crap/locale.d/numpunct.h" +#include "../include/crap/utility.d/typelist.h" struct empty {}; @@ -15,45 +17,60 @@ template struct withFacet using facet = Type; }; -template bool test_hasFacetNumpunct() +template class Facet> bool test_hasFacet() { //Negative tests: //No facet tests. - static_assert(!(crap :: hasFacet , void> :: value), "Void has no facet."); - static_assert(!(crap :: hasFacet , empty> :: value), "Empty has no facet."); - static_assert(!(crap :: hasFacet , void> :: value), "Void has no facet."); - static_assert(!(crap :: hasFacet , empty> :: value), "Empty has no facet."); + static_assert(!(crap :: hasFacet , void> :: value), "Void has no facet."); + static_assert(!(crap :: hasFacet , empty> :: value), "Empty has no facet."); //Invalid facet tests. - static_assert(!(crap :: hasFacet , withFacet > :: value), "Facet is void."); - static_assert(!(crap :: hasFacet , withFacet > :: value), "Facet is empty."); - static_assert(!(crap :: hasFacet , withFacet > > :: value), - "Facet is not having numpunct."); - static_assert(!(crap :: hasFacet , withFacet > > :: value), - "Facet is not having numpunct."); - static_assert(!(crap :: hasFacet , withFacet > > :: value), - "Facet is not having numpunct."); - static_assert(!(crap :: hasFacet , withFacet > > :: value), - "Facet is not having numpunct."); - static_assert(!(crap :: hasFacet , withFacet, crap :: numpunct> > > :: value), - "Facet is having many numpunct."); - static_assert(!(crap :: hasFacet , withFacet, void, crap :: numpunct> > > :: value), - "Facet is having many numpunct."); + static_assert(!(crap :: hasFacet , withFacet > :: value), "Facet is void."); + static_assert(!(crap :: hasFacet , withFacet > :: value), "Facet is empty."); + static_assert(!(crap :: hasFacet , withFacet > > :: value), + "Facet is not having proper facet type."); + static_assert(!(crap :: hasFacet , withFacet > > :: value), + "Facet is not having proper facet type."); + static_assert(!(crap :: hasFacet , withFacet > > :: value), + "Facet is not having proper facet type."); + static_assert(!(crap :: hasFacet , withFacet > > :: value), + "Facet is not having proper facet type."); + static_assert(!(crap :: hasFacet , withFacet > > :: value), + "Facet is not having proper facet type."); + static_assert(!(crap :: hasFacet , withFacet > > :: value), + "Facet is not having proper facet type."); + static_assert(!(crap :: hasFacet , withFacet > > :: value), + "Facet is not having proper facet type."); + static_assert(!(crap :: hasFacet , withFacet, Facet > > > :: value), + "Facet is having many proper facet types."); + static_assert(!(crap :: hasFacet , withFacet, void, Facet > > > :: value), + "Facet is having many proper facet types."); + static_assert(!(crap :: hasFacet , withFacet, void, Facet > > > :: value), + "Facet is having many proper facet types."); //Positive tests: //Valid facet tests. - static_assert(crap :: hasFacet , withFacet > > :: value, "Facet correct."); - static_assert(crap :: hasFacet , withFacet, void> > > :: value, + static_assert(crap :: hasFacet , withFacet > > :: value, "Facet correct."); + static_assert(crap :: hasFacet , withFacet, void> > > :: value, "Facet correct."); - static_assert(crap :: hasFacet , withFacet, void> > > :: value, + static_assert(crap :: hasFacet , withFacet, void> > > :: value, + "Facet correct."); + static_assert(crap :: hasFacet , withFacet, void> > > :: value, "Facet correct."); return true; } +template using moneypunctInternational = crap :: moneypunct; +template using moneypunctShort = crap :: moneypunct; + int main() { const bool results[] = { - test_hasFacetNumpunct(), - test_hasFacetNumpunct() + test_hasFacet(), + test_hasFacet(), + test_hasFacet(), + test_hasFacet(), + test_hasFacet(), + test_hasFacet() }; return std :: accumulate(std :: begin(results), std :: end(results), true, std :: logical_and()) ? EXIT_SUCCESS