File: DefaultTraits.h

package info (click to toggle)
cxxtest 4.4%2Bgit171022-2
  • links: PTS
  • area: main
  • in suites: bookworm, bullseye, sid, trixie
  • size: 2,836 kB
  • sloc: cpp: 9,567; python: 9,553; xml: 435; sh: 258; ruby: 229; makefile: 86; ansic: 68; perl: 16
file content (41 lines) | stat: -rw-r--r-- 753 bytes parent folder | download | duplicates (13)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <cxxtest/TestSuite.h>

//
// This test suite demonstrates the default ValueTraits
//

class DefaultTraits : public CxxTest::TestSuite
{
public:
    struct EightBytes
    {
        EightBytes() {}
        unsigned char data[8];
    };

    void testSmallDefaultTraits()
    {
        EightBytes x;
        for (unsigned i = 0; i < sizeof(x.data); ++ i)
        {
            x.data[i] = (unsigned char)i;
        }
        TS_FAIL(x);
    }

    struct NineBytes
    {
        NineBytes() {}
        unsigned char data[9];
    };

    void testBigDefaultTraits()
    {
        NineBytes x;
        for (unsigned i = 0; i < sizeof(x.data); ++ i)
        {
            x.data[i] = (unsigned char)(0x98 + i);
        }
        TS_FAIL(x);
    }
};