This file is indexed.

/usr/include/wibble/sys/netbuffer.test.h is in libwibble-dev 1.1-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/* -*- C++ -*- (c) 2007 Petr Rockai <me@mornfall.net>
               (c) 2007 Enrico Zini <enrico@enricozini.org> */

#include <wibble/sys/netbuffer.h>

#include <wibble/test.h>
#include <cstring>

using namespace std;
using namespace wibble::sys;

struct TestNetBuffer {

    // Ensure that a plain NetBuffer starts from the beginning of the string
    Test startAtBeginning() {
        NetBuffer buf("antani", 6);

        assert_eq(buf.size(), 6u);
        assert(memcmp(buf.data(), "antani", 6) == 0);

        assert_eq(*buf.cast<char>(), 'a');
        assert(buf.fits<short int>());
        assert(!buf.fits<long long int>());
    }

    // Try skipping some bytes
    Test skipBytes() {
        NetBuffer buf("antani", 6);

        NetBuffer buf1(buf);
        
        assert_eq(buf1.size(), 6u);
        assert(memcmp(buf1.data(), "antani", 6) == 0);

        buf1 += 2;
        assert_eq(buf1.size(), 4u);
        assert(memcmp(buf1.data(), "tani", 4) == 0);
        assert_eq(*buf1.cast<char>(), 't');

        buf1 = buf + 2;
        assert_eq(buf1.size(), 4u);
        assert(memcmp(buf1.data(), "tani", 4) == 0);
        assert_eq(*buf1.cast<char>(), 't');
        
        buf1 = buf;
        buf1.skip(2);
        assert_eq(buf1.size(), 4u);
        assert(memcmp(buf1.data(), "tani", 4) == 0);
        assert_eq(*buf1.cast<char>(), 't');
        
        buf1 = buf.after(2);
        assert_eq(buf1.size(), 4u);
        assert(memcmp(buf1.data(), "tani", 4) == 0);
        assert_eq(*buf1.cast<char>(), 't');
        
        buf1 = buf;
        buf1.skip<short int>();
        assert_eq(buf1.size(), 4u);
        assert(memcmp(buf1.data(), "tani", 4) == 0);
        assert_eq(*buf1.cast<char>(), 't');
        
        buf1 = buf.after<short int>();
        assert_eq(buf1.size(), 4u);
        assert(memcmp(buf1.data(), "tani", 4) == 0);
        assert_eq(*buf1.cast<char>(), 't');
    }
    
};

// vim:set ts=4 sw=4: