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

nasa / trick / 25459968639

06 May 2026 08:42PM UTC coverage: 55.916% (-0.8%) from 56.7%
25459968639

Pull #2011

github

web-flow
Merge f11412d5f into 7054e405e
Pull Request #2011: Single-file CI and code style adoption

14607 of 26123 relevant lines covered (55.92%)

466416.66 hits per line

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

0.0
/trick_source/sim_services/Message/MessageLCout.cpp
1

2
#include <string.h>
3
#include <sstream>
4

5
#include "trick/MessageLCout.hh"
6

7
Trick::MessageLCout::MessageLCout() {
×
8
    enabled = 1 ;
×
9
    subs['a'] = "4" ;
×
10
    subs['e'] = "3" ;
×
11
    subs['f'] = "ph" ;
×
12
    subs['g'] = "9" ;
×
13
    subs['l'] = "1" ;
×
14
    subs['o'] = "0" ;
×
15
    subs['s'] = "5" ;
×
16
    subs['t'] = "7" ;
×
17

18
    seed = 0 ;
×
19

20
    name = "lcout" ;
×
21
}
×
22

23
void Trick::MessageLCout::update( unsigned int level , std::string header , std::string message ) {
×
24
    if (!enabled) {
×
25
        return;
×
26
    }
27
    if ( level == 1337 ) {
×
28
        std::string in_string ;
×
29
        std::string temp_string ;
×
30
        unsigned int ii , jj ;
31

32
        in_string = header + message ;
×
33

34
        for ( ii = 0 ; ii < in_string.size() ; ii++ ) {
×
35
            seed += in_string[ii] * ii ;
×
36
        }
37
        srandom(seed) ;
×
38
        for ( ii = 0 ; ii < in_string.size() ; ii++ ) {
×
39
            if ( random() < RAND_MAX * 0.3 ) {
×
40
                if ( subs.find((char)tolower(in_string[ii])) != subs.end()) {
×
41
                    //temp_string += subs[(char)tolower(in_string[ii])] ;
42
                    std::string replace_str = subs[(char)tolower(in_string[ii])] ;
×
43
                    for ( jj = 0 ; jj < replace_str.size() ; jj++ ) {
×
44
                        if ( random() < RAND_MAX * 0.5 ) {
×
45
                            temp_string += toupper(replace_str[jj]) ;
×
46
                        } else {
47
                            temp_string += tolower(replace_str[jj]) ;
×
48
                        }
49
                    }
50
                } else {
×
51
                    temp_string += in_string[ii] ;
×
52
                }
53
            } else {
54
                if ( random() < RAND_MAX * 0.3 ) {
×
55
                    temp_string += toupper(in_string[ii]) ;
×
56
                } else {
57
                    temp_string += tolower(in_string[ii]) ;
×
58
                }
59
            }
60
        }
61
        std::cout << temp_string << std::flush ;
×
62
    } else if ( level < 100 ) {
×
63
        // Building the final string in a temporary stream ensures an automic call to cout, which prevents
64
        // multithreaded sims from interleaving header and message elements.
65
        std::ostringstream oss;
×
66
        oss << header << message ;
×
67
        std::cout << oss.str() << std::flush ;
×
68
    }
×
69
}
70

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