Exemplo n.º 1
0
bool CList::identityIncludesAny(CList* l) {
  if (this == l) return nonEmpty();
  for (CListElem* e = l->head(); e; e = e->next()) {
    if (identityIncludes(e->data())) return true;
  }
  return false;
}
Exemplo n.º 2
0
/**
 * Create empty and non-empty HandlerAndPolicy instances. Expect that empty instances are interpreted as false and
 * non-empty values are interpreted as true.
 */
TEST_F(HandlerAndPolicyTest, testOperatorBool) {
    auto handler = std::make_shared<TestDirectiveHandler>();
    HandlerAndPolicy defaultHandlerAndPolicy;
    HandlerAndPolicy firstHalfEmpty(nullptr, BlockingPolicy::BLOCKING);
    HandlerAndPolicy secondHalfEmpty(handler, BlockingPolicy::NONE);
    HandlerAndPolicy nonEmpty(handler, BlockingPolicy::BLOCKING);
    ASSERT_FALSE(defaultHandlerAndPolicy);
    ASSERT_FALSE(firstHalfEmpty);
    ASSERT_FALSE(secondHalfEmpty);
    ASSERT_TRUE(nonEmpty);
}
Exemplo n.º 3
0
TEST(TensorType, EmptyMatrix) {
  CpuMatrix empty(nullptr, 0, 0);
  CpuMatrix nonEmpty(10, 10);
  EXPECT_EQ(empty.isEmpty(), true);
  EXPECT_EQ(nonEmpty.isEmpty(), false);
  CHECK(nonEmpty);
  auto function = [](const CpuMatrix& matrix) {
    if (matrix) {
      EXPECT_NE(matrix.getData(), nullptr);
    } else {
      EXPECT_EQ(matrix.getData(), nullptr);
    }
  };
  function(empty);
  function(nonEmpty);
}
Exemplo n.º 4
0
 void* removeHeadL() {
   assert(nonEmpty(), "removing from an empty list");
   void* d = firstL();
   _head = headL()->nextL();
   if (--_len == 0) _tail = _head;
   return d; }