locale_facets.tcc (num_get<char>::_M_extract): Fix signage, exponent, and scientific formatting issues.
2000-05-31 Russell Davidson <russell@ehess.cnrs-mrs.fr> * bits/locale_facets.tcc (num_get<char>::_M_extract): Fix signage, exponent, and scientific formatting issues. * testsuite/27_io/istream_extractor_arith.cc (test09): Add tests. From-SVN: r34328
This commit is contained in:
parent
b2c62b3c64
commit
64cdd351dd
4 changed files with 77 additions and 23 deletions
|
@ -1,3 +1,9 @@
|
|||
2000-05-31 Russell Davidson <russell@ehess.cnrs-mrs.fr>
|
||||
|
||||
* bits/locale_facets.tcc (num_get<char>::_M_extract): Fix signage,
|
||||
exponent, scientific formatting issues.
|
||||
* testsuite/27_io/istream_extractor_arith.cc (test09): Add tests.
|
||||
|
||||
2000-05-31 Branko Cibej <branko.cibej@hermes.si>
|
||||
|
||||
* bits/limits_generic.h (numeric_limits<wchar_t>): Use WCHAR_MIN
|
||||
|
@ -13,6 +19,8 @@
|
|||
|
||||
* acinclude.m4 (GLIBCPP_ENABLE_LONG_LONG): Add strtoull checks...
|
||||
|
||||
* mkcheck.in (SH_FLAG): Add in -Wl,--rpath -Wl,$LIB_PATH. Tweaks.
|
||||
|
||||
2000-05-31 Steven King <sxking@uswest.net>
|
||||
|
||||
* shadow/time.h: fix typo
|
||||
|
|
|
@ -313,6 +313,9 @@ namespace std
|
|||
int __sep_pos = 0;
|
||||
int __pos = 0;
|
||||
bool __testdec = false;
|
||||
bool __testEE = false;
|
||||
bool __testsign = false;
|
||||
bool __testEEsign = false;
|
||||
const char* __lits = __fmt->_S_literals;
|
||||
|
||||
while (__valid && __beg != __end)
|
||||
|
@ -322,17 +325,42 @@ namespace std
|
|||
const char* __p = strchr(__fmt->_S_literals, __c);
|
||||
|
||||
// NB: strchr returns true for __c == 0x0
|
||||
if (__p && __c)
|
||||
{
|
||||
if ((__p >= &__lits[__cache_type::_S_digits + __base]
|
||||
&& __p < &__lits[__cache_type::_S_digits_end]) ||
|
||||
(__p >= &__lits[__cache_type::_S_udigits+__base]
|
||||
&& __p < &__lits[__cache_type::_S_udigits_end]))
|
||||
if (__p && __c)
|
||||
{
|
||||
// Check for sign and accept if appropriate.
|
||||
if ((__p == &__lits[__cache_type::_S_minus])
|
||||
|| (__p == &__lits[__cache_type::_S_plus]))
|
||||
{
|
||||
if (!(__fp && (__p == &__lits[__cache_type::_S_ee]
|
||||
|| __p == &__lits[__cache_type::_S_Ee])))
|
||||
break;
|
||||
if (__testEE)
|
||||
{
|
||||
if (__testEEsign) break;
|
||||
__testEEsign = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (__testsign) break;
|
||||
__testsign = true;
|
||||
}
|
||||
}
|
||||
// Check for exponential part and accept if appropriate.
|
||||
else if ((__p == &__lits[__cache_type::_S_ee])
|
||||
|| (__p == &__lits[__cache_type::_S_Ee]))
|
||||
{
|
||||
if (!__fp || __testEE || !__testsign) break;
|
||||
__testEE = true;
|
||||
}
|
||||
// Check for appropriate digits. If found, too late for a sign
|
||||
else if ((__p >= &__lits[__cache_type::_S_digits]
|
||||
&& __p < &__lits[__cache_type::_S_digits+__base])
|
||||
|| (__p >= &__lits[__cache_type::_S_udigits]
|
||||
&& __p < &__lits[__cache_type::_S_udigits+__base]))
|
||||
{
|
||||
__testsign = true;
|
||||
if (__testEE) __testEEsign = true;
|
||||
}
|
||||
// Nothing else will do
|
||||
else break;
|
||||
|
||||
__xtrc[__pos] = __c;
|
||||
++__pos;
|
||||
++__sep_pos;
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# 2000-05-17 bkoz
|
||||
|
||||
# Script to do automated testing and data collection
|
||||
# for various test files, so that we don't have to do this by hand on
|
||||
# every test file. It attempts to collect some diagnostic info about
|
||||
|
@ -61,14 +59,10 @@ fi
|
|||
|
||||
#LIB_PATH == where to find the build library binaries.
|
||||
if [ $WHICH != "1" ]; then
|
||||
LIB_PATH="-L$BUILD_DIR/src/.libs"
|
||||
# BSD seems to want this
|
||||
# LIB_PATH="-L$BUILD_DIR/src/.libs -R$BUILD_DIR/src/.libs"
|
||||
LIB_PATH="$BUILD_DIR/src/.libs"
|
||||
CXX="../../gcc/g++ -B../../gcc/"
|
||||
elif [ $WHICH -eq 1 ]; then
|
||||
LIB_PATH="-L$PREFIX_DIR/lib"
|
||||
# BSD seems to want this
|
||||
# LIB_PATH="-L$PREFIX_DIR/lib -R$PREFIX_DIR/lib"
|
||||
LIB_PATH="$PREFIX_DIR/lib"
|
||||
CXX="$PREFIX_DIR/bin/g++"
|
||||
fi
|
||||
|
||||
|
@ -77,10 +71,10 @@ fi
|
|||
#CXX_FLAG="-g -O2 -DDEBUG_ASSERT "
|
||||
CXX_FLAG="-g -DDEBUG_ASSERT "
|
||||
|
||||
# a specific flag to force the use of shared libraries, if any
|
||||
# a specific flag(s) to force the use of shared libraries, if any
|
||||
SH_FLAG=""
|
||||
|
||||
# a specific flag to force the use of static libraries, if any
|
||||
# a specific flag(s) to force the use of static libraries, if any
|
||||
ST_FLAG="-static"
|
||||
|
||||
# Set up the testing directory, which should be in a directory called
|
||||
|
@ -183,8 +177,8 @@ test_file()
|
|||
# eventually have to calculate time_t anyhow. Or 3) just grab two
|
||||
# time_t's (no more overhead than grabbing two date(1)'s).
|
||||
COMP_TIME_START=$($TEST_DIR/printnow)
|
||||
$CXX $CXX_FLAG $S_FLAG $INC_PATH $LIB_PATH $FILENAME \
|
||||
-o $EXENAME 2>> $LOG_FILE
|
||||
$CXX $CXX_FLAG $S_FLAG $INC_PATH -L$LIB_PATH -Wl,--rpath -Wl,$LIB_PATH \
|
||||
$FILENAME -o $EXENAME 2>> $LOG_FILE
|
||||
COMP_TIME_END=$($TEST_DIR/printnow)
|
||||
|
||||
if [ $COMP_TIME_START -lt $COMP_TIME_END ]; then
|
||||
|
@ -293,8 +287,8 @@ test_file()
|
|||
#fi
|
||||
else
|
||||
# the file did not compile. Write out compilation info to the log file.
|
||||
echo "$CXX $CXX_FLAG $ST_FLAG $INC_PATH $LIB_PATH $CNAME -o $EXENAME" \
|
||||
2>> $LOG_FILE
|
||||
echo "$CXX $CXX_FLAG $S_FLAG $INC_PATH -L$LIB_PATH -Wl,--rpath -Wl,$LIB_PATH \
|
||||
$FILENAME -o $EXENAME" 2>> $LOG_FILE
|
||||
|
||||
RESULT="-"
|
||||
TEXT="0"
|
||||
|
|
|
@ -355,6 +355,29 @@ void test08()
|
|||
#endif
|
||||
}
|
||||
|
||||
|
||||
bool test09()
|
||||
{
|
||||
bool test = true;
|
||||
|
||||
std::string st("2.456e3-+0.567e-2");
|
||||
std::stringbuf sb(st);
|
||||
std::istream is(&sb);
|
||||
double f1 = 0, f2 = 0;
|
||||
char c;
|
||||
(is>>std::ws) >> f1;
|
||||
(is>>std::ws) >> c;
|
||||
(is>>std::ws) >> f2;
|
||||
test = f1 == 2456;
|
||||
test &= f2 == 0.00567;
|
||||
test &= c == '-';
|
||||
#ifdef DEBUG_ASSERT
|
||||
assert(test);
|
||||
#endif
|
||||
|
||||
return test;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test01();
|
||||
|
@ -364,6 +387,7 @@ int main()
|
|||
test06();
|
||||
test07();
|
||||
test08();
|
||||
test09();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue