knowrob  2.1.0
A Knowledge Base System for Cognition-enabled Robots
ListTerm.cpp File Reference
#include <gtest/gtest.h>
#include "knowrob/terms/ListTerm.h"
#include "knowrob/terms/String.h"
#include "knowrob/integration/python/utils.h"
Include dependency graph for ListTerm.cpp:

Go to the source code of this file.

Namespaces

 knowrob
 
 knowrob::py
 

Functions

template<>
void knowrob::py::createType< ListTerm > ()
 
 TEST (list_term, NIL)
 
 TEST (list_term, lists)
 

Function Documentation

◆ TEST() [1/2]

TEST ( list_term  ,
lists   
)

Definition at line 67 of file ListTerm.cpp.

67  {
68  auto x = std::make_shared<String>("x");
69  auto y = std::make_shared<String>("y");
70  EXPECT_TRUE(ListTerm({x}).isGround());
71  EXPECT_FALSE(ListTerm({x}).isAtomic());
72  EXPECT_FALSE(ListTerm({x}).elements().empty());
73  EXPECT_EQ(ListTerm({x, y}).elements()[0], x);
74  EXPECT_EQ(ListTerm({x, y}).elements()[1], y);
75 }

◆ TEST() [2/2]

TEST ( list_term  ,
NIL   
)

Definition at line 59 of file ListTerm.cpp.

59  {
60  EXPECT_TRUE(ListTerm::nil()->elements().empty());
61  EXPECT_TRUE(ListTerm({}).elements().empty());
62  EXPECT_TRUE(ListTerm({}).isNIL());
63  EXPECT_FALSE(ListTerm::nil()->isAtomic());
64  EXPECT_TRUE(ListTerm::nil()->isGround());
65 }
TermRule & nil()
Definition: terms.cpp:99