Exemple #1
0
//! メンバ追加のテスト(複数)
TEST_F( ClusterInfoTest, test_setAndGetmergeCost ) 
{
	ClusterInfo					ci;

	ci.setMergeCost( 0.5f );
	EXPECT_EQ( 0.5f, ci.getMergeCost() );

	ci.setMergeCost( 1234.567f );
	EXPECT_EQ( 1234.567f, ci.getMergeCost() );
}
Exemple #2
0
//! コンストラクタ(マージ)のテスト
TEST_F( ClusterInfoTest, test_mergeConstructor )
{
	ClusterInfo	*pC1 = new ClusterInfo();
	
	pC1->addMember( 3 );
	pC1->addMember( 5 );
	pC1->addMember( 1 );

	ClusterInfo	*pC2 = new ClusterInfo();

	pC2->addMember( 2 );
	pC2->addMember( 4 );
	pC2->addMember( 6 );

	const vector< DataIndex >* pMembers = NULL;

	ClusterInfo *pCm = new ClusterInfo( pC1, pC2, 100.0f, 123 );

	pMembers = pCm->getMembers();
	ASSERT_EQ( 6, pMembers->size() );
	EXPECT_EQ( 1, pMembers->at( 0 ) );	// ※ソートされる
	EXPECT_EQ( 2, pMembers->at( 1 ) );
	EXPECT_EQ( 3, pMembers->at( 2 ) );
	EXPECT_EQ( 4, pMembers->at( 3 ) );
	EXPECT_EQ( 5, pMembers->at( 4 ) );
	EXPECT_EQ( 6, pMembers->at( 5 ) );
	ASSERT_EQ( 100.0f, pCm->getMergeCost() );
	ASSERT_EQ( 123, pCm->getId() );

	delete pCm;
	delete pC1;
	delete pC2;

	return;
}