summaryrefslogtreecommitdiffhomepage
path: root/tests/test-flowgraph.cpp
blob: b0daeae54cab0f37cdac83cc70c2449c97b78b44 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include "flowgraph/data.h"
#include "flowgraph/graph.h"
#include "flowgraph/node.h"
#include "flowgraph/storage.h"

#include <boost/algorithm/string.hpp>

#include "gmock/gmock.h"
#include "gtest/gtest.h"

#include <algorithm>
#include <cctype>
#include <deque>
#include <map>
#include <memory>
#include <string>
#include <system_error>
#include <utility>
#include <vector>

using namespace std::string_literals;
namespace fs = std::filesystem;

using namespace FlowGraph;

class FlowGraphTest: public ::testing::Test
{
protected:
 FlowGraphTest() {
  //debug = true;
 }
 ~FlowGraphTest() {
 }
 void SetUp(){
 }
 void TearDown(){
 }
};

TEST_F(FlowGraphTest, build_graph) {
 Graph graph;

 std::shared_ptr<CreateScopeOp> createScope{std::make_shared<CreateScopeOp>()};
 graph.push_back(createScope);

 Data pointer{ MakeLocalPointer(createScope->scope(), "malloc1") };
 Data size{ MakeLocalInt(createScope->scope(), "size1") };
 std::shared_ptr<Node> malloc1 {std::make_shared<AllocateDynamic>(pointer, size) };
 graph.push_back(malloc1);
 
 std::shared_ptr<Node> free1{ std::make_shared<DeallocateDynamic>(pointer) };
 graph.push_back(free1);
 
 std::shared_ptr<Node> destroyScope{std::make_shared<DestroyScopeOp>(createScope->scope())};
 graph.push_back(destroyScope);
}