• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

nasa / trick / 27159810705

08 Jun 2026 06:53PM UTC coverage: 56.965% (+0.02%) from 56.944%
27159810705

Pull #2133

github

web-flow
Merge 9515c5f7e into ae12707cd
Pull Request #2133: Enable broadcast by default and update sniffer

3 of 4 new or added lines in 3 files covered. (75.0%)

3 existing lines in 3 files now uncovered.

12983 of 22791 relevant lines covered (56.97%)

295562.81 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

96.97
/trick_source/sim_services/Message/MessageCout.cpp
1

2
#include "trick/MessageCout.hh"
3
#include "trick/message_type.h"
4

5
#include <sstream>
6

7
Trick::MessageCout::MessageCout() {
218✔
8
    /** By default, this subscriber is enabled when it is created. */
9
    enabled = 1 ;
218✔
10
    color = 1 ;
218✔
11
    name = "cout" ;
218✔
12
}
218✔
13

14
void Trick::MessageCout::update( unsigned int level , std::string header , std::string message ) {
34,156✔
15

16
    /** @par Design Details: */
17
    std::string color_code ;
68,312✔
18

19
    switch (level) {
34,156✔
20
        case MSG_NORMAL :
2,389✔
21
            color_code = "\033[00m" ; // normal
2,389✔
22
            break ;
2,389✔
23
        case MSG_INFO :
91✔
24
            color_code = "\033[32m" ; // green
91✔
25
            break ;
91✔
26
        case MSG_WARNING :
21✔
27
            color_code = "\033[33m" ; // yellow
21✔
28
            break ;
21✔
29
        case MSG_ERROR :
34✔
30
            color_code = "\033[31m" ; // red
34✔
31
            break ;
34✔
32
        case MSG_DEBUG :
357✔
33
            color_code = "\033[36m" ; // cyan
357✔
34
            break ;
357✔
35
        default :
31,264✔
36
            color_code = "\033[00m" ; // normal
31,264✔
37
            break ;
31,264✔
38
    }
39

40
    /** @li Prints the received message to the standard output stream. */
41
    if (enabled && level < 100 ) {
34,156✔
42

43
        // Building the final string in a temporary stream ensures an automic call to cout, which prevents
44
        // multithreaded sims from interleaving header and message elements.
45
        std::ostringstream oss;
34,156✔
46
        if ( color ) {
34,156✔
47
            oss << header << color_code << message << "\033[00m" ;
34,156✔
48
        } else {
UNCOV
49
            oss << header << message ;
×
50
        }
51
        std::cout << oss.str() << std::flush;
34,156✔
52
    }
53
}
34,156✔
54

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc