void CalvinCHPMultiDataFileUpdaterTest::testMultiData1() { CreateReferenceFile1(); vector<ColumnInfo> cols; CalvinCHPMultiDataFileUpdater upd; ProbeSetMultiDataGenotypeData e; upd.Initialize(TEST1_FILE); e.call = 11; e.confidence = 111.0f; upd.UpdateMultiData(GenotypeMultiDataType, 0, e); e.call = 22; e.confidence = 222.0f; upd.UpdateMultiData(GenotypeMultiDataType, 2, e); CHPMultiDataData data; CHPMultiDataFileReader reader; CPPUNIT_ASSERT_NO_THROW(reader.SetFilename(TEST1_FILE)); CPPUNIT_ASSERT_NO_THROW(reader.Read(data)); CPPUNIT_ASSERT(data.GetEntryCount(GenotypeMultiDataType) == 4); data.GetGenotypeEntry(GenotypeMultiDataType, 0, e); CPPUNIT_ASSERT(e.name == "1"); CPPUNIT_ASSERT(e.call == 11); CPPUNIT_ASSERT_DOUBLES_EQUAL(e.confidence, 111.0f, 0.000001f); data.GetGenotypeEntry(GenotypeMultiDataType, 1, e); CPPUNIT_ASSERT(e.name == "2"); CPPUNIT_ASSERT(e.call == 2); CPPUNIT_ASSERT_DOUBLES_EQUAL(e.confidence, 20.0f, 0.000001f); data.GetGenotypeEntry(GenotypeMultiDataType, 2, e); CPPUNIT_ASSERT(e.name == "3"); CPPUNIT_ASSERT(e.call == 22); CPPUNIT_ASSERT_DOUBLES_EQUAL(e.confidence, 222.0f, 0.000001f); data.GetGenotypeEntry(GenotypeMultiDataType, 3, e); CPPUNIT_ASSERT(e.name == "4"); CPPUNIT_ASSERT(e.call == 4); CPPUNIT_ASSERT_DOUBLES_EQUAL(e.confidence, 40.0f, 0.000001f); }
void CalvinCHPMultiDataFileUpdaterTest::testMultiData2() { CreateReferenceFile2(); vector<ColumnInfo> cols; ByteColumn bcol(L"byte"); cols.push_back(bcol); UByteColumn ubcol(L"ubyte"); cols.push_back(ubcol); ShortColumn scol(L"short"); cols.push_back(scol); UShortColumn uscol(L"ushort"); cols.push_back(uscol); IntColumn icol(L"int"); cols.push_back(icol); UIntColumn uicol(L"uint"); cols.push_back(uicol); FloatColumn fcol(L"float"); cols.push_back(fcol); ASCIIColumn acol(L"ascii", 7); cols.push_back(acol); UnicodeColumn tcol(L"text", 10); cols.push_back(tcol); CalvinCHPMultiDataFileUpdater upd; ProbeSetMultiDataGenotypeData e; upd.Initialize(TEST2_FILE); e.metrics.resize(9); e.call = 11; e.confidence = 111.0f; e.metrics[0].SetValueInt8(9); e.metrics[1].SetValueUInt8(10); e.metrics[2].SetValueInt16(17); e.metrics[3].SetValueUInt16(18); e.metrics[4].SetValueInt32(33); e.metrics[5].SetValueUInt32(34); e.metrics[6].SetValueFloat(55.0f); e.metrics[7].SetValueAscii("text"); e.metrics[8].SetValueText(L"ascii"); upd.UpdateMultiData(GenotypeMultiDataType, 0, e, cols); e.call = 22; e.confidence = 222.0f; e.metrics[0].SetValueInt8(10); e.metrics[1].SetValueUInt8(11); e.metrics[2].SetValueInt16(18); e.metrics[3].SetValueUInt16(19); e.metrics[4].SetValueInt32(34); e.metrics[5].SetValueUInt32(35); e.metrics[6].SetValueFloat(66.0f); e.metrics[7].SetValueAscii("text2"); e.metrics[8].SetValueText(L"ascii2"); upd.UpdateMultiData(GenotypeMultiDataType, 2, e, cols); CHPMultiDataData data; CHPMultiDataFileReader reader; CPPUNIT_ASSERT_NO_THROW(reader.SetFilename(TEST2_FILE)); CPPUNIT_ASSERT_NO_THROW(reader.Read(data)); CPPUNIT_ASSERT(data.GetEntryCount(GenotypeMultiDataType) == 4); data.GetGenotypeEntry(GenotypeMultiDataType, 0, e); CPPUNIT_ASSERT(e.name == "1"); CPPUNIT_ASSERT(e.call == 11); CPPUNIT_ASSERT_DOUBLES_EQUAL(e.confidence, 111.0f, 0.000001f); CPPUNIT_ASSERT(e.metrics[0].GetValueInt8() == 9); CPPUNIT_ASSERT(e.metrics[1].GetValueUInt8() == 10); CPPUNIT_ASSERT(e.metrics[2].GetValueInt16() == 17); CPPUNIT_ASSERT(e.metrics[3].GetValueUInt16() == 18); CPPUNIT_ASSERT(e.metrics[4].GetValueInt32() == 33); CPPUNIT_ASSERT(e.metrics[5].GetValueUInt32() == 34); CPPUNIT_ASSERT_DOUBLES_EQUAL(e.metrics[6].GetValueFloat(), 55.0f, 0.00001f); CPPUNIT_ASSERT(e.metrics[7].GetValueAscii() == "text"); CPPUNIT_ASSERT(e.metrics[8].GetValueText() == L"ascii"); data.GetGenotypeEntry(GenotypeMultiDataType, 1, e); CPPUNIT_ASSERT(e.name == "2"); CPPUNIT_ASSERT(e.call == 2); CPPUNIT_ASSERT_DOUBLES_EQUAL(e.confidence, 20.0f, 0.000001f); CPPUNIT_ASSERT(e.metrics[0].GetValueInt8() == 8); CPPUNIT_ASSERT(e.metrics[1].GetValueUInt8() == 8); CPPUNIT_ASSERT(e.metrics[2].GetValueInt16() == 16); CPPUNIT_ASSERT(e.metrics[3].GetValueUInt16() == 16); CPPUNIT_ASSERT(e.metrics[4].GetValueInt32() == 32); CPPUNIT_ASSERT(e.metrics[5].GetValueUInt32() == 32); CPPUNIT_ASSERT_DOUBLES_EQUAL(e.metrics[6].GetValueFloat(), 44.0f, 0.00001f); CPPUNIT_ASSERT(e.metrics[7].GetValueAscii() == "ascii"); CPPUNIT_ASSERT(e.metrics[8].GetValueText() == L"text"); data.GetGenotypeEntry(GenotypeMultiDataType, 2, e); CPPUNIT_ASSERT(e.name == "3"); CPPUNIT_ASSERT(e.call == 22); CPPUNIT_ASSERT_DOUBLES_EQUAL(e.confidence, 222.0f, 0.000001f); CPPUNIT_ASSERT(e.metrics[0].GetValueInt8() == 10); CPPUNIT_ASSERT(e.metrics[1].GetValueUInt8() == 11); CPPUNIT_ASSERT(e.metrics[2].GetValueInt16() == 18); CPPUNIT_ASSERT(e.metrics[3].GetValueUInt16() == 19); CPPUNIT_ASSERT(e.metrics[4].GetValueInt32() == 34); CPPUNIT_ASSERT(e.metrics[5].GetValueUInt32() == 35); CPPUNIT_ASSERT_DOUBLES_EQUAL(e.metrics[6].GetValueFloat(), 66.0f, 0.00001f); CPPUNIT_ASSERT(e.metrics[7].GetValueAscii() == "text2"); CPPUNIT_ASSERT(e.metrics[8].GetValueText() == L"ascii2"); data.GetGenotypeEntry(GenotypeMultiDataType, 3, e); CPPUNIT_ASSERT(e.name == "4"); CPPUNIT_ASSERT(e.call == 4); CPPUNIT_ASSERT_DOUBLES_EQUAL(e.confidence, 40.0f, 0.000001f); CPPUNIT_ASSERT(e.metrics[0].GetValueInt8() == 8); CPPUNIT_ASSERT(e.metrics[1].GetValueUInt8() == 8); CPPUNIT_ASSERT(e.metrics[2].GetValueInt16() == 16); CPPUNIT_ASSERT(e.metrics[3].GetValueUInt16() == 16); CPPUNIT_ASSERT(e.metrics[4].GetValueInt32() == 32); CPPUNIT_ASSERT(e.metrics[5].GetValueUInt32() == 32); CPPUNIT_ASSERT_DOUBLES_EQUAL(e.metrics[6].GetValueFloat(), 44.0f, 0.00001f); CPPUNIT_ASSERT(e.metrics[7].GetValueAscii() == "ascii"); CPPUNIT_ASSERT(e.metrics[8].GetValueText() == L"text"); }