Ne.app NeANT
The Ne.app NeANT User module of the NeANT distribution.
Macros | Functions | Variables
21.string.io.cpp File Reference
#include <string>
#include <cstddef>
#include <istream>
#include <ostream>
#include <locale>
#include <rw_strings.h>
#include <rw_driver.h>
#include <rw_allocator.h>
#include <rw_char.h>
#include <rw_ctype.h>
#include <rw_new.h>
#include <rw_streambuf.h>
Include dependency graph for 21.string.io.cpp:

Go to the source code of this file.

Macros

#define Good   std::ios_base::goodbit
 
#define Eof   std::ios_base::eofbit
 
#define Fail   std::ios_base::failbit
 
#define Bad   std::ios_base::badbit
 
#define NotGood   (Eof | Fail | Bad)
 
#define Skipws   std::ios_base::skipws
 
#define Left   std::ios_base::left
 
#define Right   std::ios_base::right
 
#define WHITESPACE   " \f\n\r\t\v"
 
#define TEST(str, arg, width, flags, state, res, res_width, res_st, bthrow)
 
#define TEST1(str)
 
#define TEST2(str)
 
#define TEST3(arg, width, flags, res)
 
#define TEST(str, arg, width, flags, state, res, res_width, res_st, bthrow)
 
#define TEST1(str)
 
#define TEST2(str)
 
#define TEST3(arg, res)
 
#define TEST(str, arg, width, flags, state, res, res_width, res_st, bthrow)
 
#define TEST1(str)
 
#define TEST2(str)
 
#define TEST3(arg, delim, res)
 
#define TEST(str, arg, width, flags, state, res, res_width, res_st, bthrow)
 
#define TEST1(str)
 
#define TEST2(str, arg, width, flags, res, res_width, res_st)
 
#define TEST(gsig, sig)
 

Functions

template<class charT , class Traits , class Allocator >
void test_io (charT *, Traits *, Allocator *, const StringTestCaseData< charT > &tdata)
 
 DEFINE_STRING_TEST_FUNCTIONS (test_io)
 
int main (int argc, char **argv)
 

Variables

const char SYMB_THROW = '!'
 

Macro Definition Documentation

◆ Bad

#define Bad   std::ios_base::badbit

Definition at line 54 of file 21.string.io.cpp.

◆ Eof

#define Eof   std::ios_base::eofbit

Definition at line 52 of file 21.string.io.cpp.

◆ Fail

#define Fail   std::ios_base::failbit

Definition at line 53 of file 21.string.io.cpp.

◆ Good

#define Good   std::ios_base::goodbit

Definition at line 51 of file 21.string.io.cpp.

◆ Left

#define Left   std::ios_base::left

Definition at line 58 of file 21.string.io.cpp.

◆ NotGood

#define NotGood   (Eof | Fail | Bad)

Definition at line 55 of file 21.string.io.cpp.

◆ Right

#define Right   std::ios_base::right

Definition at line 59 of file 21.string.io.cpp.

◆ Skipws

#define Skipws   std::ios_base::skipws

Definition at line 57 of file 21.string.io.cpp.

◆ TEST [1/5]

#define TEST (   gsig,
  sig 
)
Value:
{ \
gsig, sig ## _test_cases, \
sizeof sig ## _test_cases / sizeof *sig ## _test_cases \
}

◆ TEST [2/5]

#define TEST (   str,
  arg,
  width,
  flags,
  state,
  res,
  res_width,
  res_st,
  bthrow 
)
Value:
{ \
__LINE__, width, flags, state, res_st, res_width, \
str, sizeof (str) - 1, arg, sizeof (arg) - 1, \
res, sizeof (res) - 1, bthrow \
}
#define res
Definition 17.names.cpp:531
#define flags
const char * str
Definition exec.cpp:170
int arg
Definition locale.cpp:2806

◆ TEST [3/5]

#define TEST (   str,
  arg,
  width,
  flags,
  state,
  res,
  res_width,
  res_st,
  bthrow 
)
Value:
{ \
__LINE__, width, flags, state, res_st, res_width, \
str, sizeof (str) - 1, arg, sizeof (arg) - 1, \
res, sizeof (res) - 1, bthrow \
}

◆ TEST [4/5]

#define TEST (   str,
  arg,
  width,
  flags,
  state,
  res,
  res_width,
  res_st,
  bthrow 
)
Value:
{ \
__LINE__, width, flags, state, res_st, res_width, \
str, sizeof (str) - 1, arg, sizeof (arg) - 1, \
res, sizeof (res) - 1, bthrow \
}

◆ TEST [5/5]

#define TEST (   str,
  arg,
  width,
  flags,
  state,
  res,
  res_width,
  res_st,
  bthrow 
)
Value:
{ \
__LINE__, width, flags, state, res_st, res_width, \
str, sizeof (str) - 1, 0, arg, res, sizeof (res) - 1, bthrow \
}

◆ TEST1 [1/4]

#define TEST1 (   str)
Value:
TEST (str, "", 0, 0, Eof, str, 0, Eof, 0), \
TEST (str, "", 1, 0, Fail, str, 1, Fail, 0), \
TEST (str, "", 2, 0, Bad, str, 2, Bad, 0), \
TEST (str, "", 3, Skipws, Eof, str, 3, Eof, 0), \
TEST (str, "", 4, Skipws, Fail, str, 4, Fail, 0), \
TEST (str, "", 5, Skipws, Bad, str, 5, Bad, 0), \
TEST (str, "", 6, Skipws, Good, str, 6, Eof | Fail, 0), \
TEST (str, WHITESPACE, 7, 0, Eof, str, 7, Eof, 0), \
TEST (str, WHITESPACE, 8, 0, Fail, str, 8, Fail, 0), \
TEST (str, WHITESPACE, 9, 0, Bad, str, 9, Bad, 0), \
TEST (str, WHITESPACE, 10, Skipws, Eof, str, 10, Eof, 0), \
TEST (str, WHITESPACE, 11, Skipws, Fail, str, 11, Fail, 0), \
TEST (str, WHITESPACE, 12, Skipws, Bad, str, 12, Bad, 0), \
TEST (str, WHITESPACE, 13, Skipws, Good, str, 13, Eof | Fail, 0), \
TEST (str, "", 14, Skipws, NotGood, str, 14, Eof | Fail, 1), \
TEST (str, WHITESPACE, 15, Skipws, NotGood, str, 15, Eof | Fail, 1)
#define TEST(str, arg, width, flags, state, res, res_width, res_st, bthrow)
#define NotGood
#define Fail
#define WHITESPACE
#define Skipws
#define Good
#define Bad
#define Eof

◆ TEST1 [2/4]

#define TEST1 (   str)
Value:
TEST (str, "", 0, 0, Eof, str, 0, Eof, 0), \
TEST (str, "", 1, 0, Fail, str, 0, Fail, 0), \
TEST (str, "", 2, 0, Bad, str, 0, Bad, 0), \
TEST (str, "", 3, Skipws, Eof, str, 0, Eof, 0), \
TEST (str, "", 4, Skipws, Fail, str, 0, Fail, 0), \
TEST (str, "", 5, Skipws, Bad, str, 0, Bad, 0), \
TEST (str, WHITESPACE, 7, 0, Eof, str, 0, Eof, 0), \
TEST (str, WHITESPACE, 8, 0, Fail, str, 0, Fail, 0), \
TEST (str, WHITESPACE, 9, 0, Bad, str, 0, Bad, 0), \
TEST (str, WHITESPACE, 10, Skipws, Eof, str, 0, Eof, 0), \
TEST (str, WHITESPACE, 11, Skipws, Fail, str, 0, Fail, 0), \
TEST (str, WHITESPACE, 12, Skipws, Bad, str, 0, Bad, 0), \
TEST (str, "abc", 13, 0, Eof, str, 0, Eof, 0), \
TEST (str, "x@4096", 14, 0, Fail, str, 0, Fail, 0), \
TEST (str, "<U0>abc<U0>", 15, 0, Bad, str, 0, Bad, 0), \
TEST (str, "abc\ndef", 16, Skipws, Eof, str, 0, Eof, 0), \
TEST (str, " \tabc", 17, Skipws, Fail, str, 0, Fail, 0), \
TEST (str, "\n\n<U0>\n", 18, Skipws, Bad, str, 0, Bad, 0)

◆ TEST1 [3/4]

#define TEST1 (   str)
Value:
TEST (str, "", 0, 0, Eof, str, '\n', Eof, 0), \
TEST (str, "", 1, 0, Fail, str, '\0', Fail, 0), \
TEST (str, "", 2, 0, Bad, str, '\r', Bad, 0), \
TEST (str, "", 3, Skipws, Eof, str, '\a', Eof, 0), \
TEST (str, "", 4, Skipws, Fail, str, '\b', Fail, 0), \
TEST (str, "", 5, Skipws, Bad, str, '\t', Bad, 0), \
TEST (str, WHITESPACE, 7, 0, Eof, str, '\v', Eof, 0), \
TEST (str, WHITESPACE, 8, 0, Fail, str, 'a', Fail, 0), \
TEST (str, WHITESPACE, 9, 0, Bad, str, ' ', Bad, 0), \
TEST (str, WHITESPACE, 10, Skipws, Eof, str, '1', Eof, 0), \
TEST (str, WHITESPACE, 11, Skipws, Fail, str, '5', Fail, 0), \
TEST (str, WHITESPACE, 12, Skipws, Bad, str, 'w', Bad, 0), \
TEST (str, "abc", 13, 0, Eof, str, 'b', Eof, 0), \
TEST (str, "x@4096", 14, 0, Fail, str, 'x', Fail, 0), \
TEST (str, "<U0>abc<U0>", 15, 0, Bad, str, 'c', Bad, 0), \
TEST (str, "abc\ndef", 16, Skipws, Eof, str, 'e', Eof, 0), \
TEST (str, " \tabc", 17, Skipws, Fail, str, '\t', Fail, 0), \
TEST (str, "\n\n<U0>\n", 18, Skipws, Bad, str, '\0', Bad, 0)

◆ TEST1 [4/4]

#define TEST1 (   str)
Value:
TEST (str, 0, 0, 0, Eof, "", 0, Eof, 0), \
TEST (str, 0, 1, 0, Fail, "", 1, Fail, 0), \
TEST (str, 0, 2, 0, Bad, "", 2, Bad, 0)

◆ TEST2 [1/4]

#define TEST2 (   str)
Value:
TEST (str, "", 0, 0, Good, "", 0 , Eof | Fail, 0), \
TEST (str, "", 10, 0, Good, "", 0 , Eof | Fail, 0), \
TEST (str, WHITESPACE, 0, 0, Good, "", 0 , Fail, 0), \
TEST (str, WHITESPACE, 2, 0, Good, "", 0 , Fail, 0), \
TEST (str, WHITESPACE, 20, 0, Good, "", 0 , Fail, 0), \
TEST (str, WHITESPACE "abc", 0, 0, Good, "", 0 , Fail, 0), \
TEST (str, WHITESPACE "abc", 2, 0, Good, "", 0 , Fail, 0), \
TEST (str, WHITESPACE "abc", 10, 0, Good, "", 0 , Fail, 0), \
TEST (str, WHITESPACE "abc\ndef", 0, 0, Good, "", 0 , Fail, 0), \
TEST (str, WHITESPACE "abc\ndef", 3, 0, Good, "", 0 , Fail, 0), \
TEST (str, WHITESPACE "abc\ndef", 30, 0, Good, "", 0 , Fail, 0), \
TEST (str, WHITESPACE "<U0>@3", 0, 0, Good, "", 0 , Fail, 0), \
TEST (str, WHITESPACE "<U0>@3", 2, 0, Good, "", 0 , Fail, 0), \
TEST (str, WHITESPACE "<U0>@3", 10, 0, Good, "", 0 , Fail, 0), \
TEST (str, "", 0, 0, NotGood, "", 0 , Eof | Fail, 1), \
TEST (str, "", 10, 0, NotGood, "", 0 , Eof | Fail, 1), \
TEST (str, WHITESPACE, 0, 0, NotGood, "", 0 , Fail, 1), \
TEST (str, WHITESPACE, 2, 0, NotGood, "", 0 , Fail, 1), \
TEST (str, WHITESPACE, 20, 0, NotGood, "", 0 , Fail, 1), \
TEST (str, WHITESPACE "abc", 0, 0, NotGood, "", 0 , Fail, 1), \
TEST (str, WHITESPACE "abc", 2, 0, NotGood, "", 0 , Fail, 1), \
TEST (str, WHITESPACE "abc", 10, 0, NotGood, "", 0 , Fail, 1), \
TEST (str, WHITESPACE "abc\ndef", 0, 0, NotGood, "", 0 , Fail, 1), \
TEST (str, WHITESPACE "abc\ndef", 3, 0, NotGood, "", 0 , Fail, 1), \
TEST (str, WHITESPACE "abc\ndef", 30, 0, NotGood, "", 0 , Fail, 1), \
TEST (str, WHITESPACE "<U0>@3", 0, 0, NotGood, "", 0 , Fail, 1), \
TEST (str, WHITESPACE "<U0>@3", 2, 0, NotGood, "", 0 , Fail, 1), \
TEST (str, WHITESPACE "<U0>@3", 10, 0, NotGood, "", 0 , Fail, 1)

◆ TEST2 [2/4]

#define TEST2 (   str)
Value:
TEST (str, "", 0, Skipws, Good, "", 0, Eof | Fail, 0), \
TEST (str, "", 10, 0, Good, "", 0, Eof | Fail, 0), \
TEST (str, "\n", 0, Skipws, Good, "", 0, Good, 0), \
TEST (str, "\n", 2, 0, Good, "", 0, Good, 0), \
TEST (str, "\nabc", 0, Skipws, Good, "", 0, Good, 0), \
TEST (str, "\nabc", 2, 0, Good, "", 0, Good, 0), \
TEST (str, "\nabc\ndef", 0, Skipws, Good, "", 0, Good, 0), \
TEST (str, "\nabc\ndef", 3, 0, Good, "", 0, Good, 0), \
TEST (str, "\n<U0>@3", 0, Skipws, Good, "", 0, Good, 0), \
TEST (str, "\n<U0>@3", 2, 0, Good, "", 0, Good, 0), \
TEST (str, "", 0, Skipws, NotGood, "", 0, Eof | Fail, 1), \
TEST (str, "", 10, 0, NotGood, "", 0, Eof | Fail, 1), \
TEST (str, "\n", 0, Skipws, NotGood, "", 0, Good, 1), \
TEST (str, "\n", 2, 0, NotGood, "", 0, Good, 1), \
TEST (str, "\nabc", 0, Skipws, NotGood, "", 0, Good, 1), \
TEST (str, "\nabc", 2, 0, NotGood, "", 0, Good, 1), \
TEST (str, "\nabc\ndef", 0, Skipws, NotGood, "", 0, Good, 1), \
TEST (str, "\nabc\ndef", 3, 0, NotGood, "", 0, Good, 1), \
TEST (str, "\n<U0>@3", 0, Skipws, NotGood, "", 0, Good, 1), \
TEST (str, "\n<U0>@3", 2, 0, NotGood, "", 0, Good, 1)

◆ TEST2 [3/4]

#define TEST2 (   str)
Value:
TEST (str, "", 0, Skipws, Good, "", '\a', Eof | Fail, 0), \
TEST (str, "", 10, 0, Good, "", '\0', Eof | Fail, 0), \
TEST (str, "<U0>", 0, Skipws, Good, "", '\0', Good, 0), \
TEST (str, "\n", 2, 0, Good, "", '\n', Good, 0), \
TEST (str, "\rabc", 0, Skipws, Good, "", '\r', Good, 0), \
TEST (str, "abc", 2, 0, Good, "", 'a', Good, 0), \
TEST (str, "\babc\ndef", 0, Skipws, Good, "", '\b', Good, 0), \
TEST (str, "\tabc\ndef", 3, 0, Good, "", '\t', Good, 0), \
TEST (str, "\v<U0>@3", 0, Skipws, Good, "", '\v', Good, 0), \
TEST (str, " <U0>@3", 2, 0, Good, "", ' ', Good, 0), \
TEST (str, "", 0, Skipws, NotGood, "", '\a', Eof | Fail, 1), \
TEST (str, "", 10, 0, NotGood, "", '\0', Eof | Fail, 1), \
TEST (str, "<U0>", 0, Skipws, NotGood, "", '\0', Good, 1), \
TEST (str, "\n", 2, 0, NotGood, "", '\n', Good, 1), \
TEST (str, "\rabc", 0, Skipws, NotGood, "", '\r', Good, 1), \
TEST (str, "abc", 2, 0, NotGood, "", 'a', Good, 1), \
TEST (str, "\babc\ndef", 0, Skipws, NotGood, "", '\b', Good, 1), \
TEST (str, "\tabc\ndef", 3, 0, NotGood, "", '\t', Good, 1), \
TEST (str, "\v<U0>@3", 0, Skipws, NotGood, "", '\v', Good, 1), \
TEST (str, " <U0>@3", 2, 0, NotGood, "", ' ', Good, 1)

◆ TEST2 [4/4]

#define TEST2 (   str,
  arg,
  width,
  flags,
  res,
  res_width,
  res_st 
)
Value:
TEST (str, arg, width, flags, Good, res, res_width, res_st, 0), \
TEST (str, arg, width, flags, NotGood, res, res_width, res_st, 1)

◆ TEST3 [1/3]

#define TEST3 (   arg,
  delim,
  res 
)
Value:
TEST ("", arg, 0, Skipws, Good, res, delim, -1, 0), \
TEST ("ab", arg, 1, 0, Good, res, delim, -1, 0), \
TEST ("abc", arg, 2, Skipws, Good, res, delim, -1, 0), \
TEST ("<U0>", arg, 3, 0, Good, res, delim, -1, 0), \
TEST ("<U0>@2ab", arg, 4, Skipws, Good, res, delim, -1, 0), \
TEST ("a<U0>@2b", arg, 5, 0, Good, res, delim, -1, 0), \
TEST ("ab<U0>@2", arg, 6, Skipws, Good, res, delim, -1, 0), \
TEST ("a<U0>b<U0>@2c", arg, 7, 0, Good, res, delim, -1, 0), \
TEST ("<U0>ab<U0>@2c", arg, 8, Skipws, Good, res, delim, -1, 0), \
TEST ("x@4096", arg, 9, 0, Good, res, delim, -1, 0), \
TEST ("", arg, 10, Skipws, NotGood, res, delim, -1, 1), \
TEST ("ab", arg, 11, 0, NotGood, res, delim, -1, 1), \
TEST ("abc", arg, 12, Skipws, NotGood, res, delim, -1, 1), \
TEST ("<U0>", arg, 13, 0, NotGood, res, delim, -1, 1), \
TEST ("<U0>@2ab", arg, 14, Skipws, NotGood, res, delim, -1, 1), \
TEST ("a<U0>@2b", arg, 15, 0, NotGood, res, delim, -1, 1), \
TEST ("ab<U0>@2", arg, 16, Skipws, NotGood, res, delim, -1, 1), \
TEST ("a<U0>b<U0>@2c", arg, 17, 0, NotGood, res, delim, -1, 1), \
TEST ("<U0>ab<U0>@2c", arg, 18, Skipws, NotGood, res, delim, -1, 1), \
TEST ("x@4096", arg, 19, 0, NotGood, res, delim, -1, 1)

◆ TEST3 [2/3]

#define TEST3 (   arg,
  res 
)
Value:
TEST ("", arg, 0, Skipws, Good, res, 0, -1, 0), \
TEST ("ab", arg, 1, 0, Good, res, 0, -1, 0), \
TEST ("abc", arg, 2, Skipws, Good, res, 0, -1, 0), \
TEST ("<U0>", arg, 3, 0, Good, res, 0, -1, 0), \
TEST ("<U0>@2ab", arg, 4, Skipws, Good, res, 0, -1, 0), \
TEST ("a<U0>@2b", arg, 5, 0, Good, res, 0, -1, 0), \
TEST ("ab<U0>@2", arg, 6, Skipws, Good, res, 0, -1, 0), \
TEST ("a<U0>b<U0>@2c", arg, 7, 0, Good, res, 0, -1, 0), \
TEST ("<U0>ab<U0>@2c", arg, 8, Skipws, Good, res, 0, -1, 0), \
TEST ("x@4096", arg, 9, 0, Good, res, 0, -1, 0), \
TEST ("", arg, 10, Skipws, NotGood, res, 0, -1, 1), \
TEST ("ab", arg, 11, 0, NotGood, res, 0, -1, 1), \
TEST ("abc", arg, 12, Skipws, NotGood, res, 0, -1, 1), \
TEST ("<U0>", arg, 13, 0, NotGood, res, 0, -1, 1), \
TEST ("<U0>@2ab", arg, 14, Skipws, NotGood, res, 0, -1, 1), \
TEST ("a<U0>@2b", arg, 15, 0, NotGood, res, 0, -1, 1), \
TEST ("ab<U0>@2", arg, 16, Skipws, NotGood, res, 0, -1, 1), \
TEST ("a<U0>b<U0>@2c", arg, 17, 0, NotGood, res, 0, -1, 1), \
TEST ("<U0>ab<U0>@2c", arg, 18, Skipws, NotGood, res, 0, -1, 1), \
TEST ("x@4096", arg, 19, 0, NotGood, res, 0, -1, 1)

◆ TEST3 [3/3]

#define TEST3 (   arg,
  width,
  flags,
  res 
)
Value:
TEST ("", arg, width, flags, Good, res, 0, -1, 0), \
TEST ("ab", arg, width, flags, Good, res, 0, -1, 0), \
TEST ("abc", arg, width, flags, Good, res, 0, -1, 0), \
TEST ("<U0>", arg, width, flags, Good, res, 0, -1, 0), \
TEST ("<U0>@2ab", arg, width, flags, Good, res, 0, -1, 0), \
TEST ("a<U0>@2b", arg, width, flags, Good, res, 0, -1, 0), \
TEST ("ab<U0>@2", arg, width, flags, Good, res, 0, -1, 0), \
TEST ("a<U0>b<U0>@2c", arg, width, flags, Good, res, 0, -1, 0), \
TEST ("<U0>ab<U0>@2c", arg, width, flags, Good, res, 0, -1, 0), \
TEST ("x@4096", arg, width, flags, Good, res, 0, -1, 0), \
TEST ("", arg, width, flags, NotGood, res, 0, -1, 1), \
TEST ("ab", arg, width, flags, NotGood, res, 0, -1, 1), \
TEST ("abc", arg, width, flags, NotGood, res, 0, -1, 1), \
TEST ("<U0>", arg, width, flags, NotGood, res, 0, -1, 1), \
TEST ("<U0>@2ab", arg, width, flags, NotGood, res, 0, -1, 1), \
TEST ("a<U0>@2b", arg, width, flags, NotGood, res, 0, -1, 1), \
TEST ("ab<U0>@2", arg, width, flags, NotGood, res, 0, -1, 1), \
TEST ("a<U0>b<U0>@2c", arg, width, flags, NotGood, res, 0, -1, 1), \
TEST ("<U0>ab<U0>@2c", arg, width, flags, NotGood, res, 0, -1, 1), \
TEST ("x@4096", arg, width, flags, NotGood, res, 0, -1, 1)

◆ WHITESPACE

#define WHITESPACE   " \f\n\r\t\v"

Definition at line 61 of file 21.string.io.cpp.

Function Documentation

◆ DEFINE_STRING_TEST_FUNCTIONS()

DEFINE_STRING_TEST_FUNCTIONS ( test_io  )

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 1270 of file 21.string.io.cpp.

◆ test_io()

template<class charT , class Traits , class Allocator >
void test_io ( charT *  ,
Traits *  ,
Allocator *  ,
const StringTestCaseData< charT > &  tdata 
)

Definition at line 916 of file 21.string.io.cpp.

Variable Documentation

◆ SYMB_THROW

const char SYMB_THROW = '!'

Definition at line 63 of file 21.string.io.cpp.