summaryrefslogtreecommitdiff
path: root/tests/block_props_test.cpp
diff options
context:
space:
mode:
authorJosh Blum2013-07-09 23:38:50 -0700
committerJosh Blum2013-07-09 23:38:50 -0700
commitc1f3f2df1d859937f26770d24fe464b150251251 (patch)
tree7179c280a73d46b413458c0cc0b70841fa9c9a0b /tests/block_props_test.cpp
parent8c3ccbe2445a86678d87d03f6626881a2fddc7d5 (diff)
downloadsandhi-c1f3f2df1d859937f26770d24fe464b150251251.tar.gz
sandhi-c1f3f2df1d859937f26770d24fe464b150251251.tar.bz2
sandhi-c1f3f2df1d859937f26770d24fe464b150251251.zip
gras: rename props files to calls (for callable work)
Diffstat (limited to 'tests/block_props_test.cpp')
-rw-r--r--tests/block_props_test.cpp55
1 files changed, 0 insertions, 55 deletions
diff --git a/tests/block_props_test.cpp b/tests/block_props_test.cpp
deleted file mode 100644
index b14677d..0000000
--- a/tests/block_props_test.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright (C) by Josh Blum. See LICENSE.txt for licensing information.
-
-#include <boost/test/unit_test.hpp>
-#include <iostream>
-
-#include <gras/block.hpp>
-
-struct MyBlock : gras::Block
-{
- MyBlock(void):
- gras::Block("MyBlock")
- {
- foo = 0;
- this->register_call("get_foo", &MyBlock::get_foo);
- this->register_call("set_foo", &MyBlock::set_foo);
- }
-
- //dummy work
- void work(const InputItems &, const OutputItems &){}
-
- size_t get_foo(void)
- {
- return foo;
- }
-
- void set_foo(const size_t &new_foo)
- {
- foo = new_foo;
- }
-
- size_t foo;
-};
-
-BOOST_AUTO_TEST_CASE(test_property_set_get_with_return)
-{
- MyBlock my_block;
- BOOST_CHECK_EQUAL(my_block.foo, size_t(0));
-
- my_block.x("set_foo", size_t(42));
- BOOST_CHECK_EQUAL(my_block.foo, size_t(42));
-
- const size_t my_foo = my_block.x<size_t>("get_foo");
- BOOST_CHECK_EQUAL(my_foo, size_t(42));
-}
-
-BOOST_AUTO_TEST_CASE(test_property_errors)
-{
- MyBlock my_block;
-
- //property does not exist
- BOOST_CHECK_THROW(my_block.x<size_t>("get_bar"), std::exception);
-
- //wrong type for property
- BOOST_CHECK_THROW(my_block.x("set_foo", "a string"), std::exception);
-}