///////////////////////////////////////////////////////////////////////////// // // File: zmtBlockTest.cc // Purpose: Test platform for the class template Block // Author: Marc Paterno, adapted for Zoom by Walter Brown // ///////////////////////////////////////////////////////////////////////////// #include "ZMutility/ZMenvironment.h" #include "ZMtools/Block.h" #include #include #include #include #include #include #include class Trivial {}; int main( int argc, char const * argv[] ) { ZM_USING_NAMESPACE( std ) ZM_USING_NAMESPACE( zmt ) std::cout << argv[0] << std::endl; Block a = { 1, 2, 3 }; assert( a.size() == 3 ); assert( a.empty() == false ); assert( a.max_size() == 3 ); assert( a[0] == 1 ); assert( a[1] == 2 ); assert( a[2] == 3 ); Block b( a ); assert( a == b ); Block c = { 1, 2, 4 }; assert( !(a == c) ); assert( a < c ); Block triv; assert( triv.empty() == false ); Block f; #ifndef DEFECT_NO_PARTIAL_SPECIALIZATION assert( f.empty() ); #else std::cout << "This platform does not support partial specialization."; std::cout << std::endl; std::cout << "Thus Block may behave inadequately"; std::cout << std::endl; #endif // Uncomment the use of f[0] to test that use of operator[] on a // zero-size Block<> produces a compilation error, as required. // float x = f[0]; std::ostringstream buffer; std::copy( a.begin(), a.end(), std::ostream_iterator(buffer, " ") ); assert( buffer.str() == "1 2 3 " ); // note the trailing space std::cout << "OK" << std::endl; return 0; } // main()