1#ifndef __cxxtest__ValueTraits_cpp__
2#define __cxxtest__ValueTraits_cpp__
15 return (
char)(
'0' + digit);
16 if ( digit <= 10 +
'Z' -
'A' )
17 return (
char)(
'A' + digit - 10);
32 while ( (*dst = *src) !=
'\0' ) {
42 while ( (c = *s1++) == *s2++ )
61 if ( c >= 32 && c <= 127 ) {
73 return numberToString( c,
s + 2, 16UL );
82 char *
bytesToString(
const unsigned char *bytes,
unsigned numBytes,
unsigned maxBytes,
char *
s )
84 bool truncate = (numBytes > maxBytes);
89 for (
unsigned i = 0;
i < numBytes; ++
i, ++ bytes )
96#ifndef CXXTEST_USER_VALUE_TRAITS
100 for ( t = (t < 0.0) ? -t : t; t > 1.0; t /= BASE )
116 char *
s = doNegative( t );
117 s = doubleToString( t,
s, 0, 1 );
119 s = doubleToString( t,
s, 1, DIGITS_ON_RIGHT );
121 s = numberToString( requiredDigitsOnLeft( t ) - 1,
s );
126 char *
s = doNegative( t );
127 s = doubleToString( t,
s );
129 for (
unsigned i = 0;
i < DIGITS_ON_RIGHT; ++
i )
130 s = numberToString( (
unsigned)(t *= BASE) % BASE,
s );
135 return numberToString<double>( t,
s, BASE, skip,
max );
char * doNegative(double &t)
void normalNumber(double t)
char * doubleToString(double t, char *s, unsigned skip=0, unsigned max=(unsigned) -1)
void hugeNumber(double t)
static unsigned requiredDigitsOnLeft(double t)
char _asString[sizeof("{ ")+sizeof("XX ") *MAX_BYTES+sizeof("... }")]
static int max(int a, int b)
bool stringsEqual(const char *s1, const char *s2)
const char * byteToHex(unsigned char byte)
char digitToChar(unsigned digit)
char * copyString(char *dst, const char *src)
char * charToString(unsigned long c, char *s)
char * bytesToString(const unsigned char *bytes, unsigned numBytes, unsigned maxBytes, char *s)