Jlm
Loading...
Searching...
No Matches
CfgTests.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2020 Nico Reißmann <nico.reissmann@gmail.com>
3 * See COPYING for terms of redistribution.
4 */
5
6#include <gtest/gtest.h>
7
8#include <jlm/llvm/ir/cfg.hpp>
10#include <jlm/llvm/ir/print.hpp>
11
12TEST(ControLFlowGraphTests, test_remove_node)
13{
14 using namespace jlm::llvm;
15
16 // Arrange
18
19 ControlFlowGraph cfg(im);
20
21 auto bb0 = BasicBlock::create(cfg);
22 bb0->add_outedge(bb0);
23 bb0->add_outedge(cfg.exit());
24
25 std::cout << ControlFlowGraph::ToAscii(cfg) << std::flush;
26
27 // Act
28 cfg.remove_node(bb0);
29
30 // Assert
31 EXPECT_EQ(cfg.nnodes(), 0u);
32}
TEST(ControLFlowGraphTests, test_remove_node)
Definition CfgTests.cpp:12
ExitNode * exit() const noexcept
Definition cfg.hpp:212
static ControlFlowGraph::iterator remove_node(ControlFlowGraph::iterator &it)
Definition cfg.cpp:36
size_t nnodes() const noexcept
Definition cfg.hpp:241
Global memory state passed between functions.