TEST_F(AbstractBuilderShould, callConstructedAfterBuildingIsFinished) {
	givenSame3TypesBuilder();

	::testing::NiceMock<Same3Types> same3types;
	EXPECT_CALL(same3types,constructed());
	same3typesBuilder->build(same3types);
}
Exemplo n.º 2
0
void SubgraphUpwardPlanarizer::constructComponentGraphs(BCTree &BC, NodeArray<GraphCopy> &biComps)
{
	NodeArray<int> constructed(BC.originalGraph(), -1);
	const Graph &bcTree = BC.bcTree();
	int i = 0; // comp. number
	for(node v : bcTree.nodes) {

		if (BC.typeOfBNode(v) == BCTree::CComp)
			continue;

		const SList<edge> &edges_comp = BC.hEdges(v); //bicomp edges
		List<edge> edges_orig;
		for(edge e : edges_comp)
			edges_orig.pushBack(BC.original(e));

		GraphCopy GC;
		GC.createEmpty(BC.originalGraph());
		// construct i-th component graph
		for(edge eOrig : edges_orig) {
			node srcOrig = eOrig->source();
			node tgtOrig = eOrig->target();
			if (constructed[srcOrig] != i) {
				constructed[srcOrig] = i;
				GC.newNode(srcOrig);
			}
			if (constructed[tgtOrig] != i) {
				constructed[tgtOrig] = i;
				GC.newNode(tgtOrig);
			}
			GC.newEdge(eOrig);
		}
		biComps[v] = GC;
		i++;
	}
}
Exemplo n.º 3
0
TEST(ObjectTest, test_construction_and_destruction) {

    LifeCycleMock mock;
    EXPECT_CALL(mock, constructed()).Times(1);
    EXPECT_CALL(mock, destructed()).Times(1);

    TestObject::Ptr obj(TestObject::New(&mock));
}
Exemplo n.º 4
0
TEST(ObjectTest, test_construction_and_destruction_with_operator_assignment) {

    LifeCycleMock mock;
    EXPECT_CALL(mock, constructed()).Times(1);
    EXPECT_CALL(mock, destructed()).Times(1);

    TestObject::Ptr obj;
    obj = TestObject::New(&mock);
}
Exemplo n.º 5
0
TEST(ObjectTest, test_circular_with_object_weak) {

    LifeCycleMock mock;
    EXPECT_CALL(mock, constructed()).Times(2);
    EXPECT_CALL(mock, destructed()).Times(2);

    TestObject::Ptr obj0(TestObject::New(&mock));
    TestObject::Ptr obj1(TestObject::New(&mock));

    obj0->set_other(obj1);
    obj1->set_other(obj0);
}
static void
gabble_connection_manager_constructed (GObject *object)
{
  GabbleConnectionManager *self = GABBLE_CONNECTION_MANAGER (object);
  TpBaseConnectionManager *base = (TpBaseConnectionManager *) self;
  void (*constructed) (GObject *) =
      ((GObjectClass *) gabble_connection_manager_parent_class)->constructed;
  TpBaseProtocol *protocol;

  if (constructed != NULL)
    constructed (object);

  protocol = gabble_jabber_protocol_new ();
  tp_base_connection_manager_add_protocol (base, protocol);
  g_object_unref (protocol);
}
static void lwqq_connection_manager_constructed (GObject *object) {
	TpBaseConnectionManager *base = (TpBaseConnectionManager *) object;
	TpBaseProtocol *p;
	void (*constructed) (GObject *) = ((GObjectClass *) lwqq_connection_manager_parent_class)->constructed;

	if (constructed != NULL)
		constructed (object);

    p = g_object_new (LWQQ_TYPE_PROTOCOL,
            "name", PROTOCOL_NAME,
            NULL);

	tp_base_connection_manager_add_protocol (base, p);
    //let it auto released
	g_object_unref (p);
}
static void
example_contact_list_connection_manager_constructed (GObject *object)
{
  ExampleContactListConnectionManager *self =
    EXAMPLE_CONTACT_LIST_CONNECTION_MANAGER (object);
  TpBaseConnectionManager *base = (TpBaseConnectionManager *) self;
  void (*constructed) (GObject *) =
    ((GObjectClass *) example_contact_list_connection_manager_parent_class)->constructed;
  TpBaseProtocol *protocol;

  if (constructed != NULL)
    constructed (object);

  protocol = g_object_new (EXAMPLE_TYPE_CONTACT_LIST_PROTOCOL,
      "name", "example",
      NULL);
  tp_base_connection_manager_add_protocol (base, protocol);
  g_object_unref (protocol);
}
Exemplo n.º 9
0
TEST(ObjectTest, test_lock_and_expired_of_object_weak) {

    LifeCycleMock mock;
    EXPECT_CALL(mock, constructed());
    EXPECT_CALL(mock, destructed());

    TestObject::Weak weak;

    {
        TestObject::Ptr obj(TestObject::New(&mock));
        weak = obj;

        ASSERT_EQ(obj, weak.Lock());
        ASSERT_NE(nullptr, weak.Lock());
        ASSERT_FALSE(weak.Expired());
    }

    ASSERT_EQ(nullptr, weak.Lock());
    ASSERT_TRUE(weak.Expired());
}
Exemplo n.º 10
0
DeliverDotLock::DeliverDotLock() : truncate_fd(-1), truncate_size(0)
{
	constructed();
}
Exemplo n.º 11
0
EXPORT_C TInt RConsoleProxy::IsConstructed(TBool& aLazy)
	{
	TPckg<TBool> constructed(aLazy);
	return SendReceive(EIsConstructed, TIpcArgs(&constructed));
	}
Exemplo n.º 12
0
  void vmap::visit(size_type v, size_type depth)
  {
    not_ready();
    constructed();

    LVMAP_debug("Executing vmap[%u].visit(%u)\n", v, depth);
    
    // Check that max. depth was not reached
    bool was_seen = false;
    bool continue_search = true;
    {
      pxgl::util::scoped_use l(use_feb_);

      if (depth > seen_[v])
      {
        if (0 == seen_[v])
        {
          LVMAP_debug("%u: first coloring vertex %u with depth %u.\n",
              me_.get_lsb(), v, depth);

          // Color the vertex
          seen_[v] = depth;
        }
        else
        {
          was_seen = true;
        }
      }
      else
      {
        continue_search = false;
      }
    }

    LVMAP_debug(
        "Executing vmap[%u].visit(%u): was_seen(%d), continue_search(%d)\n", 
        v, depth, was_seen, continue_search);
    
    if (continue_search)
    {
      size_type const depth_1 = depth - 1;

      // Visit neighbors
      int payload = 0;
      pxgl::rts::get_ini_option(payload, "vmap.visit_payload");
      if (0 < payload)
      {
        edge_tuples_type edges;
        target_map_type visit_bins;

        graph_type::edge_iterator_type neighbors(graph_.sync_neighbors(v));
        graph_type::edge_tuples_type const & n_edges(neighbors.edges());
        size_type const begin(neighbors.begin());
        size_type const end(neighbors.end());
        for (size_type i = begin; i < end; i++)
        {
          edge_tuple_type const & edge(n_edges[i]);

          if (!was_seen)
          {
            edges.push_back(edge);
          }
         
          {
            if (0 < depth_1)
            {
              // Propogate visiting
              size_type const there_index = 
                  distribution_.member_id(edge.target());

              if (distribution_.size() == there_index)
              {
                // Target member is unknown, request extension
                extension_info_type const update = 
                    siblings_[0].eager_request_extension(
                        edge.target()).get();

                {
                  pxgl::util::scoped_use l(use_feb_);

                  distribution_.remap(update.coverage_map());

                  siblings_.clear();
                  BOOST_FOREACH(id_type const & sibling_id, update.sibling_ids())
                  {
                    siblings_.push_back(vmap_type(sibling_id));
                  }
                }
              }
    
              visit_bins[distribution_.member_id(edge.target())].push_back(
                  edge.target());
            }
          }

        }
Exemplo n.º 13
0
TEST(ObjectTest, test_object_ptr_validation_as_container_hash_key) {

    LifeCycleMock mock;
    EXPECT_CALL(mock, constructed()).Times(1);
    EXPECT_CALL(mock, destructed()).Times(1);

    TestObject::Ptr obj0(TestObject::New(&mock));
    TestObject::Ptr obj1(obj0);
    TestObject::Ptr obj2(obj1);

    TestObject * obj = obj0.get();

    {
        std::set<TestObject::Ptr> set;
        set.insert(obj0);
        EXPECT_NE(set.end(), set.find(obj0));
        EXPECT_NE(set.end(), set.find(obj1));
        EXPECT_NE(set.end(), set.find(obj2));
        EXPECT_NE(set.end(), set.find(obj));
    }

    {
        std::unordered_set<TestObject::Ptr> uset;
        uset.insert(obj0);
        EXPECT_NE(uset.end(), uset.find(obj0));
        EXPECT_NE(uset.end(), uset.find(obj1));
        EXPECT_NE(uset.end(), uset.find(obj2));
        EXPECT_NE(uset.end(), uset.find(obj));
    }

    {
        std::map<TestObject::Ptr, int> map;
        map[obj0] = 0;
        EXPECT_EQ(0, map[obj0]);
        EXPECT_EQ(0, map[obj1]);
        EXPECT_EQ(0, map[obj2]);
        EXPECT_EQ(0, map[obj]);
        map[obj1] = 1;
        EXPECT_EQ(1, map[obj0]);
        EXPECT_EQ(1, map[obj1]);
        EXPECT_EQ(1, map[obj2]);
        EXPECT_EQ(1, map[obj]);
        map[obj2] = 2;
        EXPECT_EQ(2, map[obj0]);
        EXPECT_EQ(2, map[obj1]);
        EXPECT_EQ(2, map[obj2]);
        EXPECT_EQ(2, map[obj]);
        map[obj] = 3;
        EXPECT_EQ(3, map[obj0]);
        EXPECT_EQ(3, map[obj1]);
        EXPECT_EQ(3, map[obj2]);
        EXPECT_EQ(3, map[obj]);
    }

    {
        std::unordered_map<TestObject::Ptr, int> umap;
        umap[obj0] = 0;
        EXPECT_EQ(0, umap[obj0]);
        EXPECT_EQ(0, umap[obj1]);
        EXPECT_EQ(0, umap[obj2]);
        EXPECT_EQ(0, umap[obj]);
        umap[obj1] = 1;
        EXPECT_EQ(1, umap[obj0]);
        EXPECT_EQ(1, umap[obj1]);
        EXPECT_EQ(1, umap[obj2]);
        EXPECT_EQ(1, umap[obj]);
        umap[obj2] = 2;
        EXPECT_EQ(2, umap[obj0]);
        EXPECT_EQ(2, umap[obj1]);
        EXPECT_EQ(2, umap[obj2]);
        EXPECT_EQ(2, umap[obj]);
        umap[obj] = 3;
        EXPECT_EQ(3, umap[obj0]);
        EXPECT_EQ(3, umap[obj1]);
        EXPECT_EQ(3, umap[obj2]);
        EXPECT_EQ(3, umap[obj]);
    }
}