Ne.app NeANT
The Ne.app NeANT User module of the NeANT distribution.
Data Structures | Macros | Functions | Variables
22.locale.num.put.cpp File Reference
#include <ios>
#include <locale>
#include <cerrno>
#include <cfloat>
#include <climits>
#include <clocale>
#include <cstdio>
#include <cstring>
#include <rw_any.h>
#include <rw_cmdopt.h>
#include <rw_driver.h>
#include <rw_locale.h>
#include <rw_valcmp.h>
Include dependency graph for 22.locale.num.put.cpp:

Go to the source code of this file.

Data Structures

struct  Ctype< charT >
 
struct  Punct< charT, Intl >
 
struct  Ios< charT >
 
struct  NumGet< charT, InputIterator >
 
struct  NumPut< charT >
 
struct  Streambuf< charT, Traits >
 

Macros

#define DIRECT_USE_TEST(T)    np.put (std::ostreambuf_iterator<charT>(&sb), ios, charT (), (T)0)
 
#define boolalpha   std::ios_base::boolalpha
 
#define dec   std::ios_base::dec
 
#define fixed   std::ios_base::fixed
 
#define hex   std::ios_base::hex
 
#define internal   std::ios_base::internal
 
#define left   std::ios_base::left
 
#define oct   std::ios_base::oct
 
#define right   std::ios_base::right
 
#define scientific   std::ios_base::scientific
 
#define showbase   std::ios_base::showbase
 
#define showpoint   std::ios_base::showpoint
 
#define showpos   std::ios_base::showpos
 
#define skipws   std::ios_base::skipws
 
#define unitbuf   std::ios_base::unitbuf
 
#define uppercase   std::ios_base::uppercase
 
#define bin   std::ios_base::bin
 
#define adjustfield   std::ios_base::adjustfield
 
#define basefield   std::ios_base::basefield
 
#define floatfield   std::ios_base::floatfield
 
#define nolock   std::ios_base::nolock
 
#define nolockbuf   std::ios_base::nolockbuf
 
#define Bad   std::ios_base::badbit
 
#define Eof   std::ios_base::eofbit
 
#define Fail   std::ios_base::failbit
 
#define Good   std::ios_base::goodbit
 
#define TEST   do_test
 
#define T   charT (), cname, tname, __LINE__
 
#define LONG_MIN   _RWSTD_LONG_MIN
 
#define LONG_MAX   _RWSTD_LONG_MAX
 
#define GET_FAIL   (Eof | Fail), LONG_MAX
 
#define GROUPING   "\2\1\xff"
 
#define GROUPING   "\2\3\xff"
 
#define flags   hex | showbase | internal
 
#define FLAGS   flags | uppercase
 
#define FLAGS   dec | showpos | internal
 
#define BASE(n)   int (unsigned (n) << _RWSTD_IOS_BASEOFF)
 
#define STDIO_FMAT   "%" _RWSTD_LLONG_PRINTF_PREFIX "d"
 
#define LL(number)   number ## LL
 
#define FLAGS   hex | showbase | internal
 
#define OPTS   FLAGS, 0, 20, ' ', "\1\2\3\4\1\2\3\4"
 
#define CAT(a, b)   CONCAT (a, b)
 
#define CONCAT(a, b)   a ## b
 
#define Showpos(f)   (showpos | f)
 
#define SHOWPOS(f)   (showpos | uppercase | f)
 
#define Showpoint(f)   (showpoint | f)
 
#define SHOWPOINT(f)   (showpoint | uppercase | f)
 
#define Showall(f)   (showpoint | showpos | f)
 
#define SHOWALL(f)   (showpoint | showpos | uppercase | f)
 
#define CAT(a, b)   CONCAT (a, b)
 
#define CONCAT(a, b)   a ## b
 
#define Abs(i)   ((i) < 0 ? (-i) : (i))
 
#define ASSERT(T, N, T2, tname, t2name)
 
#define TEST(T, tname)
 

Functions

template<class charT , class T >
void do_test (charT, const char *cname, const char *tname, int lineno, T val, int flags, std::streamsize prec, std::streamsize width, char fill, const char *grouping, const char *str, int err_expect=-1, T val_expect=T())
 
template<class charT >
void direct_use_test (charT, const char *cname)
 
template<class charT >
void bool_test (charT, const char *cname)
 
template<class charT >
void long_test (charT, const char *cname)
 
template<class charT >
void ulong_test (charT, const char *cname)
 
template<class charT >
void llong_test (charT, const char *cname)
 
template<class charT >
void ullong_test (charT, const char *cname)
 
template<class charT , class floatT >
void inf_nan_test (charT, floatT, const char *cname, const char *tname)
 
template<class charT >
void dbl_test (charT, const char *cname)
 
template<class charT >
void ldbl_test (charT, const char *cname)
 
template<class charT >
void pvoid_test (charT, const char *cname)
 
template<class charT >
void errno_test (charT, const char *cname)
 
void widen_test ()
 
void grouping_test ()
 
template<class charT >
void numput_virtuals_test (charT, const char *cname)
 
template<class charT >
void run_tests (charT, const char *cname)
 
int main (int argc, char *argv[])
 

Variables

volatile double zero
 

Macro Definition Documentation

◆ Abs

#define Abs (   i)    ((i) < 0 ? (-i) : (i))

◆ adjustfield

#define adjustfield   std::ios_base::adjustfield

Definition at line 559 of file 22.locale.num.put.cpp.

◆ ASSERT

#define ASSERT (   T,
  N,
  T2,
  tname,
  t2name 
)
Value:
do { \
/* number of expected calls to the do_put() member */ \
const int expect = N + put.ncalls_ [put.test_ ## T]; \
const int expect_2 = !N + put.ncalls_ [put.test_ ## T2]; \
charT buf [80]; \
const charT* const end = np.put (buf, ios, charT (), (T)0); \
rw_assert (end == buf + 1, 0, __LINE__, \
"line %d: num_put<%s>::put (..., %s = 0) " \
"return value", __LINE__, cname, tname); \
const int ncalls = put.ncalls_ [put.test_ ## T]; \
const int ncalls_2 = put.ncalls_ [put.test_ ## T2]; \
rw_assert (expect == ncalls, 0, __LINE__, \
"line %d: num_put<%s>::put (..., %s) called " \
"do_put(..., %s) %d times, expected %d", \
__LINE__, cname, tname, \
tname, Abs (ncalls - expect - N), N); \
/* make sure extensions, if any, are implemented in */ \
/* terms of and call the standard virtual functions */ \
/* bogus addressof operator prevents warnings about */ \
/* unreachable code when T is the same as T2 */ \
if (put.test_ ## T != put.test_ ## T2) \
rw_assert (expect_2 == ncalls_2, 0, __LINE__, \
"line %d: num_put<%s>::put (..., %s) called " \
"do_put(..., %s) %d times, expected %d", \
__LINE__, cname, tname, \
t2name, Abs (expect_2 - ncalls_2 - !N), !N); \
} while (0)
#define N
Definition 17.names.cpp:157
#define T2
Definition 17.names.cpp:323
#define buf
Definition 17.names.cpp:452
#define charT
Definition 17.names.cpp:456
int ncalls
#define T
#define Abs(i)
const int end

◆ Bad

#define Bad   std::ios_base::badbit

Definition at line 565 of file 22.locale.num.put.cpp.

◆ BASE

#define BASE (   n)    int (unsigned (n) << _RWSTD_IOS_BASEOFF)

◆ basefield

#define basefield   std::ios_base::basefield

Definition at line 560 of file 22.locale.num.put.cpp.

◆ bin

#define bin   std::ios_base::bin

Definition at line 558 of file 22.locale.num.put.cpp.

◆ boolalpha

#define boolalpha   std::ios_base::boolalpha

Definition at line 543 of file 22.locale.num.put.cpp.

◆ CAT [1/2]

#define CAT (   a,
  b 
)    CONCAT (a, b)

◆ CAT [2/2]

#define CAT (   a,
  b 
)    CONCAT (a, b)

◆ CONCAT [1/2]

#define CONCAT (   a,
  b 
)    a ## b

◆ CONCAT [2/2]

#define CONCAT (   a,
  b 
)    a ## b

◆ dec

#define dec   std::ios_base::dec

Definition at line 544 of file 22.locale.num.put.cpp.

◆ DIRECT_USE_TEST

#define DIRECT_USE_TEST (   T)     np.put (std::ostreambuf_iterator<charT>(&sb), ios, charT (), (T)0)

◆ Eof

#define Eof   std::ios_base::eofbit

Definition at line 566 of file 22.locale.num.put.cpp.

◆ Fail

#define Fail   std::ios_base::failbit

Definition at line 567 of file 22.locale.num.put.cpp.

◆ fixed

#define fixed   std::ios_base::fixed

Definition at line 545 of file 22.locale.num.put.cpp.

◆ flags

#define flags   hex | showbase | internal

◆ FLAGS [1/3]

#define FLAGS   flags | uppercase

◆ FLAGS [2/3]

#define FLAGS   dec | showpos | internal

◆ FLAGS [3/3]

#define FLAGS   hex | showbase | internal

◆ floatfield

#define floatfield   std::ios_base::floatfield

Definition at line 561 of file 22.locale.num.put.cpp.

◆ GET_FAIL

#define GET_FAIL   (Eof | Fail), LONG_MAX

◆ Good

#define Good   std::ios_base::goodbit

Definition at line 568 of file 22.locale.num.put.cpp.

◆ GROUPING [1/2]

#define GROUPING   "\2\1\xff"

◆ GROUPING [2/2]

#define GROUPING   "\2\3\xff"

◆ hex

#define hex   std::ios_base::hex

Definition at line 546 of file 22.locale.num.put.cpp.

◆ internal

#define internal   std::ios_base::internal

Definition at line 547 of file 22.locale.num.put.cpp.

◆ left

#define left   std::ios_base::left

Definition at line 548 of file 22.locale.num.put.cpp.

◆ LL

#define LL (   number)    number ## LL

◆ LONG_MAX

#define LONG_MAX   _RWSTD_LONG_MAX

◆ LONG_MIN

#define LONG_MIN   _RWSTD_LONG_MIN

◆ nolock

#define nolock   std::ios_base::nolock

Definition at line 562 of file 22.locale.num.put.cpp.

◆ nolockbuf

#define nolockbuf   std::ios_base::nolockbuf

Definition at line 563 of file 22.locale.num.put.cpp.

◆ oct

#define oct   std::ios_base::oct

Definition at line 549 of file 22.locale.num.put.cpp.

◆ OPTS

#define OPTS   FLAGS, 0, 20, ' ', "\1\2\3\4\1\2\3\4"

◆ right

#define right   std::ios_base::right

Definition at line 550 of file 22.locale.num.put.cpp.

◆ scientific

#define scientific   std::ios_base::scientific

Definition at line 551 of file 22.locale.num.put.cpp.

◆ Showall

#define Showall (   f)    (showpoint | showpos | f)

◆ SHOWALL

#define SHOWALL (   f)    (showpoint | showpos | uppercase | f)

◆ showbase

#define showbase   std::ios_base::showbase

Definition at line 552 of file 22.locale.num.put.cpp.

◆ showpoint

#define showpoint   std::ios_base::showpoint

Definition at line 553 of file 22.locale.num.put.cpp.

◆ Showpoint

#define Showpoint (   f)    (showpoint | f)

◆ SHOWPOINT

#define SHOWPOINT (   f)    (showpoint | uppercase | f)

◆ showpos

#define showpos   std::ios_base::showpos

Definition at line 554 of file 22.locale.num.put.cpp.

◆ Showpos

#define Showpos (   f)    (showpos | f)

◆ SHOWPOS

#define SHOWPOS (   f)    (showpos | uppercase | f)

◆ skipws

#define skipws   std::ios_base::skipws

Definition at line 555 of file 22.locale.num.put.cpp.

◆ STDIO_FMAT

#define STDIO_FMAT   "%" _RWSTD_LLONG_PRINTF_PREFIX "d"

◆ T

#define T   charT (), cname, tname, __LINE__

◆ TEST [1/2]

#define TEST   do_test

◆ TEST [2/2]

#define TEST (   T,
  tname 
)
Value:
if (rw_enabled (#T)) \
T ## _test (charT (), cname); \
else \
rw_note (0, __FILE__, __LINE__, "%s test disabled", \
tname && *tname ? tname : #T)
_TEST_EXPORT int rw_enabled(const char *name)

◆ unitbuf

#define unitbuf   std::ios_base::unitbuf

Definition at line 556 of file 22.locale.num.put.cpp.

◆ uppercase

#define uppercase   std::ios_base::uppercase

Definition at line 557 of file 22.locale.num.put.cpp.

Function Documentation

◆ bool_test()

template<class charT >
void bool_test ( charT  ,
const char *  cname 
)

Definition at line 572 of file 22.locale.num.put.cpp.

◆ dbl_test()

template<class charT >
void dbl_test ( charT  ,
const char *  cname 
)

Definition at line 1720 of file 22.locale.num.put.cpp.

◆ direct_use_test()

template<class charT >
void direct_use_test ( charT  ,
const char *  cname 
)

Definition at line 503 of file 22.locale.num.put.cpp.

◆ do_test()

template<class charT , class T >
void do_test ( charT  ,
const char *  cname,
const char *  tname,
int  lineno,
T  val,
int  flags,
std::streamsize  prec,
std::streamsize  width,
char  fill,
const char *  grouping,
const char *  str,
int  err_expect = -1,
T  val_expect = T () 
)

Definition at line 287 of file 22.locale.num.put.cpp.

◆ errno_test()

template<class charT >
void errno_test ( charT  ,
const char *  cname 
)

Definition at line 2033 of file 22.locale.num.put.cpp.

◆ grouping_test()

void grouping_test ( )

Definition at line 2178 of file 22.locale.num.put.cpp.

◆ inf_nan_test()

template<class charT , class floatT >
void inf_nan_test ( charT  ,
floatT  ,
const char *  cname,
const char *  tname 
)

Definition at line 1444 of file 22.locale.num.put.cpp.

◆ ldbl_test()

template<class charT >
void ldbl_test ( charT  ,
const char *  cname 
)

Definition at line 1806 of file 22.locale.num.put.cpp.

◆ llong_test()

template<class charT >
void llong_test ( charT  ,
const char *  cname 
)

Definition at line 1339 of file 22.locale.num.put.cpp.

◆ long_test()

template<class charT >
void long_test ( charT  ,
const char *  cname 
)

Definition at line 677 of file 22.locale.num.put.cpp.

◆ main()

int main ( int  argc,
char *  argv[] 
)

Definition at line 2446 of file 22.locale.num.put.cpp.

◆ numput_virtuals_test()

template<class charT >
void numput_virtuals_test ( charT  ,
const char *  cname 
)

Definition at line 2265 of file 22.locale.num.put.cpp.

◆ pvoid_test()

template<class charT >
void pvoid_test ( charT  ,
const char *  cname 
)

Definition at line 1981 of file 22.locale.num.put.cpp.

◆ run_tests()

template<class charT >
void run_tests ( charT  ,
const char *  cname 
)

Definition at line 2350 of file 22.locale.num.put.cpp.

◆ ullong_test()

template<class charT >
void ullong_test ( charT  ,
const char *  cname 
)

Definition at line 1416 of file 22.locale.num.put.cpp.

◆ ulong_test()

template<class charT >
void ulong_test ( charT  ,
const char *  cname 
)

Definition at line 1269 of file 22.locale.num.put.cpp.

◆ widen_test()

void widen_test ( )

Definition at line 2106 of file 22.locale.num.put.cpp.

Variable Documentation

◆ zero

volatile double zero

Definition at line 1440 of file 22.locale.num.put.cpp.