knowrob  2.1.0
A Knowledge Base System for Cognition-enabled Robots
TokenBuffer.cpp File Reference
#include "knowrob/queries/TokenBuffer.h"
#include "knowrob/queries/TokenQueue.h"
#include "knowrob/Logger.h"
#include "knowrob/integration/python/utils.h"
#include "knowrob/queries/AnswerDontKnow.h"
#include <gtest/gtest.h>
Include dependency graph for TokenBuffer.cpp:

Go to the source code of this file.

Namespaces

 knowrob
 
 knowrob::py
 

Functions

template<>
void knowrob::py::createType< TokenBuffer > ()
 
 TEST (TokenBuffer, twoTokens)
 

Function Documentation

◆ TEST()

TEST ( TokenBuffer  ,
twoTokens   
)

Definition at line 68 of file TokenBuffer.cpp.

68  {
69  auto out = std::make_shared<TokenBuffer>();
70  auto channel = TokenStream::Channel::create(out);
71  auto dontKnow = std::make_shared<AnswerDontKnow>();
72  channel->push(dontKnow);
73  channel->push(EndOfEvaluation::get());
74  auto queue = out->createQueue();
75  std::vector<TokenPtr> tokens;
76  while (!queue->empty()) {
77  auto tok = queue->pop_front();
78  tokens.push_back(tok);
79  }
80  ASSERT_EQ(tokens.size(), 2);
81  ASSERT_EQ(tokens[0], dontKnow);
82  ASSERT_EQ(tokens[1], EndOfEvaluation::get());
83 }