Ejemplo n.º 1
0
void CHPFileReaderTest::ReadCHPReseqFileTest()
{
	CHPData data;
	CHPFileReader reader;
	CPPUNIT_ASSERT_NO_THROW(reader.SetFilename("../data/CHP_reseq_file"));
	CPPUNIT_ASSERT_NO_THROW(reader.Read(data));

	CPPUNIT_ASSERT(data.GetFilename() == "../data/CHP_reseq_file");

	CPPUNIT_ASSERT(data.GetEntryCount() == 5);
	CPPUNIT_ASSERT(data.GetBackgroundZoneCnt() == 1);
	CPPUNIT_ASSERT(data.GetForceCnt() == 2);
	CPPUNIT_ASSERT(data.GetOrigCnt() == 3);

	const double eps = 1e-5;
	CHPReseqEntry e;
	data.GetEntry(0, e);
	CPPUNIT_ASSERT(e.call == 'a');
	CPPUNIT_ASSERT_DOUBLES_EQUAL(e.score, 1.0f, eps);

	data.GetEntry(1, e);
	CPPUNIT_ASSERT(e.call == 'c');
	CPPUNIT_ASSERT_DOUBLES_EQUAL(e.score, 2.0f, eps);

	data.GetEntry(2, e);
	CPPUNIT_ASSERT(e.call == 'g');
	CPPUNIT_ASSERT_DOUBLES_EQUAL(e.score, 3.0f, eps);

	data.GetEntry(3, e);
	CPPUNIT_ASSERT(e.call == 't');
	CPPUNIT_ASSERT_DOUBLES_EQUAL(e.score, 4.0f, eps);

	data.GetEntry(4, e);
	CPPUNIT_ASSERT(e.call == 'n');
	CPPUNIT_ASSERT_DOUBLES_EQUAL(e.score, 5.0f, eps);

	CHPReseqForceCall force;
	data.GetForceCall(0, force);
	CPPUNIT_ASSERT(force.position == 1);
	CPPUNIT_ASSERT(force.call == 'a');
	CPPUNIT_ASSERT(force.reason == CC_SATURATION_LEVEL_FORCE_CALL);

	data.GetForceCall(1, force);
	CPPUNIT_ASSERT(force.position == 2);
	CPPUNIT_ASSERT(force.call == 'c');
	CPPUNIT_ASSERT(force.reason == CC_WEAK_SIGNAL_THR_FORCE_CALL);

	CHPReseqOrigCall orig;
	data.GetOrigCall(0, orig);
	CPPUNIT_ASSERT(orig.position == 3);
	CPPUNIT_ASSERT(orig.call == 't');

	data.GetOrigCall(1, orig);
	CPPUNIT_ASSERT(orig.position == 4);
	CPPUNIT_ASSERT(orig.call == 'a');

	data.GetOrigCall(2, orig);
	CPPUNIT_ASSERT(orig.position == 5);
	CPPUNIT_ASSERT(orig.call == 'g');

}