Compare commits

...

2 Commits

Author SHA1 Message Date
c25eb45a74 This commit was manufactured by cvs2svn to create branch 'conversion'.
[SVN r7663]
2000-07-30 10:33:54 +00:00
3607f5bec8 This commit was manufactured by cvs2svn to create branch
'iterator-adaptors'.

[SVN r7633]
2000-07-26 20:32:15 +00:00
3 changed files with 0 additions and 333 deletions

View File

@ -1,74 +0,0 @@
// boost cstdint.hpp test program ------------------------------------------//
// (C) Copyright Beman Dawes 2000. Permission to copy, use, modify, sell
// and distribute this software is granted provided this copyright
// notice appears in all copies. This software is provided "as is" without
// express or implied warranty, and with no claim as to its suitability for
// any purpose.
// See http://www.boost.org for most recent version including documentation.
// Revision History
// 28 Jun 00 Initial version
#include <boost/cstdint.hpp>
#include <cassert>
#include <iostream>
#ifdef NDEBUG
#error This test makes no sense with NDEBUG defined
#endif
int main()
{
boost::int8_t int8 = -127;
boost::int_least8_t int_least8 = -127;
boost::int_fast8_t int_fast8 = -127;
boost::uint8_t uint8 = 255;
boost::uint_least8_t uint_least8 = 255;
boost::uint_fast8_t uint_fast8 = 255;
boost::int16_t int16 = -32767;
boost::int_least16_t int_least16 = -32767;
boost::int_fast16_t int_fast16 = -32767;
boost::uint16_t uint16 = 65535;
boost::uint_least16_t uint_least16 = 65535;
boost::uint_fast16_t uint_fast16 = 65535;
boost::int32_t int32 = -2147483647;
boost::int_least32_t int_least32 = -2147483647;
boost::int_fast32_t int_fast32 = -2147483647;
boost::uint32_t uint32 = 4294967295;
boost::uint_least32_t uint_least32 = 4294967295;
boost::uint_fast32_t uint_fast32 = 4294967295;
boost::intmax_t intmax = -2147483647;
boost::uintmax_t uintmax = 4294967295;
assert( int8 == -127 );
assert( int_least8 == -127 );
assert( int_fast8 == -127 );
assert( uint8 == 255 );
assert( uint_least8 == 255 );
assert( uint_fast8 == 255 );
assert( int16 == -32767 );
assert( int_least16 == -32767 );
assert( int_fast16 == -32767 );
assert( uint16 == 65535 );
assert( uint_least16 == 65535 );
assert( uint_fast16 == 65535 );
assert( int32 == -2147483647 );
assert( int_least32 == -2147483647 );
assert( int_fast32 == -2147483647 );
assert( uint32 == 4294967295 );
assert( uint_least32 == 4294967295 );
assert( uint_fast32 == 4294967295 );
assert( intmax == -2147483647 );
assert( uintmax == 4294967295 );
std::cout << "OK\n";
return 0;
}

View File

@ -1,176 +0,0 @@
// boost integer.hpp test program ------------------------------------------//
// (C) Copyright Beman Dawes 1999. Permission to copy, use, modify, sell
// and distribute this software is granted provided this copyright
// notice appears in all copies. This software is provided "as is" without
// express or implied warranty, and with no claim as to its suitability for
// any purpose.
// See http://www.boost.org for most recent version including documentation.
// Revision History
// 31 Aug 99 Initial version
// This program is misnamed in that it is really a demonstration rather than
// a test. It doesn't detect failure, so isn't worthy of the name "test".
#include <iostream>
#include <boost/integer.hpp>
using namespace boost; // not the best practice, but useful for testing
namespace
{
void test( long ) { std::cout << "long\n"; }
void test( int ) { std::cout << "int\n"; }
void test( short ) { std::cout << "short\n"; }
void test( signed char ) { std::cout << "signed char\n"; }
void test( unsigned long ) { std::cout << "unsigned long\n"; }
void test( unsigned int ) { std::cout << "unsigned int\n"; }
void test( unsigned short ) { std::cout << "unsigned short\n"; }
void test( unsigned char ) { std::cout << "unsigned char\n"; }
} // unnamed namespace
// just to prove it works, specialize int_fast_t<short> to yield long
namespace boost
{
template<> struct int_fast_t<short> { typedef long fast; };
}
int main()
{
std::cout << 32 << ' '; test( int_t<32>::least() );
std::cout << 31 << ' '; test( int_t<31>::least() );
std::cout << 30 << ' '; test( int_t<30>::least() );
std::cout << 29 << ' '; test( int_t<29>::least() );
std::cout << 28 << ' '; test( int_t<28>::least() );
std::cout << 27 << ' '; test( int_t<27>::least() );
std::cout << 26 << ' '; test( int_t<26>::least() );
std::cout << 25 << ' '; test( int_t<25>::least() );
std::cout << 24 << ' '; test( int_t<24>::least() );
std::cout << 23 << ' '; test( int_t<23>::least() );
std::cout << 22 << ' '; test( int_t<22>::least() );
std::cout << 21 << ' '; test( int_t<21>::least() );
std::cout << 20 << ' '; test( int_t<20>::least() );
std::cout << 19 << ' '; test( int_t<19>::least() );
std::cout << 18 << ' '; test( int_t<18>::least() );
std::cout << 17 << ' '; test( int_t<17>::least() );
std::cout << 16 << ' '; test( int_t<16>::least() );
std::cout << 15 << ' '; test( int_t<15>::least() );
std::cout << 14 << ' '; test( int_t<14>::least() );
std::cout << 13 << ' '; test( int_t<13>::least() );
std::cout << 12 << ' '; test( int_t<12>::least() );
std::cout << 11 << ' '; test( int_t<11>::least() );
std::cout << 10 << ' '; test( int_t<10>::least() );
std::cout << 9 << ' '; test( int_t<9>::least() );
std::cout << 8 << ' '; test( int_t<8>::least() );
std::cout << 7 << ' '; test( int_t<7>::least() );
std::cout << 6 << ' '; test( int_t<6>::least() );
std::cout << 5 << ' '; test( int_t<5>::least() );
std::cout << 4 << ' '; test( int_t<4>::least() );
std::cout << 3 << ' '; test( int_t<3>::least() );
std::cout << 2 << ' '; test( int_t<2>::least() );
std::cout << 1 << ' '; test( int_t<1>::least() );
std::cout << 0 << ' '; test( int_t<0>::least() );
std::cout << 32 << ' '; test( int_t<32>::fast() );
std::cout << 31 << ' '; test( int_t<31>::fast() );
std::cout << 30 << ' '; test( int_t<30>::fast() );
std::cout << 29 << ' '; test( int_t<29>::fast() );
std::cout << 28 << ' '; test( int_t<28>::fast() );
std::cout << 27 << ' '; test( int_t<27>::fast() );
std::cout << 26 << ' '; test( int_t<26>::fast() );
std::cout << 25 << ' '; test( int_t<25>::fast() );
std::cout << 24 << ' '; test( int_t<24>::fast() );
std::cout << 23 << ' '; test( int_t<23>::fast() );
std::cout << 22 << ' '; test( int_t<22>::fast() );
std::cout << 21 << ' '; test( int_t<21>::fast() );
std::cout << 20 << ' '; test( int_t<20>::fast() );
std::cout << 19 << ' '; test( int_t<19>::fast() );
std::cout << 18 << ' '; test( int_t<18>::fast() );
std::cout << 17 << ' '; test( int_t<17>::fast() );
std::cout << 16 << ' '; test( int_t<16>::fast() );
std::cout << 15 << ' '; test( int_t<15>::fast() );
std::cout << 14 << ' '; test( int_t<14>::fast() );
std::cout << 13 << ' '; test( int_t<13>::fast() );
std::cout << 12 << ' '; test( int_t<12>::fast() );
std::cout << 11 << ' '; test( int_t<11>::fast() );
std::cout << 10 << ' '; test( int_t<10>::fast() );
std::cout << 9 << ' '; test( int_t<9>::fast() );
std::cout << 8 << ' '; test( int_t<8>::fast() );
std::cout << 7 << ' '; test( int_t<7>::fast() );
std::cout << 6 << ' '; test( int_t<6>::fast() );
std::cout << 5 << ' '; test( int_t<5>::fast() );
std::cout << 4 << ' '; test( int_t<4>::fast() );
std::cout << 3 << ' '; test( int_t<3>::fast() );
std::cout << 2 << ' '; test( int_t<2>::fast() );
std::cout << 1 << ' '; test( int_t<1>::fast() );
std::cout << 0 << ' '; test( int_t<0>::fast() );
std::cout << 32 << ' '; test( uint_t<32>::least() );
std::cout << 31 << ' '; test( uint_t<31>::least() );
std::cout << 30 << ' '; test( uint_t<30>::least() );
std::cout << 29 << ' '; test( uint_t<29>::least() );
std::cout << 28 << ' '; test( uint_t<28>::least() );
std::cout << 27 << ' '; test( uint_t<27>::least() );
std::cout << 26 << ' '; test( uint_t<26>::least() );
std::cout << 25 << ' '; test( uint_t<25>::least() );
std::cout << 24 << ' '; test( uint_t<24>::least() );
std::cout << 23 << ' '; test( uint_t<23>::least() );
std::cout << 22 << ' '; test( uint_t<22>::least() );
std::cout << 21 << ' '; test( uint_t<21>::least() );
std::cout << 20 << ' '; test( uint_t<20>::least() );
std::cout << 19 << ' '; test( uint_t<19>::least() );
std::cout << 18 << ' '; test( uint_t<18>::least() );
std::cout << 17 << ' '; test( uint_t<17>::least() );
std::cout << 16 << ' '; test( uint_t<16>::least() );
std::cout << 15 << ' '; test( uint_t<15>::least() );
std::cout << 14 << ' '; test( uint_t<14>::least() );
std::cout << 13 << ' '; test( uint_t<13>::least() );
std::cout << 12 << ' '; test( uint_t<12>::least() );
std::cout << 11 << ' '; test( uint_t<11>::least() );
std::cout << 10 << ' '; test( uint_t<10>::least() );
std::cout << 9 << ' '; test( uint_t<9>::least() );
std::cout << 8 << ' '; test( uint_t<8>::least() );
std::cout << 7 << ' '; test( uint_t<7>::least() );
std::cout << 6 << ' '; test( uint_t<6>::least() );
std::cout << 5 << ' '; test( uint_t<5>::least() );
std::cout << 4 << ' '; test( uint_t<4>::least() );
std::cout << 3 << ' '; test( uint_t<3>::least() );
std::cout << 2 << ' '; test( uint_t<2>::least() );
std::cout << 1 << ' '; test( uint_t<1>::least() );
std::cout << 0 << ' '; test( uint_t<0>::least() );
std::cout << 32 << ' '; test( uint_t<32>::fast() );
std::cout << 31 << ' '; test( uint_t<31>::fast() );
std::cout << 30 << ' '; test( uint_t<30>::fast() );
std::cout << 29 << ' '; test( uint_t<29>::fast() );
std::cout << 28 << ' '; test( uint_t<28>::fast() );
std::cout << 27 << ' '; test( uint_t<27>::fast() );
std::cout << 26 << ' '; test( uint_t<26>::fast() );
std::cout << 25 << ' '; test( uint_t<25>::fast() );
std::cout << 24 << ' '; test( uint_t<24>::fast() );
std::cout << 23 << ' '; test( uint_t<23>::fast() );
std::cout << 22 << ' '; test( uint_t<22>::fast() );
std::cout << 21 << ' '; test( uint_t<21>::fast() );
std::cout << 20 << ' '; test( uint_t<20>::fast() );
std::cout << 19 << ' '; test( uint_t<19>::fast() );
std::cout << 18 << ' '; test( uint_t<18>::fast() );
std::cout << 17 << ' '; test( uint_t<17>::fast() );
std::cout << 16 << ' '; test( uint_t<16>::fast() );
std::cout << 15 << ' '; test( uint_t<15>::fast() );
std::cout << 14 << ' '; test( uint_t<14>::fast() );
std::cout << 13 << ' '; test( uint_t<13>::fast() );
std::cout << 12 << ' '; test( uint_t<12>::fast() );
std::cout << 11 << ' '; test( uint_t<11>::fast() );
std::cout << 10 << ' '; test( uint_t<10>::fast() );
std::cout << 9 << ' '; test( uint_t<9>::fast() );
std::cout << 8 << ' '; test( uint_t<8>::fast() );
std::cout << 7 << ' '; test( uint_t<7>::fast() );
std::cout << 6 << ' '; test( uint_t<6>::fast() );
std::cout << 5 << ' '; test( uint_t<5>::fast() );
std::cout << 4 << ' '; test( uint_t<4>::fast() );
std::cout << 3 << ' '; test( uint_t<3>::fast() );
std::cout << 2 << ' '; test( uint_t<2>::fast() );
std::cout << 1 << ' '; test( uint_t<1>::fast() );
std::cout << 0 << ' '; test( uint_t<0>::fast() );
return 0;
}

View File

@ -1,83 +0,0 @@
/* boost integer_traits.hpp tests
*
* Copyright Jens Maurer 2000
* Permission to use, copy, modify, sell, and distribute this software
* is hereby granted without free provided that the above copyright notice
* appears in all copies and that both that copyright notice and this
* permission notice appear in supporting documentation,
*
* Jens Maurer makes no representations about the suitability of this
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*
* $Id$
*
* Revision history
* 2000-02-22 Small improvements by Beman Dawes
* 2000-06-27 Rework for better MSVC and BCC co-operation
*/
#include <iostream>
#include <cassert>
#include <boost/integer_traits.hpp>
#ifdef NDEBUG
#error This test relies on assert() and thus makes no sense with NDEBUG defined
#endif
// enable if you have "long long" and the proper macros in <limits.h>
#undef HAVE_LONG_LONG
/*
* General portability note:
* MSVC mis-compiles explicit function template instantiations.
* For example, f<A>() and f<B>() are both compiled to call f<A>().
* BCC is unable to implicitly convert a "const char *" to a std::string
* when using explicit function template instantiations.
*
* Therefore, avoid explicit function template instantiations.
*/
template<class T>
void runtest(const char * type, T)
{
typedef boost::integer_traits<T> traits;
std::cout << "Checking " << type
<< "; min is " << traits::min()
<< ", max is " << traits::max()
<< std::endl;
assert(traits::is_specialized);
assert(traits::is_integer);
assert(traits::is_integral);
assert(traits::const_min == traits::min());
assert(traits::const_max == traits::max());
}
int main()
{
runtest("bool", bool());
runtest("char", char());
typedef signed char signed_char;
runtest("signed char", signed_char());
typedef unsigned char unsigned_char;
runtest("unsigned char", unsigned_char());
runtest("short", short());
typedef unsigned short unsigned_short;
runtest("unsigned short", unsigned_short());
runtest("int", int());
typedef unsigned int unsigned_int;
runtest("unsigned int", unsigned_int());
runtest("long", long());
typedef unsigned long unsigned_long;
runtest("unsigned long", unsigned_long());
#ifdef HAVE_LONG_LONG
typedef long long long_long;
runtest("long long", long_long());
typedef unsigned long long unsigned_long_long;
runtest("unsigned long long", unsigned_long_long());
#endif
// Some compilers don't pay attention to std:3.6.1/5 and issue a
// warning here if "return 0;" is omitted.
return 0;
}