GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: tests/tools/test_mailbox.cpp Lines: 19 19 100.0 %
Date: 2023-03-13 12:09:37 Branches: 32 60 53.3 %

Line Branch Exec Source
1
/*
2
 * Copyright 2010,
3
 * François Bleibel,
4
 * Olivier Stasse,
5
 *
6
 * CNRS/AIST
7
 *
8
 */
9
10
#include <iostream>
11
#include <sot/core/debug.hh>
12
13
#ifndef WIN32
14
#include <unistd.h>
15
#endif
16
17
using namespace std;
18
19
#include <dynamic-graph/entity.h>
20
#include <dynamic-graph/factory.h>
21
22
#include <sot/core/feature-abstract.hh>
23
#include <sot/core/mailbox-vector.hh>
24
#include <sstream>
25
26
using namespace dynamicgraph;
27
using namespace dynamicgraph::sot;
28
29
#include <boost/thread.hpp>
30
31
sot::MailboxVector *mailbox = NULL;
32
33
1
void f(void) {
34
2
  Vector vect(25);
35
2
  Vector vect2(25);
36
251
  for (int i = 0; i < 250; ++i) {
37

250
    std::cout << " iter  " << i << std::endl;
38

6500
    for (int j = 0; j < 25; ++j) vect(j) = j + i * 10;
39
250
    mailbox->post(vect);
40

500
    Vector V = mailbox->getObject(vect2, 1);
41

250
    std::cout << vect2 << std::endl;
42


250
    std::cout << " getClassName   " << mailbox->getClassName() << std::endl;
43

250
    std::cout << " getName        " << mailbox->getName() << std::endl;
44


250
    std::cout << " hasBeenUpdated " << mailbox->hasBeenUpdated() << std::endl;
45
250
    std::cout << std::endl;
46
  }
47
1
}
48
49
1
int main(int, char **) {
50

1
  mailbox = new sot::MailboxVector("mail");
51
52
1
  boost::thread th(f);
53
1
  th.join();
54
55
1
  return 0;
56
}