Skip to content

Commit

Permalink
add more test for list comprehension (commented cause don't compile)
Browse files Browse the repository at this point in the history
  • Loading branch information
ngeiswei committed Jan 27, 2012
1 parent bde8635 commit 04cf6ff
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion tests/util/comprehensionUTest.cxxtest
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,19 @@
*/

#include <opencog/util/comprehension.h>
#include <boost/spirit/include/phoenix_core.hpp>
#include <boost/spirit/include/phoenix_operator.hpp>

using namespace opencog;
using namespace boost::phoenix;
using boost::phoenix::arg_names::arg1;

class comprehensionUTest : public CxxTest::TestSuite
{
public:
comprehensionUTest() {}

void test_vector_comp() {
void test_vector_comp_function_object() {
std::vector<int> ivec = {1,2,3,4};
struct Func : public std::unary_function<int, int> {
int operator()(int i) {
Expand All @@ -41,4 +45,17 @@ public:
std::vector<int> evec = {2,3,4,5};
TS_ASSERT_EQUALS(ovec, evec);
}
// void test_vector_comp_phoenix() {
// std::vector<int> ivec = {1,2,3,4};
// auto f = arg1 + 1;
// auto ovec = list_comp(ivec, arg1);
// std::vector<int> evec = {2,3,4,5};
// TS_ASSERT_EQUALS(ovec, evec);
// }
// void test_vector_comp_lambda() {
// std::vector<int> ivec = {1,2,3,4};
// auto ovec = vector_comp(ivec, [](int x) { return x + 1; });
// std::vector<int> evec = {2,3,4,5};
// TS_ASSERT_EQUALS(ovec, evec);
// }
};

0 comments on commit 04cf6ff

Please sign in to comment.