This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Tidy up and slightly extend money_get_members tests


Hi,

as promised. Tested i686-pc-linux-gnu, as usual.

Ciao, Paolo.

////////////

2002-02-07  Paolo Carlini  <pcarlini@unitus.it>

        * testsuite/22_locale/money_get_members_char.cc:
        Add comment, tidy up.
        (test01): more "en_HK" tests (without showbase).
        * testsuite/22_locale/money_get_members_wchar_t.cc: Ditto.

diff -prN libstdc++-v3-orig/testsuite/22_locale/money_get_members_char.cc
libstdc++-v3/testsuite/22_locale/money_get_members_char.cc
*** libstdc++-v3-orig/testsuite/22_locale/money_get_members_char.cc Wed Feb  6
01:20:16 2002
--- libstdc++-v3/testsuite/22_locale/money_get_members_char.cc Thu Feb  7
13:19:11 2002
*************** void test01()
*** 170,175 ****
--- 170,205 ----
    mon_get.get(is_it11, end, true, iss, err11, result11);
    VERIFY( result11 == digits4 );
    VERIFY( err11 == ios_base::goodbit );
+
+   // for the "en_HK" locale the parsing of the vary same input streams must
+   // be successful without showbase too, since the symbol field appears in
+   // the first positions in the format and the symbol, when present, must be
+   // consumed.
+   iss.unsetf(ios_base::showbase);
+
+   iss.str("HK$7,200,000,000.00");
+   iterator_type is_it12(iss);
+   string result12;
+   ios_base::iostate err12 = ios_base::goodbit;
+   mon_get.get(is_it12, end, false, iss, err12, result12);
+   VERIFY( result12 == digits1 );
+   VERIFY( err12 == ios_base::eofbit );
+
+   iss.str("(HKD 100,000,000,000.00)");
+   iterator_type is_it13(iss);
+   string result13;
+   ios_base::iostate err13 = ios_base::goodbit;
+   mon_get.get(is_it13, end, true, iss, err13, result13);
+   VERIFY( result13 == digits2 );
+   VERIFY( err13 == ios_base::goodbit );
+
+   iss.str("(HKD .01)");
+   iterator_type is_it14(iss);
+   string result14;
+   ios_base::iostate err14 = ios_base::goodbit;
+   mon_get.get(is_it14, end, true, iss, err14, result14);
+   VERIFY( result14 == digits4 );
+   VERIFY( err14 == ios_base::goodbit );
  }

  // test double version
*************** void test04()
*** 309,320 ****
  #endif
  }

! class My_money_io : public std::moneypunct<char,false>
  {
- public:
-   explicit My_money_io(size_t r = 0): std::moneypunct<char,false>(r) { }
    char_type do_decimal_point() const { return '.'; }
-   char_type do_thousands_sep() const { return ','; }
    std::string do_grouping() const { return "\004"; }

    std::string do_curr_symbol() const { return "$"; }
--- 339,347 ----
  #endif
  }

! struct My_money_io : public std::moneypunct<char,false>
  {
    char_type do_decimal_point() const { return '.'; }
    std::string do_grouping() const { return "\004"; }

    std::string do_curr_symbol() const { return "$"; }
*************** void test05()
*** 383,388 ****
--- 410,418 ----
    VERIFY( valn_ns == "-123456" );
  }

+ // We were appending to the string val passed by reference, instead
+ // of constructing a temporary candidate, eventually copied into
+ // val in case of successful parsing.
  void test06()
  {
    using namespace std;
*************** void test06()
*** 419,430 ****
    VERIFY( val == buffer3 );
  }

! class My_money_io_a : public std::moneypunct<char,false>
  {
- public:
-   explicit My_money_io_a(size_t r = 0): std::moneypunct<char,false>(r) { }
    char_type do_decimal_point() const { return '.'; }
-   char_type do_thousands_sep() const { return ','; }
    std::string do_grouping() const { return "\004"; }

    std::string do_curr_symbol() const { return "$"; }
--- 449,457 ----
    VERIFY( val == buffer3 );
  }

! struct My_money_io_a : public std::moneypunct<char,false>
  {
    char_type do_decimal_point() const { return '.'; }
    std::string do_grouping() const { return "\004"; }

    std::string do_curr_symbol() const { return "$"; }
*************** public:
*** 439,450 ****
    }
  };

! class My_money_io_b : public std::moneypunct<char,false>
  {
- public:
-   explicit My_money_io_b(size_t r = 0): std::moneypunct<char,false>(r) { }
    char_type do_decimal_point() const { return '.'; }
-   char_type do_thousands_sep() const { return ','; }
    std::string do_grouping() const { return "\004"; }

    std::string do_curr_symbol() const { return "$"; }
--- 466,474 ----
    }
  };

! struct My_money_io_b : public std::moneypunct<char,false>
  {
    char_type do_decimal_point() const { return '.'; }
    std::string do_grouping() const { return "\004"; }

    std::string do_curr_symbol() const { return "$"; }
diff -prN libstdc++-v3-orig/testsuite/22_locale/money_get_members_wchar_t.cc
libstdc++-v3/testsuite/22_locale/money_get_members_wchar_t.cc
*** libstdc++-v3-orig/testsuite/22_locale/money_get_members_wchar_t.cc Wed Feb
6 01:20:38 2002
--- libstdc++-v3/testsuite/22_locale/money_get_members_wchar_t.cc Thu Feb  7
13:20:18 2002
*************** void test01()
*** 171,176 ****
--- 171,206 ----
    mon_get.get(is_it11, end, true, iss, err11, result11);
    VERIFY( result11 == digits4 );
    VERIFY( err11 == ios_base::goodbit );
+
+   // for the "en_HK" locale the parsing of the vary same input streams must
+   // be successful without showbase too, since the symbol field appears in
+   // the first positions in the format and the symbol, when present, must be
+   // consumed.
+   iss.unsetf(ios_base::showbase);
+
+   iss.str(L"HK$7,200,000,000.00");
+   iterator_type is_it12(iss);
+   wstring result12;
+   ios_base::iostate err12 = ios_base::goodbit;
+   mon_get.get(is_it12, end, false, iss, err12, result12);
+   VERIFY( result12 == digits1 );
+   VERIFY( err12 == ios_base::eofbit );
+
+   iss.str(L"(HKD 100,000,000,000.00)");
+   iterator_type is_it13(iss);
+   wstring result13;
+   ios_base::iostate err13 = ios_base::goodbit;
+   mon_get.get(is_it13, end, true, iss, err13, result13);
+   VERIFY( result13 == digits2 );
+   VERIFY( err13 == ios_base::goodbit );
+
+   iss.str(L"(HKD .01)");
+   iterator_type is_it14(iss);
+   wstring result14;
+   ios_base::iostate err14 = ios_base::goodbit;
+   mon_get.get(is_it14, end, true, iss, err14, result14);
+   VERIFY( result14 == digits4 );
+   VERIFY( err14 == ios_base::goodbit );
  }


*************** void test04()
*** 311,322 ****
  #endif
  }

! class My_money_io : public std::moneypunct<wchar_t,false>
  {
- public:
-   explicit My_money_io(size_t r = 0): std::moneypunct<wchar_t,false>(r) { }
    char_type do_decimal_point() const { return L'.'; }
-   char_type do_thousands_sep() const { return L','; }
    std::string do_grouping() const { return "\004"; }

    std::wstring do_curr_symbol() const { return L"$"; }
--- 341,349 ----
  #endif
  }

! struct My_money_io : public std::moneypunct<wchar_t,false>
  {
    char_type do_decimal_point() const { return L'.'; }
    std::string do_grouping() const { return "\004"; }

    std::wstring do_curr_symbol() const { return L"$"; }
*************** void test05()
*** 385,390 ****
--- 412,420 ----
    VERIFY( valn_ns == L"-123456" );
  }

+ // We were appending to the string val passed by reference, instead
+ // of constructing a temporary candidate, eventually copied into
+ // val in case of successful parsing.
  void test06()
  {
    using namespace std;
*************** void test06()
*** 421,432 ****
    VERIFY( val == buffer3 );
  }

! class My_money_io_a : public std::moneypunct<wchar_t,false>
  {
- public:
-   explicit My_money_io_a(size_t r = 0): std::moneypunct<wchar_t,false>(r) { }
    char_type do_decimal_point() const { return L'.'; }
-   char_type do_thousands_sep() const { return L','; }
    std::string do_grouping() const { return "\004"; }

    std::wstring do_curr_symbol() const { return L"$"; }
--- 451,459 ----
    VERIFY( val == buffer3 );
  }

! struct My_money_io_a : public std::moneypunct<wchar_t,false>
  {
    char_type do_decimal_point() const { return L'.'; }
    std::string do_grouping() const { return "\004"; }

    std::wstring do_curr_symbol() const { return L"$"; }
*************** public:
*** 441,452 ****
    }
  };

! class My_money_io_b : public std::moneypunct<wchar_t,false>
  {
- public:
-   explicit My_money_io_b(size_t r = 0): std::moneypunct<wchar_t,false>(r) { }
    char_type do_decimal_point() const { return L'.'; }
-   char_type do_thousands_sep() const { return L','; }
    std::string do_grouping() const { return "\004"; }

    std::wstring do_curr_symbol() const { return L"$"; }
--- 468,476 ----
    }
  };

! struct My_money_io_b : public std::moneypunct<wchar_t,false>
  {
    char_type do_decimal_point() const { return L'.'; }
    std::string do_grouping() const { return "\004"; }

    std::wstring do_curr_symbol() const { return L"$"; }




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]