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

daisytuner / sdfglib / 17656823807

11 Sep 2025 08:42PM UTC coverage: 60.447% (+1.1%) from 59.335%
17656823807

Pull #219

github

web-flow
Merge d5416236f into 6c1992b40
Pull Request #219: stdlib Library Nodes and ConstantNodes

460 of 1635 new or added lines in 81 files covered. (28.13%)

93 existing lines in 35 files now uncovered.

9385 of 15526 relevant lines covered (60.45%)

107.21 hits per line

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

0.0
/src/data_flow/library_nodes/stdlib/rand.cpp
1
#include "sdfg/data_flow/library_nodes/stdlib/rand.h"
2

3
namespace sdfg {
4
namespace stdlib {
5

NEW
6
RandNode::RandNode(
×
7
    size_t element_id, const DebugInfo& debug_info, const graph::Vertex vertex, data_flow::DataFlowGraph& parent
8
)
NEW
9
    : LibraryNode(
×
NEW
10
          element_id,
×
NEW
11
          debug_info,
×
NEW
12
          vertex,
×
NEW
13
          parent,
×
14
          LibraryNodeType_Rand,
NEW
15
          {"_ret"},
×
NEW
16
          {},
×
17
          true,
18
          data_flow::ImplementationType_NONE
NEW
19
      ) {}
×
20

NEW
21
void RandNode::validate(const Function& function) const {}
×
22

NEW
23
symbolic::SymbolSet RandNode::symbols() const { return {}; }
×
24

25
std::unique_ptr<data_flow::DataFlowNode> RandNode::
NEW
26
    clone(size_t element_id, const graph::Vertex vertex, data_flow::DataFlowGraph& parent) const {
×
NEW
27
    return std::make_unique<RandNode>(element_id, debug_info_, vertex, parent);
×
28
}
29

NEW
30
void RandNode::replace(const symbolic::Expression& old_expression, const symbolic::Expression& new_expression) {}
×
31

NEW
32
nlohmann::json RandNodeSerializer::serialize(const data_flow::LibraryNode& library_node) {
×
NEW
33
    const RandNode& node = static_cast<const RandNode&>(library_node);
×
34

NEW
35
    nlohmann::json j;
×
NEW
36
    j["code"] = node.code().value();
×
37

NEW
38
    return j;
×
NEW
39
}
×
40

NEW
41
data_flow::LibraryNode& RandNodeSerializer::deserialize(
×
42
    const nlohmann::json& j, builder::StructuredSDFGBuilder& builder, structured_control_flow::Block& parent
43
) {
NEW
44
    assert(j.contains("code"));
×
NEW
45
    assert(j.contains("debug_info"));
×
46

NEW
47
    auto code = j["code"].get<std::string>();
×
NEW
48
    if (code != LibraryNodeType_Rand.value()) {
×
NEW
49
        throw InvalidSDFGException("Invalid library node code");
×
50
    }
51

NEW
52
    sdfg::serializer::JSONSerializer serializer;
×
NEW
53
    DebugInfo debug_info = serializer.json_to_debug_info(j["debug_info"]);
×
54

NEW
55
    return builder.add_library_node<RandNode>(parent, debug_info);
×
NEW
56
}
×
57

NEW
58
RandNodeDispatcher::RandNodeDispatcher(
×
59
    codegen::LanguageExtension& language_extension,
60
    const Function& function,
61
    const data_flow::DataFlowGraph& data_flow_graph,
62
    const RandNode& node
63
)
NEW
64
    : codegen::LibraryNodeDispatcher(language_extension, function, data_flow_graph, node) {}
×
65

NEW
66
void RandNodeDispatcher::dispatch_code(
×
67
    codegen::PrettyPrinter& stream,
68
    codegen::PrettyPrinter& globals_stream,
69
    codegen::CodeSnippetFactory& library_snippet_factory
70
) {
NEW
71
    auto& rand_node = static_cast<const RandNode&>(node_);
×
72

NEW
73
    stream << rand_node.outputs().at(0) << " = ";
×
NEW
74
    stream << "rand()" << ";" << std::endl;
×
NEW
75
}
×
76

77
} // namespace stdlib
78
} // namespace sdfg
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

© 2025 Coveralls, Inc