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

nasa / trick / 16919458345

12 Aug 2025 07:57PM UTC coverage: 55.859% (-0.08%) from 55.938%
16919458345

push

github

web-flow
Updated to allow to use index [0] on regular pointer. (#1929)

* Updated to allow to use index [0] on regular pointer.

* Added support to check the array bounds that a regular pointer points to.

* Updated to handle the pointer that doesn't point to array.

3 of 36 new or added lines in 2 files covered. (8.33%)

4 existing lines in 2 files now uncovered.

12346 of 22102 relevant lines covered (55.86%)

252942.92 hits per line

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

73.08
/trick_source/sim_services/MemoryManager/MemoryManager_ref_attributes.cpp
1

2
#include <string.h>
3
#include <stdio.h>
4
#include <stdlib.h>
5
#include <sstream>
6
#include "trick/MemoryManager.hh"
7
#include "trick/RefParseContext.hh"
8

9
extern int REF_debug;
10

11
REF2 *Trick::MemoryManager::ref_attributes(const char* name) {
12,792✔
12

13
    std::stringstream reference_sstream;
12,792✔
14
    REF2 * result = NULL;
12,792✔
15
    RefParseContext* context = NULL;
12,792✔
16

17
    /** @par Design Details: */
18
    reference_sstream << name;
12,792✔
19

20
    REF_debug = 0;
12,792✔
21

22
    /** @li Create a parse context. */
23
    context = new RefParseContext(this, &reference_sstream);
12,792✔
24

25
    /** @li Call REF_parse to parse the variable reference. */
26
    if (context != NULL) {
12,792✔
27
        int parse_ret = REF_parse(context);
12,792✔
28
        if ( parse_ret == 0) {
12,792✔
29
            /* throw away the reference returned by the ref_parser, it isn't the same
30
               name as requested as "name" */
31
            if ( context->result->reference ) {
12,685✔
32
                free(context->result->reference) ;
12,685✔
33
            }
34
            context->result->reference = strdup(name);
12,685✔
35
            result = context->result;
12,685✔
36
        } else if ( parse_ret == TRICK_PARAMETER_ARRAY_SIZE) {
107✔
37
            /* print out of bounds error message if MM debug_level is greater than 1 */
38
            if (debug_level > 1) {
1✔
39
                std::stringstream message;
×
40
                message << name << " contains out of bounds array index.";
×
41
                emitError(message.str());
×
42
            }
43
        } else if ( parse_ret == TRICK_PARAMETER_ADDRESS_NULL) {
106✔
44
            /* print NULL address error message if MM debug_level is greater than 1 */
NEW
45
            if (debug_level > 1) {
×
NEW
46
                std::stringstream message;
×
NEW
47
                message << name << " contains NULL address.";
×
NEW
48
                emitError(message.str());
×
49
            }
50
        }
51
        /** @li Delete the parse context. */
52
        delete( context);
12,792✔
53
    }
54

55
    /** @li Return the the REF2 object.*/
56
    return ( result);
25,584✔
57
}
58

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