My Project
Loading...
Searching...
No Matches
Descriptions.cpp
Go to the documentation of this file.
1#ifndef __cxxtest__Descriptions_cpp__
2#define __cxxtest__Descriptions_cpp__
3
5
6namespace CxxTest
7{
11
12 //
13 // Convert total tests to string
14 //
15#ifndef _CXXTEST_FACTOR
17 {
18 numberToString( numTotalTests(), s );
19 return s;
20 }
21#else // _CXXTEST_FACTOR
22 char *WorldDescription::strTotalTests( char *s ) const
23 {
24 char *p = numberToString( numTotalTests(), s );
25
26 if ( numTotalTests() <= 1 )
27 return s;
28
29 unsigned n = numTotalTests();
30 unsigned numFactors = 0;
31
32 for ( unsigned factor = 2; (factor * factor) <= n; factor += (factor == 2) ? 1 : 2 ) {
33 unsigned power;
34
35 for ( power = 0; (n % factor) == 0; n /= factor )
36 ++ power;
37
38 if ( !power )
39 continue;
40
41 p = numberToString( factor, copyString( p, (numFactors == 0) ? " = " : " * " ) );
42 if ( power > 1 )
43 p = numberToString( power, copyString( p, "^" ) );
44 ++ numFactors;
45 }
46
47 if ( n > 1 ) {
48 if ( !numFactors )
49 copyString( p, tracker().failedTests() ? " :(" : tracker().warnings() ? " :|" : " :)" );
50 else
51 numberToString( n, copyString( p, " * " ) );
52 }
53 return s;
54 }
55#endif // _CXXTEST_FACTOR
56};
57
58#endif // __cxxtest__Descriptions_cpp__
CanonicalForm power(const CanonicalForm &f, int n)
exponentiation
int p
Definition: cfModGcd.cc:4078
char * strTotalTests(char *) const
virtual unsigned numTotalTests(void) const =0
CanonicalForm factor
Definition: facAbsFact.cc:97
char * copyString(char *dst, const char *src)
Definition: ValueTraits.cpp:30
char * s
Definition: ValueTraits.h:143
TestTracker & tracker()
Definition: TestTracker.h:111