Skip to content

Commit

Permalink
[luci/lang] Add extended buffer accessors in Module
Browse files Browse the repository at this point in the history
This will add extended buffer accessors in Module.

ONE-DCO-1.0-Signed-off-by: SaeHie Park <[email protected]>
  • Loading branch information
seanshpark committed Aug 28, 2024
1 parent 4210185 commit d3a10b0
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
7 changes: 7 additions & 0 deletions compiler/luci/lang/include/luci/IR/Module.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,13 @@ class Module final

// TODO provide graph accessor with a name

public:
void ext_buffer(bool set) { _ext_buffer = set; }
bool ext_buffer(void) const { return _ext_buffer; }

private:
bool _ext_buffer = false;

public:
void source_table(const std::map<uint32_t, std::string> &table) { _source_table = table; }

Expand Down
15 changes: 15 additions & 0 deletions compiler/luci/lang/src/Module.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,14 @@ TEST(ModuleTest, add_more)
ASSERT_EQ(g3_ptr, m->graph(2));
}

TEST(ModuleTest, ext_buffer)
{
auto m = luci::make_module();

m->ext_buffer(true);
ASSERT_TRUE(m->ext_buffer());
}

TEST(ModuleTest, add_nullptr_NEG)
{
auto m = luci::make_module();
Expand All @@ -71,3 +79,10 @@ TEST(ModuleTest, graph_index_overflow_NEG)

EXPECT_ANY_THROW(m->graph(100));
}

TEST(ModuleTest, ext_buffer_NEG)
{
auto m = luci::make_module();
// NOTE how can we define negative test for ext_buffer?
ASSERT_FALSE(m->ext_buffer());
}

0 comments on commit d3a10b0

Please sign in to comment.